Old 15th September 2003, 00:15   #1
jaschulz
Member
 
Join Date: Sep 2003
Posts: 69
Mui Button Focus

I would like to draw the focus to the cancel button when the user arrives at the License Page. Is there any way to do this?

Thanks,

JAS
jaschulz is offline   Reply With Quote
Old 15th September 2003, 00:54   #2
rsegal
Senior Member
 
rsegal's Avatar
 
Join Date: Feb 2003
Location: Toronto, Canada
Posts: 227
Should be able to do it getting the window handle of the cancel button and then send a WM_SETFOCUS message using SendMessage.

Something like,
PHP Code:
SendMessage $R0 WM_SETFOCUS 0 0 
where $R0 is the window handle of the cancel button.
rsegal is offline   Reply With Quote
Old 15th September 2003, 02:42   #3
jaschulz
Member
 
Join Date: Sep 2003
Posts: 69
Well, I tried this in LicenseShow:

GetDlgItem $R0 105 1
SendMessage $R0 WM_SETFOCUS 0 0

But it didn't work. It might be that the call to GetDlgItem is wrong. I am not sure what to use for the "dialog" parameter. I used the number id of the three button dialog from the resource file.

Also, the docs say something about "if you want the handle of a control on the inner dialog..." and I don't understand what the inner dialog is.

Any help would be appreciated.
jaschulz is offline   Reply With Quote
Old 15th September 2003, 07:48   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Use $HWNDPARENT as dialog. For example:

GetDlgItem $0 $HWNDPARENT 1

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 15th September 2003, 11:51   #5
jaschulz
Member
 
Join Date: Sep 2003
Posts: 69
Still doesn't work. This is what I have now:

Function LicenseShow
GetDlgItem $R0 $HWNDPARENT 2
SendMessage $R0 WM_SETFOCUS 0 0
FunctionEnd

But the focus still stays on the memo that shows the license text.

Any other ideas?

JAS
jaschulz is offline   Reply With Quote
Old 15th September 2003, 12:56   #6
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
${WM_SETFOCUS} instead of WM_SETFOCUS
Joost Verburg is offline   Reply With Quote
Old 15th September 2003, 14:26   #7
jaschulz
Member
 
Join Date: Sep 2003
Posts: 69
This is what I have now:

Function LicenseShow
GetDlgItem $R0 $HWNDPARENT 2
SendMessage $R0 ${WM_SETFOCUS} 0 0
FunctionEnd

But it's still not working.

JAS
jaschulz is offline   Reply With Quote
Old 15th September 2003, 14:48   #8
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
WM_SETFOCUS is actually a notification. To set the focus on a certain button, you should call the SetFocus API using the System plug-in.

http://msdn.microsoft.com/library/de...s/setfocus.asp
Joost Verburg is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump