From: BillT on
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: Stephen Quinn on
Bill

> Now I have a KeyChar method, but it doesn't get called - why?

The window is probably processing the key stroke BEFORE bBrowser ever sees
it.

Does bBrowser have a KeyChar() callback event (see docs)??
If not then your going about it the wrong way.

Use a KeyHandlerEvent() (see bBrowser docs/samples) on the window and you
can capture all key strokes there prior to the window processing them.

CYA
Steve


From: BillT on
Steve,
Yes, bBrowser Help does include a KeyChar callback method.

The bBrowser help file says "bBrowser:KeyChar() is called if the
bBrowser have the focus and an alphanumeric key is pressed. The method
is called according to the method Control:KeyDown() and before the
method Control:KeyUp()."

I confess that I don't understand the meaning of that second sentence,
so it may hold the answer to my problem?

Thanks,
Bill



From: Stephen Quinn on
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: Bill Tillick on
Hi Steve,
Can you please point me in the right direction for coding such a
KeyHandler, please. Do you have an example?

Thanks,
Bill