04-28-2019, 12:13 AM
try this no enter required
Function Dialog10a
Function Dialog10a
str- sItems="one[]two[]three"
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 48 8 96 12 ""
;4 ListBox 0x54230101 0x200 48 24 96 48 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""
str controls = "3 4"
str e3 lb4
lb4=sItems
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb4=id(4 hDlg)
,,SendMessage hlb4 LB_RESETCONTENT 0 0
,,str s3 sEdit3.getwintext(id(3 hDlg))
,,foreach s3 sItems
,,,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,,,LB_Add hlb4 s3
,,int count=LB_GetCount(hlb4)
,,if count=1
,,,LB_SelectItem(hlb4 0)
,,,SendMessage hDlg WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(hlb4) hlb4
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case LBN_DBLCLK<<16|4
,str lb4text
,_i=LB_SelectedItem(lParam lb4text)
,mes F"Selected listem number: {_i} Text: {lb4text}"
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 10 0
,
ret 1