Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove listbox items one by one
#2
The problem is because of the wait command in your dialog procedure
The dialog doesn't process messages while waiting.
You could use opt waitmsg 1 but better to move whole code to a sub function and run in a separate thread like so.
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 296 148 "Dialog" "4"
;3 ListBox 0x54230101 0x200 0 0 296 114 ""
;4 Button 0x54032000 0x0 5 119 48 14 "START"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "3"
str lb3=
;a
;b
;c
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 4
,int hlb=id(3 hDlg)
,mac "sub.remove_item" "" hlb
,case IDOK
,case IDCANCEL
ret 1

#sub remove_item
function cid
int amount i
amount=LB_GetCount(cid)
for(i amount-1 -1 -1)
,SendMessage(cid LB_DELETESTRING i 0)
,out i
,0.4


Messages In This Thread
Remove listbox items one by one - by r0n - 05-12-2021, 10:23 AM
RE: Remove listbox items one by one - by Kevin - 05-12-2021, 03:49 PM
RE: Remove listbox items one by one - by r0n - 05-12-2021, 04:55 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)