Old 30th August 2005, 12:22   #1
ShakerWD
Junior Member
 
Join Date: Aug 2005
Posts: 11
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
ShakerWD is offline   Reply With Quote
Old 30th August 2005, 17:48   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Have you set the focus before disabling the button?

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 30th August 2005, 19:43   #3
ShakerWD
Junior Member
 
Join Date: Aug 2005
Posts: 11
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
ShakerWD is offline   Reply With Quote
Old 30th August 2005, 19:49   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

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 30th August 2005, 20:24   #5
ShakerWD
Junior Member
 
Join Date: Aug 2005
Posts: 11
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
ShakerWD is offline   Reply With Quote
Old 30th August 2005, 20:28   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The text box has the focus by default in the directory page.

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 31st August 2005, 08:08   #7
ShakerWD
Junior Member
 
Join Date: Aug 2005
Posts: 11
hi,
think i found my mistake

bad code
PHP Code:
Function makeReadOnly
  FindWindow $R0 
"#32770" "" $HWNDPARENT
  
  
;disable textbox
  GetDlgItem $R1 $R0 1019
  EnableWindow $R1 0
  
  
;disable button
  GetDlgItem $R1 $R0 1001
  EnableWindow $R1 0

  
;for Next/Install Button
  GetDlgItem $R0 $HWNDPARENT 1
  SendMessage $R0 WM_SETFOCUS 0 0
FunctionEnd 
working code
PHP Code:
Function makeReadOnly
  FindWindow $R0 
"#32770" "" $HWNDPARENT

  
;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
ShakerWD is offline   Reply With Quote
Old 31st August 2005, 11:39   #8
ShakerWD
Junior Member
 
Join Date: Aug 2005
Posts: 11
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?
ShakerWD is offline   Reply With Quote
Old 1st September 2005, 18:09   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
  • WM_SETFOCUS is zero. You need ${WM_SETFOCUS}.
  • A complete example script is still missing.

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
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