Re: Win32Lib Losing Keys

new topic     » goto parent     » topic index » view thread      » older message » newer message

cklester wrote:
> 
> Derek Parnell wrote:
> > cklester wrote:
> > > 
> > > What if I have multiple buttons/controls? Do I need to define
> > > a KeyDown routine for each and every control that could possibly
> > > be affected by a spacebar?
> > 
> > If you don't want ANY control to react to the spacebar then do this...
> > 
> >    procedure Skip_the_spacebar(integer self, integer event, sequence parms)
> >          if parms[1] = ' ' then
> >              returnValue(-1)
> >          end if
> >    end procedure
> >    setHandler(Screen, w32HKeyDown, routine_id("Skip_the_spacebar"))
> 
> That doesn't work. The SPACEBAR keypress still causes the button
> to click. I even tried the following, which
> doesn't allow any kepress to go through, yet the button still gets
> clicked with the spacebar.

You did put in that patch I mentioned, didn't you? It won't work
without that patch. It does work here with the patch installed.

> 
> procedure Window1_onKeyPress (integer self, integer event, sequence
> params)--params
> is ( int keyCode, int shift )
> 	setText(StatusBar2, "Got key " & params[1] & "." )
> 	returnValue(-1)
> end procedure
> setHandler( Screen, w32HKeyDown, routine_id("Window1_onKeyPress"))
> 
> > What is the real problem you are trying to solve?
> 
> Being able to press the spacebar without having a recently clicked
> button react to it.

By 'recently' do you actually mean the most recent button that was clicked?
Or any button that was click in the last 'x' seconds?

If it just the last button clicked, then on the Click event, place this
button's id in the SkipBar sequence, and use the Screen keydown to
check the getSelf() returns that same id, if so ignore the spacebar
for it.  Dead simple.

> > Or to put it another 
> > way, what is the real effect you are trying to achieve?
> 
> When the user types, I'm using wPuts() to put it to a part of the
> window. They can click buttons to do other things, but when they
> start typing again, I expect to be able to receive those events and
> wPuts() them to the window again. But it doesn't work that way, yet. :)

Arhhh...so if a button has focus, and you start getting keystrokes, you
wish to 'pretend' that its the Window that actually has focus. 


-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu