Archive: Help with combobox


Help with combobox
hello,

lately i started learning how to work with nsis..

so far, i pretty much managed to get the script to do what i want, but now i havw a lil problem:

i put combobox in a page, but i can't read the selected text

the closest thing i got was the selected index... but that's it.

i want to know what's the text currently selected/inputed by the user.

i tried every "sendmessage" combination (through system::..." too). but no luck

can someone help me?
(the hwnd of the cb is $COMBOBOX, and i want to print the selected text inside a MessagBox)

thanks in advance


Does WM_GETTEXT not work?

Stu


can you please send me the function?

i tried:

System::Call user32::SendMessage $COMBOBOX,i${CB_GETLBTEXT},i r2, i r3) i.r4

and:

System::Call user32::SendMessage($COMBOBOX,i${WM_GETTEXT},i r2, t.$0)


GetWindowText is pretty much the same:
System::Call `user32::GetWindowText(i $COMBOBOX, t .R0, i ${NSIS_MAX_STRLEN})`

Stu


Originally posted by Afrow UK
System::Call `user32::GetWindowText(i $COMBOBOX, t .R0, i ${NSIS_MAX_STRLEN})`
The above works for me, but the NSD_LB_GetSelection macro in nsDialogs.nsh does not. The macro contains:
        SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR}
System::Call 'user32::SendMessage(i ${CONTROL}, i ${LB_GETTEXT}, i ${VAR}, t .s)'
Pop ${VAR}

The sendmessage command always returns index 0 for my combobox control. Am I doing something wrong, or is this a bug in the macro?

Edit: doh, above macro is for listbox, not combobox. ~_~ Should use CB_GETCURSEL instead of LB_GETCURSEL. (And CB_GETLBTEXT instead of LB_GETTEXT.)