Archive: Event click on a listbox


Event click on a listbox
Is it possible to manage the event click on a listbox? How?

Thanks to all.


see InstallOptions README as well...

activate NOTIFY flag for your Listbox. When Listbox items is clicked, STATE field of Settings section contains the field number of the clicked item.

Example:

Your listbox item is defined in Section [Field 5].

!insertmacro MUI_INSTALLOPTIONS_READ $0 "custompage.ini" "Settings" "State"

StrCmp $0 5 dolistbox ; listbox was clicked

dolistbox:
!insertmacro MUI_INSTALLOPTIONS_READ $0 "custompage.ini" "Field 5" "State"

In $0 you have the return value. If more than one items were selected, they are separated by "|".

This stuff is very well documented. Now you know where you can read on...


Event notify in listbox
I did read Install Options 2 Readme file; but it did not answer my question. Here is a scenario. On my custom page, I have a list box prepopulated with a bunch of items and then an edit box. When a user selects an item in a listbox I want to update the contents of the edit box accordingly. How do I do that?
Another question: How do I pass the selections from page to page? E.g. on Page 1, a particular option was selected. How do I show that option selected on the next page? Do I alter the .ini file of the next page before it is displayed?
Thanks.


use those functions - excerpt from my pwd dialog

change dialog items after events and enable next button - use this code in leave function

;set asterisks in my password field [Field 1]
GetDlgItem $DLGITEM $HWND 1200 ; compute 1200 + [Field number] - 1
SendMessage $DLGITEM ${WM_SETTEXT} 0 "STR:********"

;enable next button
GetDlgItem $R9 $HWNDPARENT 1
EnableWindow $R9 1

---

there is another approach for SHOW function - this is an example to modify the MUI_PAGE_DIRECTORY page. To modify those you need the "Resource Hacker" Tool to get to know the IDs of the dialog items.

;exactly the example from user manual - 4.9.14.6
FindWindow $R1 "#32770" "" $HWNDPARENT

GetDlgItem $R0 $R1 1006
SendMessage $R0 ${WM_SETTEXT} 0 "STR:$R3" ;
EnableWindow $R0 1

Just read the documentation of the functions I used and you will be successful.

2nd question:

Use variables to save values from dialogs read with
!insertmacro MUI_INSTALLOPTIONS_READ

Use show function of next dialog to write this value into .ini file with !insertmacro MUI_INSTALLOPTIONS_WRITE


Use !insertmacro MUI_INSTALLOPTIONS_DISPLAY
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG
!insertmacro MUI_INSTALLOPTIONS_SHOW

to show the dialog. But the usage depends on the situation. Good luck and keep on reading. You try some advanced stuff with NSIS.