Why it's not working ?

Why it's not working ?

Postby HunterEC » Tue Aug 16, 2011 5:55 am

On the following code extract:
Code: Select all  Expand view
  @ 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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Why it's not working ?

Postby James Bott » Tue Aug 16, 2011 2:31 pm

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

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Why it's not working ?

Postby HunterEC » Tue Aug 16, 2011 6: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 ?
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Why it's not working ?

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests

cron