Page 1 of 1

Get class and focus

Posted: Mon Mar 05, 2012 2:11 pm
by driessen
Hello,

A small question ?

How can I read which GET has the clause ?
I want to do make a jump to another screen but I need to restore the focus on the right GET.

Thanks in advance.

Re: Get class and focus

Posted: Mon Mar 05, 2012 3:18 pm
by hmpaquito
Hi,

Code: Select all

hFocus:= GetFocus()

.....  // blah, blah, blah...

SetFocus(hFocus)
 
Regards

Re: Get class and focus

Posted: Mon Mar 05, 2012 4:25 pm
by Antonio Linares
Michel,

nAt = AScan( oDlg:aControls, { | o | o:hWnd == GetFocus() } )

...

oDlg:aControls[ nAt ]:SetFocus()

Re: Get class and focus

Posted: Mon Mar 05, 2012 7:16 pm
by Demont Brecht
Michel

Changing focus seems always to be dificult and unprecditable.

I have much better results with :

Code: Select all

*****************************************************************************************
function xSetFocus( oObx )
**************************
// function from local.fivewin.english 4/1/2003 Kleyber Derick
local oTempo:=""
local lGet := oObx:ClassName $ "TGET TMULTIGET"
define timer oTempo interval 10 of oObx:oWnd ;
  action (oObx:SetFocus(), IIF(lGet , oObx:SetPos(0) , ), oTempo:Deactivate() )
activate timer oTempo

return nil
 

Re: Get class and focus

Posted: Mon Mar 05, 2012 7:42 pm
by driessen
Hello guys,

Thanks a lot for all you help.

I'll be trying out your suggestions.