Chieftec
13th October 2006 23:37 UTC
Radiobuttons: Updating the particular Image when selecting it
Hi,
I am creating a page with InstallOptions and preview images.
If you select a radiobutton an image should be displayed and if you select another radiobutton another should be displayed.
Here you can see what I want to create:
http://img147.imageshack.us/img147/1180/greyhb2.jpg
http://img128.imageshack.us/img128/7780/blueht6.jpg
But at the moment only one image for both is displayed, even if I defined two; So there is no change of the images.
I checked all the InstallOptions examples, but my problem isn't described there.
Greetings, Chieftec
Chieftec
14th October 2006 16:53 UTC
Is there no one who knows an answer :(?
Afrow UK
14th October 2006 20:39 UTC
Use Notify on the radio buttons. Have three image controls one on top of another with the different images, and set two of them to hidden (with ShowWindow) before showing the page (between InitDialog and Show/Display). Depending on the selected radio button, use ShowWindow to hide all the images and then ShowWindow to show the correct one.
-Stu
Chieftec
15th October 2006 01:21 UTC
Thank you for your response Afrow UK!
But how to use ShowWindow... Can you give me an example ?
bholliger
15th October 2006 04:41 UTC
Hi!
You'll find a small example in the manual:
http://nsis.sourceforge.net/Docs/Chapter4.html
4.9.14.17 ShowWindow
Have a nice day!
Bruno
{_trueparuex^}
15th October 2006 13:31 UTC
Originally posted by Chieftec
Thank you for your response Afrow UK!
But how to use ShowWindow... Can you give me an example ?
See the testnotify.nsi InstallOptions example and to show / hide the control use something like this.
WinMessages.nsh
...
; get status of radio button
ReadINIStr $0 "$PLUGINSDIR\yourpage.ini" "Field x" "State"
StrCmp $0 "1" 0 noshow
; get handle of image control
ReadINIStr $1 "$PLUGINSDIR\yourpage.ini" "Field x" "HWND"
ShowWindow $1 ${SW_SHOW}
noshow:
...
Chieftec
16th October 2006 00:20 UTC
Thank you {_trueparuex^}
I tried it like you said, but it hides the buttons and not the image...
Any Idea?
{_trueparuex^}
17th October 2006 13:07 UTC
Oops. Use the image control field number instead of radio button field number.
...
; get status of radio button
ReadINIStr $0 "$PLUGINSDIR\yourpage.ini" "Field x" "State"
StrCmp $0 "1" 0 noshow
; get handle of image control
ReadINIStr $1 "$PLUGINSDIR\yourpage.ini" "Field y" "HWND"
ShowWindow $1 ${SW_SHOW}
noshow:
...
Actually now when I think, there is a lot better way to do this. The radio button status is either 1 or 0 and the ShowWindow will hide the control with show_state 0 and show the control with show_state 1. So you should be able to use code like this...
; get the state of radio button 1
ReadINIStr $0 "$PLUGINSDIR\yourpage.ini" "Field x1" "State"
; get the handle of image control 1
ReadINIStr $1 "$PLUGINSDIR\yourpage.ini" "Field y1" "HWND"
; simply pass the radio button status as show_state for the image control.
ShowWindow $1 $0
; do the same thing for every radio button / image control
{_trueparuex^}
17th October 2006 13:27 UTC
... I made a small example.
Chieftec
17th October 2006 14:50 UTC
Thank your very much! It works fine :)