FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to know the current control?
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to know the current control?
Posted: Thu Sep 16, 2010 03:37 AM
Code (fw): Select all Collapse
If oDlg:aControls[i]:lFocused
            //-- Your function
            exit
        end

"//--Your function" never gets executed in this case, because when the VK button is clicked no Get object has focus.

We want to know the Get that was in focus before pressing the VK button, which has already lost focus.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How to know the current control?
Posted: Mon Sep 20, 2010 08:23 PM
Perhaps you could use the GETs bLostFocus codeblock to call a set/get function that stores the GET that last had focus. This would work for any control, not just GETs.

James
----------------------------

Code (fw): Select all Collapse
oGet:bLostFocus:={| | LastFocus( self ) }

Then you could simply do:

setFocus( LastFocus() )


// Set/Get function to store last focused control
static function LastFocus( oControl )
   local oReply
   static oOldControl
   oReply:= oOldControl
   if oControl != nil
      oOldControl:= oControl
   endif
return oReply
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion