Change focus on TAB or Enter

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
jdsoft
Posts: 116
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Change focus on TAB or Enter

#1 Post by jdsoft »

Hello,
I have a window with multiple DCGET's.
Every get has a VALID clause.

I can navigate from a DCGET to another DCGET in 4 ways:
1. Tab-key
2. Enter-key
3. Shift-Tab key
4. Mouseclick in other DCGET

How can i set focus to a special field if i navigate with the Tab-key or the Enter-Key?
The working of Shift-Tab and Mouseclick should not change.

My current code looks like:

Code: Select all

@  nLine,nTab2 DCGET oTekening:breedte PICTURE "9999.99" ;
               WHEN {||lEdit} ;
               VALID {||Tekening_Herberekenen_Plaat(oTekening,GetList),SetAppFocus(oBewerking),TRUE}
But this changes focus to the oBewerking at all navigation.
I tryed to use

Code: Select all

iif(LastAppEvent()=xbeK_TAB,SetAppFocus(oBewerking),nil)
in the Valid clause, but it always returns the same value 1048629.

Suggestions are welcome.

Regards,
Jack Duijf
Regards,
Jack Duijf

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Change focus on TAB or Enter

#2 Post by Wolfgang Ciriack »

Hi Jack,
you can try

Code: Select all

iif(dc_readguilastkey(Getlist)=xbeK_ENTER, setAppFocus(oBewerking),NIL), .T. }
_______________________
Best Regards
Wolfgang

User avatar
jdsoft
Posts: 116
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Re: Change focus on TAB or Enter

#3 Post by jdsoft »

Hello Wolfgang,

Thank you for the suggestion. All works as expected now.
This resulted in the folowing code:

Code: Select all

LOCAL bKeyFocus      := {|o|Set_KeyFocus(GetList,o)}
DCGET .... VALID {||Tekening_Herberekenen_Plaat(oTekening,GetList),Eval(bKeyFocus,@oBewerking),TRUE}

Procedure Set_KeyFocus(GetList,o)
LOCAL nLastkey       := Dc_ReadGuiLastkey(GetList)
do case
   case nLastkey = xbeK_TAB
      SetAppFocus(o)
      Dc_ReadGuiLastkey(GetList,0)
   case nLastkey = xbeK_ENTER
      SetAppFocus(o)
      Dc_ReadGuiLastkey(GetList,0)
endcase
Return
Regards,
Jack Duijf
Regards,
Jack Duijf

Post Reply