Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Dialog] Change values in list
#1
Hi !

For my current project i would like to know how it's possible, using Dialog, to update values in a List.

For example, in this simple dialog :
Macro Macro2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 ListBox 0x54230101 0x200 8 12 96 102 ""
;4 Button 0x54032000 0x0 136 44 48 40 "Change values in list"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str lb3
lb3="Choice1[]Choice2[]Choice3"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 ;;Change values in list
,,str newvalues="Choice4[]Choice5[]Choice6"
,,newvalues.setwintext(id(3 hDlg))
ret 1

I would like, when you press the button, to replace the default values in the list by the new ones (Choice4, Choice5, Choice 6)

Since now i always used .setwintext for update button text, static text, edit boxes... but i can't find a way to make this work with lists

Thanks in advance !
#2
Macro Macro2 
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 ListBox 0x54230101 0x200 8 12 96 102 ""
;4 Button 0x54032000 0x0 136 44 48 40 "Change values in list"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str lb3
lb3="Choice1[]Choice2[]Choice3"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 ;;Change values in list
,str newvalues="Choice4[]Choice5[]Choice6"
,int hlb=id(3 hDlg)
,SendMessage hlb LB_RESETCONTENT 0 0
,foreach(_s newvalues)
,,LB_Add hlb _s
ret 1
#3
It works, thank for the fast reply Big Grin
#4
DT_SetControl hDlg 3 newvalues


Forum Jump:


Users browsing this thread: 1 Guest(s)