Home > Archive > Clipper > June 2006 > ListBox & FiveWin question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ListBox & FiveWin question
|
|
| Mel Smith 2006-06-17, 7:55 am |
| Dear Friends,
Have spent all day trying to 'capture' the VK_ESCAPE key in a Fivewin
ListBox (oListBox) which is part of a small dialog (oDlg)
I've tried:
a. The setkey approach:
SETKEY(VK_ESCAPE,{|| msginfo("Leaving now"), oDlg:end(),etc,
etc})
b. The 'bKeyDown' approach:
oListBox:bKeyDown := {|nKey,nFlags| msginfo("leaving
now" ),if(nKey=VK_ESCAPE,oDlg:end(),DoNothing
())}
but I *never* seem to enter the codeblocks and display my message :((
Can anyone give me a hint on how to do this ??
TIA,
-Mel Smith
| |
| Stephen Quinn 2006-06-17, 7:55 am |
| Mel
What if you use the Clipper constant K_ESC instead f the windows version.
Capturing keyboard characters in windows is usually done in a dispatch handler
for the window in VO (don't know anything about FW which may do something
different).
HTH
Steve
| |
| Mel Smith 2006-06-17, 7:55 am |
| Stephen said:
> What if you use the Clipper constant K_ESC instead f the windows version.
>
> Capturing keyboard characters in windows is usually done in a dispatch
handler
> for the window in VO (don't know anything about FW which may do something
> different).
Stephen, I'll try that tomorrow.
Thank you.
-Mel Smith
| |
| Mel Smith 2006-06-17, 7:55 am |
| Stephen,
My enviro: FW 2.1c, Clipper 5.2e
Well, I tried the K_ESC method:
bSavESC := SETKEY(K_ESC,{|| MSGINFO("Leaving Now"),oDlg:end()})
and still, I didn't enter the codeblock above when I pressed the <Esc>
key (while focus was in my ListBox)
I did however exit the dialog -- just never entered the code block.
Does anybody have any idea what else I might try ??
TIA,
-Mel Smith
| |
| Mel Smith 2006-06-17, 7:55 am |
| Stephen:
In the end, I went into \fw21\source\classes\listbox, and altered the
class as follows:
// ---- from EMG on May 18th, 2004 to process a <Return> key in a Listbox
// With addition of <VK_ESCAPE> code by MWS on Jun 13/06
METHOD HandleEvent(nMsg,nWParam,nLParam) CLASS TListBox
if nMsg == WM_GETDLGCODE .and. nWParam == VK_RETURN
::oWnd:nLastKey := VK_RETURN
return Super:Keydown(nWParam,nLParam)
endif
// this next secion is a small addition to allow capture of <esc>
// It is, of course, simply a small copy/addition of code to what Enrico
told me two years ago above
if nMsg == WM_GETDLGCODE .and. nWParam == VK_ESCAPE
::oWnd:nLastKey := VK_ESCAPE
return Super:Keydown(nWParam,nLParam)
endif
return Super:HandleEvent(nMsg,nWParam,nLParam)
//----------------------------------------------//
Thanks for your help
- Mel Smith
|
|
|
|
|