Archive: Keep the enabled/disabled state of a control when backing to a custom page


Keep the enabled/disabled state of a control when backing to a custom page
  Hi again,

I am using MUI2 and InstallOptions with .ini files for UI design. I want to Enable/Disable controls and I have tried two ways:

  1. Using INSTALLOPTIONS_WRITE InstallOption's macro I cant enable/diable the control (?):
    !insertmacro INSTALLOPTIONS_WRITE "MyCustomPage.ini" "Field 1" "Flags" "DISABLE" 
    
  2. Using EnableWindow I can enable/diable controls but the controls dont keep the state. I mean if I click Next button and then back to my custom dialog, the state of the control is the original state (enable or disabled as defined in the .ini file):

    
    macro  ENABLE_FIELD dialog field
    
    !insertmacro INSTALLOPTIONS_READ $0 "${dialog}" "${field}" "HWND"
    EnableWindow $0 1
    >!macroend
    >

Is there any way to achieve this? Am I using wrong the macro or/and EnableWindow?

Thank you,

J

Also write to the INI file. You should switch to nsDialogs really.

Stu


Thank you Afrow.

I have found the CreateDialogFromINI function that seems to be a nice way to switch to nsDialogs. I can reuse my .ini files now but I cant retreive the windows handles to assing callbacks for events (onClick for a button, for example). As soon as I call CreateDialogFromINI the code below this call is not executed until I leave (Back, Next...) the custom page. I dont find any examples or documentation useful to do this but I guess it is possible.

Any suggestions?

Thanks,

J


I wouldn't use CreateDialogFromINIFile. For one, as you noticed, it immediately creates the dialog - leaving you with no access to change things before it is displayed. But, more importantly, it means it has to parse the INI file, build the dialog from that, and then display it - meaning you lose all the advantages of nsDialogs -and- some of the features of InstallOptions.

So either switch entirely - or don't switch at all :)

If you need help moving your InstallOptions-based dialog over to nsDialogs, feel free to ask.

If you'd like to stick with InstallOptions for now, then - as Afrow implied - write the enabled/disable state as you did in Step 1. Then in the page's Show function, read that state in and enable/disable the control as applicable.


Thanks for your enlightment Animaether, I am moving to nsDialogs enterily. :up: