Archive: Hiding fields in in custom pages initially


Hiding fields in in custom pages initially
Hi there, I've got a custom page where if you click on certain radio buttons, fields appear and disappear.

The problem i'm having is that they seem to show up all at once when the program is first booted up, though they fix themselves once a radio button is clicked.

Here's what I'm referring to:
http://dl.dropbox.com/u/508717/Untitled-1.jpg

I need to hide the button below that text, and I'm not sure how to do so.

I've tried using ShowWindow in the page creation function, but that doesn't seem to work the way I'm doing it, and I doubt it has anything with the leave page function.

I'm not too familiar with HWND and all that, so I'm running into a bit of a snag here. Anyone care to help me with this...? :x


You need to send the showwindow 0 message to the button. The HWND is simply a number that identifies the specific button. You get it when you create the button:

${NSD_CreateButton} Etc etc
pop $YourButtonHWND
ShowWindow $YourButtonHWND ${SW_HIDE}

If "the way you're doing it" doesn't work, it would help if you could paste (a small piece of) example code. We could point out what you're doing wrong.


My page is created by writing an ini file on the fly, here is the snippet where the button is

WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Type" "Button"
WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Text" "*ROOT* - Fix Permissions for '/data/app'"
WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Flags" "NOTIFY"
WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Left" "0"
WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Right" "150"
WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Top" "105"
WriteINIStr "$PLUGINSDIR\dirPage.ini" "Field 9" "Bottom" "125"


And here's the function where I initialise my page:

Function DirPage
!insertmacro MUI_HEADER_TEXT "APK Directory Page" "Select the directory of which to scan APK files for"

;Display the InstallOptions dialog
Push $DIRPAGE
InstallOptions::dialog /NOUNLOAD "$PLUGINSDIR\dirPage.ini"
Pop $DIRPAGE
GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
InstallOptions::Show '$PLUGINSDIR\dirPage.ini'
Pop $DIRPAGE
Pop $DIRPAGE
Pop $DIRPAGE
FunctionEnd


The way I got it to work via DirEndPage (page leave function name) is:

ReadINIStr $3 "$PLUGINSDIR\dirPage.ini" "Field 9" "HWND"
ShowWindow $3 0


Nothing I've tried so far works and I wouldn't have the faintest idea where to put that snippet you just gave me unfortunately.

Sorry for the trouble, and thanks.

I haven't used InstallOptions in over five years, I've no idea how to hide a component using that. If it's at all possilbe. I would strongly recommend you stop using IO and switch to nsDialogs: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

But perhaps someone else can answer your specific question.


You should be doing it between calls to ::InitDialog and ::Show (your first plug-in call shouldn't be ::Dialog).

But yeah switching to nsDialogs and MUI2 makes this a lot easier.

Stu


Wow okay. You know I have been using NSIS for AGES now, and I never realised they replaced the part I disliked most about creating custom pages.

It seems so much easier now. Hah. I may just rewrite it in this new style :) Thanks man.

EDIT: Even MUI2. It almost seems like I have been living in a time portal with all of this... the heck.