FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Why it's not working ?
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Why it's not working ?
Posted: Tue Aug 16, 2011 05:55 AM
On the following code extract:
Code (fw): Select all Collapse
   @ 55,005 SAY oSays[5]  VAR "&Name"    OF oDlg PIXEL
   @ 55,45 GET oGets[5] VAR acNames[1]       OF oDlg SIZE 40,10 PIXEL  PICTURE "@!" ;
                WHEN EVAL({|| SETKEY(VK_F2, {|| cVar := acNames[1],  ;
                                        NameLookUp(@cVar, .F., .F.),                ;
                                        acNames[1] := cVar, oGets[5]:varget(), oGets[5]:refresh()}), .T.})        ;
                VALID (EMPTY(acNames[1]) .OR. ChkPlan (acNames[1])) .AND.      ;
                         RelHotKey (VK_F2)
   @ 55,105 GET oGets[6] VAR acNames[2]      OF oDlg SIZE 40,10 PIXEL PICTURE "@!"
.
.
.
STATIC FUNCTION RelHotKey (nKey)
   SET KEY nKey TO
RETURN .T.
* EOF: RelHotKey


The lookup window (activated via the F2 key or an invalid name) is still active on the second get even tough I expressly reset it on the ResetHotKey function.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Why it's not working ?
Posted: Tue Aug 16, 2011 02:31 PM

If the first check in the VALID clause is .t. then the second one doesn't get checked.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: Why it's not working ?
Posted: Tue Aug 16, 2011 06:52 PM

James:

Thank you for your response. I agree with you, the first part of the VALID clause is on the .OR. side, if evaluates to .T. does not continue checking. But since the .OR. conditions are in parentheses .AND. then united with an .AND., the right part of the VALID has to be evaluated also. There is where I reset the hotkey secuence. Even if I move the ResetHotey function as the first condition evaluated, the F2 hotkey is activated in any of the gets. Any clues ?

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Why it's not working ?
Posted: Tue Aug 16, 2011 11:46 PM

Hunter,

Yes, I see your point--I totally missed the extra parens.

I suggest writing a simple program just to test the RelHotKey() function. Just a dialog with a couple of GETs and a simple VALID.

@ 55,45 GET oGets[5] VAR cName2 OF oDlg VALID RelHotKey()

I would also try a sysrefresh() after the SET KEY nKey TO statement.

If you still have no success, then post your test program here.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion