- NSIS Discussion
 - Change Background Color of Text Box on Custom Page
 
Archive: Change Background Color of Text Box on Custom Page
Jnuw
16th September 2005 23:21 UTC
Change Background Color of Text Box on Custom Page
Hello all.
I have scoured the forums, and help files, and tried to decipher the IoColors.zip example, but am still confused. Basically what I have is a custom page (ResultsPage) that contains a text box (Type=Text in the ResultsPage.ini). I have the text box set with: Flags=MULTILINE|VSCROLL|READONLY, as I'm using it to display a large amount of text. I want to keep in READONLY but don't like the gray background it produces.
So... I just need a hand setting the background of this custom control (Type=Text) back to white as if it was not READONLY. Below is the code for the display of the ResultsPage, and the corresponding INI. Can someone please show me the commands I need? Thanks so much all!
Jnuw
Function SetFinishPage
  ;Next 4 lines removes next and back buttons
  GetDlgItem $0 $HWNDPARENT 3
  ShowWindow $0 0
  GetDlgItem $0 $HWNDPARENT 1
  ShowWindow $0 0
  
  StrCmp $NumMissing 0 0 +2
  !insertmacro MUI_INSTALLOPTIONS_WRITE "ResultsPage.ini" "Field 5" "Flags" "DISABLED"
  !insertmacro MUI_INSTALLOPTIONS_WRITE "ResultsPage.ini" "Field 2" "State" "$Output"
  !insertmacro MUI_INSTALLOPTIONS_WRITE "ResultsPage.ini" "Settings" "Title" "${PRODUCT_NAME}"
  !insertmacro MUI_HEADER_TEXT "Results" "Please review the results below."
  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ResultsPage.ini"
FunctionEnd
      
      ResultsPage.ini
      
[Settings]
NumFields=5
Title=
CancelShow=1
CancelButtonText=Exit
[Field 1]
Type=GroupBox
Left=0
Right=-1
Top=0
Bottom=-1
Text=""
[Field 2]
Type=Text
Left=10
Right=-10
Top=10
Bottom=120
State="Error..."
Flags=MULTILINE|VSCROLL|READONLY
[Field 3]
Type=Link
Left=10
Right=139
Top=126
Bottom=136
State=http://www.blabla.com/
Text=Click to open Website.
[Field 4]
Type=Button
Flags=NOTIFY
Text=&Print Results
Left=240
Right=-10
Top=123         
Bottom=137
[Field 5]
Type=Button
Flags=NOTIFY
Text=&Download Missing Updates
Left=140
Right=235
Top=123         
Bottom=137
     
    
    
      Afrow UK
      17th September 2005 10:15 UTC
      !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ResultsPage.ini"
      Pop $R0 # HWND
      GetDlgItem $R1 $R0 1201 ; 1200 + Field # - 1
      SetCtlColors $R1 000000 FFFFFF
      !insertmacro MUI_INSTALLOPTIONS_SHOW
      
      Instead of MUI_INSTALLOPTIONS_DISPLAY
      
      -Stu
     
    
    
      Jnuw
      18th September 2005 15:17 UTC
      Thanks again Stu, that did the trick perfectly. I really appreciate your help!
     
    
    
      Takeshi
      22nd January 2007 09:06 UTC
      
      
        Originally posted by Afrow UK
        !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ResultsPage.ini"
        Pop $R0 # HWND
        GetDlgItem $R1 $R0 1201 ; 1200 + Field # - 1
        SetCtlColors $R1 000000 FFFFFF
        !insertmacro MUI_INSTALLOPTIONS_SHOW
        
        Instead of MUI_INSTALLOPTIONS_DISPLAY
        
        -Stu
      
