FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TGET behavior (Antonio)
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
TGET behavior (Antonio)
Posted: Tue Jan 08, 2019 02:43 PM
In method createbutton() is this line
Code (fw): Select all Collapse
::oBtn:bAction := {|| Eval( oThis:bAction, oThis ),oThis:SetFocus() }

It respects not the present data ::lKeepFocus!! Should be:
Code (fw): Select all Collapse
::oBtn:bAction := {||  ( Eval( oThis:bAction, oThis ), if( ::lKeepFocus, oThis:SetFocus(), nil ) ) }

as i cannot automatic go to next control after processing the oBtn:baction, if i need so.
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: TGET behavior (Antonio)
Posted: Thu Jan 10, 2019 09:31 AM

Antonio,
as the Button is an other way to input the value my idea is:
if lKeepfocus is false, to evaluate the oGet:bValid if present an then go to next control!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: TGET behavior (Antonio)
Posted: Sat Jan 12, 2019 03:02 PM
I add this code to method createbutton() after line 943 in FWH 18/12
Code (fw): Select all Collapse
if !::lKeepFocus
        ::oBtn:bAction := {|| Eval( oThis:bAction, oThis ),oThis:refresh(),if(valtype(::bValid) == "B",;    //if bvalid is "B"
                                        if(Eval( ::bValid, oThis ),;        //if bValid == .T.
                                        ::oWnd:gonextctrl(::hWnd),;     //next control
                                        oThis:Setfocus()),;         //focus stay
                                        ::oWnd:gonextctrl(::hWnd));     //automatic next control
                                        }
endif
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TGET behavior (Antonio)
Posted: Sat Jan 12, 2019 05:32 PM

Dear Günther,

Is it fully backwards compatible ?

Will we break someone else code ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: TGET behavior (Antonio)
Posted: Sat Jan 12, 2019 07:34 PM

Antonio, i think nobody has used ::lKeepFocus as it was not used in actual tget-code! But it saves keybord- or mouse activation in the case of exist ::oBtn in the get and is elegant.
I am also excite to add in the headerfile on GET and [ACTION[NONEXT]]. [NONEXT] sets ::lKeepfocus to .F.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: TGET behavior (Antonio)
Posted: Sun Jan 13, 2019 07:18 PM

Rick, you can use your code as before if you do not set ::lKeepFocus to .F.!
I want this behavior for example to put a date from a calendar and if the valid-clause is .T. the cursor steps to next control without using the keybord.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: TGET behavior (Antonio)
Posted: Mon Jan 14, 2019 03:31 PM
Adapted code to respect oJump if present.
Code (fw): Select all Collapse
if !::lKeepFocus
        ::oBtn:bAction := {|| Eval( oThis:bAction, oThis ),oThis:refresh(),if(valtype(::bValid) == "B",;    //if bvalid is "B"
                                        if(Eval( ::bValid, oThis ),;        //if bValid == .T.
                                        (if(::oJump != nil,setfocus(::oJump:hWnd),::oWnd:gonextctrl(::hWnd))),;     //next control or oJump
                                        oThis:Setfocus()),;         //focus stay
                                        if(::oJump != nil,setfocus(::oJump:hWnd),::oWnd:gonextctrl(::hWnd)));       //automatic next control or oJump
                                        }
endif
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: TGET behavior (Antonio)
Posted: Mon Jan 14, 2019 04:39 PM
Günther

I deleted my post after re-reading your initial post about oBtn ... here is the code I deleted that pertained to the oJump method ..

Code (fw): Select all Collapse
REDEFINE GET oPosition  VAR cPosition  ID 142 of oGrps PICTURE "@!" BITMAP "find";
      ACTION ( _PosGet( cMode,@cPosition,oPosition,oPositionAbbr,@cPositionAbbr,"BUTTON",;
                          oButt1,oButt2,oRsEmp ),;
                          oPositionAbbr:SetFocus(),oPositionAbbr:oJump := oPositionAbbr ) UPDATE
       oPosition:lAdjustBtn := .t.

       oPosition:bKeyDown := {|nK| if( nK==VK_RETURN,( ;
               _PosGet( cMode,@cPosition,oPosition,oPositionAbbr,@cPositionAbbr,"FIELD",;
                          oButt1,oButt2,oRsEmp ),;
                          oOrganU:SetFocus(),oOrganU:oJump := oOrganU ), ) }

   REDEFINE GET oPositionAbbr     VAR cPositionAbbr ID 148 of oGRPS UPDATE //COLOR CLR_BLACK, 16053492 READONLY


In the above code .. tget is evaluating the bKeydown code block and traps the <enter> key .. thereby blocking the navigation to the next field .. I believe the above code was inspired my Antonio .. I mention oJump in my deleted post and noted that if was a bit clumsy and your solution seemed much more elegant .. Hope this post is relevant to your tget enhancement.

Rick Lipkin

Continue the discussion