Old 27th February 2007, 17:00   #1
Tanerax
Junior Member
 
Join Date: Dec 2005
Posts: 10
Setting Focus

I went through the forum looking and havn't managed to find a post regarding my particular circumstances to setting focus with custom dialogs.

I am looking for a way to change the focus of the "Install" to default to "Back" on the buttons at the bottom of the screen. For one of my custom dialogs.
Tanerax is offline   Reply With Quote
Old 27th February 2007, 17:15   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Instructor has wrote a very nice example at this thread,

http://forums.winamp.com/showthread....hreadid=240492

You need only the SetFocus call with system plugin

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 27th February 2007, 17:40   #3
Tanerax
Junior Member
 
Join Date: Dec 2005
Posts: 10
That has information on changing information on stuff located in the custom dialog but how do I get focus to a button that belongs to the ui (back button) ?
Tanerax is offline   Reply With Quote
Old 27th February 2007, 17:54   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
back button id is 3, so GetDlgItem $0 $HWNDPARENT 3

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 27th February 2007, 18:09   #5
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Just found a thread that is identical to your request,

http://forums.winamp.com/showthread....hreadid=149265

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 27th February 2007, 18:55   #6
Tanerax
Junior Member
 
Join Date: Dec 2005
Posts: 10
Quote:
Originally posted by Red Wine
back button id is 3, so GetDlgItem $0 $HWNDPARENT 3
I currently running with

GetDlgItem $r2 $HWNDPARENT 3
System::Call "user32::SetFocus(i r2)"

When I messagebox the $r2 value it comes out as the right handle according to my spy++ app but I can't seem to get this to actually set focus to cancel.

Is it possible that the installer is setting the Install Button to focus after the fact? thus overriding it?
Tanerax is offline   Reply With Quote
Old 27th February 2007, 19:01   #7
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Hold on a couple of seconds, both we shall learn from kichik

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 27th February 2007, 19:45   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
$R2 and $2 are not the same. For the System plug-in r2 is $2 and R2 is $R2.

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 27th February 2007, 19:50   #9
Tanerax
Junior Member
 
Join Date: Dec 2005
Posts: 10
Quote:
Originally posted by kichik
$R2 and $2 are not the same. For the System plug-in r2 is $2 and R2 is $R2.
So then the following should work?

GetDlgItem $2 $HWNDPARENT 3
System::Call "user32::SetFocus(i r2)"

Back is still not getting selected as a focus..
Tanerax is offline   Reply With Quote
Old 27th February 2007, 19:57   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Where exactly did you put this code?

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 27th February 2007, 20:01   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Hmm... You probably want to set it as the default button and not have focus on it. For that, there's WM_NEXTDLGCTL. Include WinMessages.nsh and use:
code:
GetDlgItem $2 $HWNDPARENT 3
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $2 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 27th February 2007, 20:01   #12
Tanerax
Junior Member
 
Join Date: Dec 2005
Posts: 10
I am loading up a custom dialog using InstallOptions::initdialog so its after loading that, and before InstallOptions::show
Tanerax is offline   Reply With Quote
Old 27th February 2007, 20:05   #13
Tanerax
Junior Member
 
Join Date: Dec 2005
Posts: 10
Quote:
Originally posted by kichik
Hmm... You probably want to set it as the default button and not have focus on it. For that, there's WM_NEXTDLGCTL. Include WinMessages.nsh and use:
code:
GetDlgItem $2 $HWNDPARENT 3
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $2 1

Actually that worked perfectly thanks a bunch.
Tanerax 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