Archive: Mui Button Focus


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


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,

SendMessage$R0WM_SETFOCUS00

where $R0 is the window handle of the cancel button.

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.


Use $HWNDPARENT as dialog. For example:

GetDlgItem $0 $HWNDPARENT 1


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


${WM_SETFOCUS} instead of WM_SETFOCUS


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


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