FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Auto focus a checkbox from a dialog ON INIT
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Auto focus a checkbox from a dialog ON INIT

Posted: Thu Jun 02, 2011 11:24 AM
Code (fw): Select all Collapse
#include "Fivewin.ch"

#define WM_SYSKEYDOWN      0x0104

Function TestCheck
    LOCAL oDlg
 
    LOCAL oChk, lChk, nChk := 0
    LOCAL oChk2, lChk2, nChk2 := 0
 
    DEFINE DIALOG oDlg
 
    @ 0, 1 CHECKBOX oChk VAR lChk OF oDlg
    @ 1.2, 1 CHECKBOX oChk2 VAR lChk2 OF oDlg
 
    @ 2, 1 BUTTON "&Close" ACTION oDlg:End()
 
    ACTIVATE DIALOG oDlg CENTER  ;
       ON INIT oChk:PostMsg( WM_SYSKEYDOWN, 0, 2 ** 29 )
 
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Auto focus a checkbox from a dialog ON INIT

Posted: Thu Jun 02, 2011 01:04 PM
http://msdn.microsoft.com/en-us/library/ms646286(v=vs.85).aspx

lParam
The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.

...
29 The context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.

This way we simulate a pressed ALT :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Auto focus a checkbox from a dialog ON INIT

Posted: Thu Jun 02, 2011 01:30 PM
It doesn't work here. I always used

Code (fw): Select all Collapse
oDlg:bStart = { || oChk2:SetFocus() }


It works fine.

EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Auto focus a checkbox from a dialog ON INIT

Posted: Thu Jun 02, 2011 02:23 PM

XP and Win7 differences again ? :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion