Auto focus a checkbox from a dialog ON INIT

Auto focus a checkbox from a dialog ON INIT

Postby Antonio Linares » Thu Jun 02, 2011 11:24 am

Code: Select all  Expand view

#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Auto focus a checkbox from a dialog ON INIT

Postby Antonio Linares » Thu Jun 02, 2011 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Auto focus a checkbox from a dialog ON INIT

Postby Enrico Maria Giordano » Thu Jun 02, 2011 1:30 pm

It doesn't work here. I always used

Code: Select all  Expand view
oDlg:bStart = { || oChk2:SetFocus() }


It works fine.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Auto focus a checkbox from a dialog ON INIT

Postby Antonio Linares » Thu Jun 02, 2011 2:23 pm

XP and Win7 differences again ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests