Archive: problems with setting the focus...


problems with setting the focus...
  hi,
i disabled the textbox and the folder selection button in the MUI_PAGE_DIRECTORY. works fine.

problem is that after this operation nothing has the focus in the installer page. even pressing "ESC" is ignored. so i tried to set the focus to the "install" button.
doesnt work.
so i tested something:

GetDlgItem $NEXTBUTTON $HWNDPARENT 2
EnableWindow $NEXTBUTTON 0

Button 2(Cancel) and 3(Back) can be disabled this way.
only Btn 1 (Next/Install) isnt affected.
looks like a bug to me.

how to call System::Call "user32::SetFocus(???)"
other ways to set focus on the desired button?

cheers


Have you set the focus before disabling the button?


hi,
i didnt disable the button in the (real) installer.
disabling was just a test if the control id is correct.
in the directory page the button for selecting the folder and the folder text box is disabled in the real installer.

now i try to set the focus on the "next" button. on this page the button is labled with "install". the comand id is 1. but nothing affects this button. either disabling(for testing) nor setting the focus with the SetFocus call.
i dont know if i use the SetFocus correctly. but for me it looks like there is another problem thus i cant disable the button.

cheers


I was referring to the folder selection button. You should set the focus to another window before disabling the window that had the focus.

If nothing affects the Install button, you must be trying to manipulate it in the wrong context. Where did you put your code?

An example script would probably demonstrate the problem the best.


no windows focus is disabled by me. just the button and the textbox. however the window completly losts its focus.

i will post some code tomorrow. would be easier to see then.

thx for the answers for now!

cheers

Daniel


The text box has the focus by default in the directory page.


hi,
think i found my mistake

bad code


makeReadOnly

FindWindow $R0"#32770" "" $HWNDPARENT

;disable textbox
GetDlgItem $R1 $R0 1019
EnableWindow $R1 0

;disable button
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0

;1 for Next/Install Button
GetDlgItem $R0 $HWNDPARENT 1
SendMessage $R0 WM_SETFOCUS 0 0
FunctionEnd
>
working code

makeReadOnly

FindWindow $R0"#32770" "" $HWNDPARENT

;1 for Next/Install Button
GetDlgItem $R0 $HWNDPARENT 1
SendMessage $R0 WM_SETFOCUS 0 0

;disable textbox
GetDlgItem $R1 $R0 1019
EnableWindow $R1 0

;disable button
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0
FunctionEnd
>
i suppose leaving the windows without a current focus was not a good idea. only thing im missing now is the drawn caret in the "install" button. is there an easy way to get it back? not important but nice to have.

thx for your help!

cheers

Daniel

damm,
was too fast. the function marked with working code in the previous post isnt working. the focus is set to the install button, but the two controls arent disabled.

what do i misunderstand?