Archive: Can't set background color on dialog item


Can't set background color on dialog item
I added a checkbox field to my Finish page via a pre callback function. The checkbox field shows up with a gray background. Following kichik's advice in a forum thread, I'm trying to use SetCtlColors in the show callback function for the Finish page, to make the field's background transparent. But my code has no effect.

Here's my show callback function

Function showFInish
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 4
SetCtlColors $0 0xFF0000 0xooFF00
FunctionEnd


I played around with various values for text and background colors, and also tried "transparent" for the background color, but there is no effect.

I'm not sure I understand how to specify the handle for the checkbox dialog item. I used 4 because I added the checkbox field to ioSpecial.ini as "Field 4" in the pre callback function. I can't see what else to use for an ID.

This has always been an issue with check boxes. Try hiding and showing the control with ShowWindow.

Edit: And you have some o's in your colour hex. It should be zeros.

Stu


Hiding and showing the window didn't work. The checkbox control still has a gray background. Here's the show callback I used.

Function showFinish
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 4
SetCtlColors $0 0xFF0000 0x000000
ShowWindow $0 ${SW_HIDE}
ShowWindow $0 ${SW_SHOW}
FunctionEnd


Interestingly, when I commented out the last line, leaving the control hidden, it still shows up in the window. Seems that I'm not really pointing to the control properly.

Function showFinish
GetDlgItem $0 $MUI_HWND 1203 # 1200 + field # - 1
SetCtlColors $0 0xFF0000 0x000000
FunctionEnd


Stu

Thanks, that's the info I was missing. It's working now. Can you help me understand the general lesson here?

I understand now how to define the item_id for the dialog items (i.e. 1200 + 4 -1 = 1203). But I'm wondering why

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1203


didn't work, and I had to use

GetDlgItem $0 $MUI_HWND 1203


I'm wondering because I use the first method to get items from the component page (to de-select them), using a function that kichik gave me last year. It is

Function compShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1032
SendMessage $0 ${TVM_SELECTITEM} ${TVGN_CARET} 0
FunctionEnd


So this works for the Components page but not the Finish page, even though both are MUI pages.

I'm also wondering where the item_id of 1032 comes from in kichik's function, since that can't be 1200 + field number - 1.

The Finish page is actually an InstallOptions dialog. $MUI_HWND contains the handle to that dialog. For other pages, one must use FindWindow to get the child window inside $HWNDPARENT (#32770).

1032 is the control id of the tree view control on the components page. All control id's have to be unique, and being that the Finish (and Welcome) pages are InstallOptions dialogs, control id's start from 1200 with 1200 being the first control.

Another way to get the handles of InstallOptions controls is to read from HWND and HWND2 in the INI file (for Finish/Welcome page it's $PLUGINSDIR\ioSpecial.ini), where HWND is the first control and HWND2 being the second (such as the button for a FileRequest or DirRequest field).

Stu


Thanks, that takes a lot of the mystery out of it.


hmm
this is my code.it seems the same with what is written above and still no change:
http://forums.winamp.com/showthread....35#post2312235

Function SetControlColours
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\iospecial.ini"

GetDlgItem $0 $MUI_HWND 1203 # 1200 + field # - 1
SetCtlColors $0 0xFF0000 0x000000
InstallOptions::show
FunctionEnd


You are going about it wrong. You just need !define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPageShow before !insertmacro MUI_PAGE_FINISH then put you code in the FinishPageShow function without any InstallOptions calls.

Stu


of course that i have put the !define MUI_PAGE_CUSTOMFUNCTION_SHOW before the finish macro
i have 2 things:
;------------------------------
; Finish Page
;------------------------------
!define MUI_PAGE_CUSTOMFUNCTION_PRE CreateControls
!define MUI_PAGE_CUSTOMFUNCTION_SHOW SetControlColours

;--------------------------------

the createcontrols puts the labels on the finish page and the setcontrol colors is supposed to set the background of those labels.

Function SetControlColours
GetDlgItem $0 $MUI_HWND 1203 # 1200 + field # - 1
SetCtlColors $0 0xFF0000 0x000000
FunctionEnd

but nothing..same gray background.


Please attach your script.

Stu


it has some programs to install..from a "support" file that is in the java project.
look at lines: 71-> and 853->


You have your two _PRE and _SHOW defines before !insertmacro MUI_PAGE_INSTFILES. That means you're setting those two functions as pre and show functions for the install files page and not the finish page.

Stu


Thank you! :)