From: Stephen Quinn on
Bill

> Can you please point me in the right direction for coding such a
> KeyHandler, please. Do you have an example?

Look in the bBrowser sample AEFs - there's a few in there.

CYA
Steve


From: Gerhard Bunzel on
Bill,

look at function bRegisterByEventHandler(...) in the bBrowser helpfile.
There is also a sample 'bSample - SensitiveSearch'
You will find there all you need.

HTH

Gerhard


"BillT" <wtillick(a)hotmail.com> schrieb im Newsbeitrag
news:486654d8-7ddd-474f-941d-f3983fb4bf7d(a)i18g2000pro.googlegroups.com...
> Hello,
> In bBrowser I have methods for CaptionClick and CellDoubleClick that
> work fine.
>
> Now I have a KeyChar method, but it doesn't get called - why?
>
> METHOD KeyChar( oKeyEvent ) CLASS Product2List
> LOCAL cText as STRING
>
> cText := oKeyEvent:ASCIIChar
> InfoBox{self,,cText}:show() // never gets to here??
>
> IF cText == self:cLastKey // have we got a repeat of previous key
> press?
> self:server:skip(1) // yes, so skip to next record
> IF Upper(self:server:ProductName) > cText // does this still have
> the same initial letter?
> self:server:skip(-1) // no, so back up to the previous record
> ENDIF
> ELSE
> // new letter, so do a fresh seek
> self:server:seek(#ProductName, cText, true)
>
> self:cLastKey := cText // and save the initial letter
>
> ENDIF
>
> RETURN nil
>


From: Geoff Schaller on
Actually, not true.

Every key and mouse action can have up to 5 standard events, depending
on the key. The final combination will comprise of:

WM_GETDLGCODE
WM_KEYDOWN
WM_CHAR
WM_KEYUP
Or...
WM_SYSKEYxxxx (UP/DOWN)

The first event can occur several times in the chain. The Keyup event is
often absorbed but the control and wm_char has an interesting existence
depending on the responses to WM_GETDLGCODE. And then there are system
keys (like ALT, F1 and so on) that are often better trapped in the
BeforeDispatch.

If you take a look at the dispatch for RightSLE or bBrowser (its
equivalent) you will see how Willie and Joachim respond to the
WM_GETDLGCODE command to alter the command stream.

bBrowser works by registering its own event handler PRIOR to the
WndProc. This gives bBrowser the ability to trap and respond to all key
events but the trick is that you must register this handler for it to
work. Once you register it then all these handlers work as expected. You
can then override this function with your handler to do specific things.

The important thing for a bBrowser user is to get the source code and
look through it. There is some amazingly impressive handling going on in
there but it has hooks all over the place for us developers to get our
grubby mitts into.

keyChar() is definitely called.

Geoff



"Stephen Quinn" <stevejqNO(a)bigpondSPAM.net.au> wrote in message
news:8Nu2o.1581$Yv.617(a)viwinnwfe01.internal.bigpond.com:

> Bill
>
>
> > I confess that I don't understand the meaning of that second sentence,
> > so it may hold the answer to my problem?
>
> Each Key/mouse event is 2 actions KeyDown (Press) / KeyUp (Release) so the
> KeyChar() method allows you to do something between actions.
>
> eg WM_MOUSEBUTTON_DOWN / WM_MOUSEBUTTON_UP
>
> I believe what your trying to do is better in a KeyHandler event though.
>
> CYA
> Steve

From: BillT on
Geoff,
Thanks for that explanation and for coming back to KeyChar().
Coincidentally, while being out of town today I have been thinking
about this thread and decided that it was getting away from my
original query!

KeyChar() is specified for bBrowser, and appears to be exactly what I
want in this instance and therefore, although helpful, the other
suggestions are moving away from what I see as being a straightforward
issue i.e. how to make KeyChar() work.

You mention "you must register this handler for it to work". Please,
what code do I need to do that?
---------------------------------------------------------

Steve,
Thanks. I found an EventHandler in bSample-Sensitive Search and a
Dispatch in bSample-Edit that were processing key strokes but haven't
been able to yet successfully 'extract' from them. See my comments
above to Geoff about getting back to KeyChar().
--------------------------------------------------
Regards,
Bill

From: Stephen Quinn on
Bill

> KeyChar() is specified for bBrowser, and appears to be exactly what I
> want in this instance and therefore, although helpful, the other
> suggestions are moving away from what I see as being a straightforward
> issue i.e. how to make KeyChar() work.

I never used it (not even sure if it was in V1 or v2) as I found I could do
more/everything I needed to do in the Keyhandler event

> You mention "you must register this handler for it to work". Please,
> what code do I need to do that?

As Gerhard said (see the window postinit in the sample as well)
>>
look at function bRegisterByEventHandler(...) in the bBrowser helpfile.
There is also a sample 'bSample - SensitiveSearch'
You will find there all you need.
<<

I don't have VO installed on a working machine (2+ years since I last wrote
any code) otherwise I'd post the relevant code - I'm writing this from
fading memory<g>

Something like below and there should be something similar in one of the
sample KeyHandlers

CASE uMsg = WM_CHAR .AND. ;
( Between( UPPER( ASC( lParam ), 'A', 'Z' ) ) )
..AND. ;
oEvent:Window = SELF:oBbrowser
// Do the thing with the Server
RETURN SUCCESS // Use the bBrowser define for SUCCESS (forget what it
is at the moment)
- this is to tell the system that the keystroke was handled here

CYA
Steve