hello guys
      i have tried using this code for my custom pages
      to change the color of the text box to white color, but what happened is like the one u can see in the attachment.
      anyone have idea, how to modify my code, so that only the text box background color is changed, and i dont want that grey background color (the one in the red square)
      this is my .ini code
      
      [Settings]
      NumFields=5
      
      [Field 1]
      Type=Label
      Text=Please enter your name and the name of the company for which you work.
      Left=0
      Right=262
      Top=0
      Bottom=8
      
      [Field 2]
      Type=Label
      Text=User Name:
      Left=0
      Right=269
      Top=25
      Bottom=34
      
      [Field 3]
      Type=Text
      Left=0
      Right=272
      Top=37
      Bottom=51
      
      [Field 4]
      Type=Label
      Text=Company Name
      Left=0
      Right=273
      Top=64
      Bottom=72
      
      [Field 5]
      Type=Text
      Left=0
      Right=275
      Top=74
      Bottom=88
      
      and this the coding in the function
      
      Function Create_Pg_UserInfo
      
      !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "userinfo.ini"
      
      ${if} $OLD == "$(^Name)"
      Abort
      ${endif}
      
      ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "RegisteredOwner"
      !insertmacro MUI_INSTALLOPTIONS_WRITE "userinfo.ini" "Field 3" "State" "$0"
      
      ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "RegisteredOrganization"
      !insertmacro MUI_INSTALLOPTIONS_WRITE "userinfo.ini" "Field 5" "State" "$0"
      
      Pop $R0 # HWND
      GetDlgItem $R1 $R0 1202 ; 1200 + Field # - 1
      SetCtlColors $R1 "000000" "FFFFFF"
      
      !insertmacro MUI_HEADER_TEXT "Customer Information" "Please enter your information"
      !insertmacro MUI_INSTALLOPTIONS_DISPLAY "userinfo.ini"
      !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
      FunctionEnd
      
      thank you guys for always helping me
    
 
    
    
      Red Wine
      22nd January 2007 10:05 UTC
      Now InstallOptions writes the HWND of every control to ini, so,
      Instead of GetDlgItem $R1 $R0 1202 ; 1200 + Field # - 1
      Use
      
 ReadINIStr "$R1" "$PLUGINSDIR\userinfo.ini" "field 3" "HWND"
SetCtlColors "$R1" "000000" "FFFFFF"
     
    
    
      Takeshi
      22nd January 2007 10:24 UTC
      Red Wine, do i need to include this:
      !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "userinfo.ini" ?
      i have tried using the code above,
      
      ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "RegisteredOwner"
      !insertmacro MUI_INSTALLOPTIONS_WRITE "userinfo.ini" "Field 3" "State" "$0"
      
      ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "RegisteredOrganization"
      !insertmacro MUI_INSTALLOPTIONS_WRITE "userinfo.ini" "Field 5" "State" "$0"
      ; !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "userinfo.ini"
      Pop $R0 # HWND
      ReadINIStr "$R1" "userinfo.ini" "field 3" "HWND"
      SetCtlColors "$R1" "000000" "FFFFFF"
      !insertmacro MUI_HEADER_TEXT "Customer Information" "Please enter your information"
      !insertmacro MUI_INSTALLOPTIONS_DISPLAY "userinfo.ini"
      !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
      
      without the initdialog, i cant get the result at all, the box doesnt turn to white background color, and if i use with the initdialog, the result is the same as the attachment..
      did i put the code at the wrong place?
     
    
    
      Red Wine
      22nd January 2007 11:37 UTC
      Yeah! you already discovered this!
      1st init the dialog, set ctl colors and then show the dialog.
      You certainly know how to do it :)
     
    
    
      Takeshi
      23rd January 2007 02:27 UTC
      I thought I had attached an attachment during my 1st post..but I didnt...
      Im sorry Red Wine, I still cannot solve my prob..
      please see the attachment
      i want to remove that grey background color
     
    
    
      Red Wine
      23rd January 2007 04:21 UTC
      
      
..............
..............
Push $1 
 InstallOptions::InitDialog /NOUNLOAD "$PLUGINSDIR\userinfo.ini"
 Pop $1
    FindWindow $1 "#32770" "" $HWNDPARENT
    SetCtlColors $1 '' '0x000000'
 InstallOptions::Show "$PLUGINSDIR\userinfo.ini"
 Pop $1
 
 Pop $1
 Pop $1
FunctionEnd
     
    
    
      Takeshi
      23rd January 2007 06:47 UTC
      Anyway, what is the different between :
      
      !insertmacro MUI_INSTALLOPTIONS_INITDIALOG
      &
      INSTALLOPTIONS::InitDialog
      
      and
      
      !insertmacro MUI_INSTALLOPTIONS_DISPLAY
      &
      !insertmacro MUI_INSTALLOPTIONS_SHOW
      &
      INSTALLOPTIONS::SHOW
     
    
    
      Red Wine
      23rd January 2007 06:55 UTC
      The MUI macro system is designed for your convenience
      
      !insertmacro MUI_INSTALLOPTIONS_INITDIALOG == INSTALLOPTIONS::InitDialog /NOUNLOAD
      
      !insertmacro MUI_INSTALLOPTIONS_SHOW ==
      INSTALLOPTIONS::SHOW
      
      !insertmacro MUI_INSTALLOPTIONS_DISPLAY ==
      INSTALLOPTIONS::DISPLAY
     
    
    
      Takeshi
      23rd January 2007 07:17 UTC
      ok Red Wine. thanx a lot for your help!