Lionheart008
08-09-2008, 13:20
dear thinbasic friends:-)
good morning and I am fit again;-) the cold is flying away to the south of germany :-D
I have found the "listbox" example (scriptexamples/UI) and have the little problem, that I would like to clear the listbox items (what listed items these are?) with a) a separetely button... b) or this button should make another thing...
c) but first of all... how does the list view function?
=> d) how can I clear (Clear Items, clear String...) the selected entry of the listbox?
e) I can type in words and make the "set" button, then in the listbox I can see my entry, very nice:-)
'---Now test the message
SELECT CASE Msg
case %WM_INITDIALOG '---Message fired at the very beginning when dialog is initialized
'---This can be the right place to initialize dialog or create controls
CONTROL ADD listbox , hDlg, %List01 , vList() , 5, 20, 200, 100, 0, 0
CONTROL ADD listbox , hDlg, %List02 , vList() , 5, 20, 300, 150, 0, 0
CONTROL ADD textbox , hDlg, %Text01 , "" , 5, 5, 200, 12
CONTROL ADD textbox , hDlg, %Text02 , "add here something stupid" , 5, 5, 200, 12
control add button , hDlg, %Butt01 , "Set" , 210, 5, 30, 12
control add button , hDlg, %Butt02 , "clear" , 250, 5, 40, 14
CASE %WM_COMMAND
- Clear the item listbox, but how??? I have done nothing else than "copy" the first function of the button 01 ;-)))
case %Butt02
'---Get the text from a textbox and place into a string
control get text hdlg, %Text02 to tmpStr
'---Get the window unique ID of the control
CONTROL HANDLE hDlg, %List02 TO ID_List01
'---Get the number of items present into listbox
MaxItems = sendmessage(ID_List02, %LB_GETCOUNT, 0, 0)
'---Get current selected item (remember it start at zero position)
'CurItem = sendmessage(ID_List01, %LB_GETCURSEL, 0, 0) + 1
listbox get selected hDlg, %List02 to CurItem
'---Now delete selected item ...
sendmessage(ID_List02, %LB_DELETESTRING, CurItem - 1, 0)
'---...and insert new text in same position
sendmessage(ID_List02, %LB_INSERTSTRING, CurItem - 1, strptr(tmpStr))
end select
CASE %WM_SYSCOMMAND
SELECT CASE wParam
CASE %SC_CLOSE
CASE %SC_CLEAR
EXIT WHILE
END SELECT
first part of questions here done... want to understand how the listbox run...
best regards, lionheart after stressy dog walking ;-)
good morning and I am fit again;-) the cold is flying away to the south of germany :-D
I have found the "listbox" example (scriptexamples/UI) and have the little problem, that I would like to clear the listbox items (what listed items these are?) with a) a separetely button... b) or this button should make another thing...
c) but first of all... how does the list view function?
=> d) how can I clear (Clear Items, clear String...) the selected entry of the listbox?
e) I can type in words and make the "set" button, then in the listbox I can see my entry, very nice:-)
'---Now test the message
SELECT CASE Msg
case %WM_INITDIALOG '---Message fired at the very beginning when dialog is initialized
'---This can be the right place to initialize dialog or create controls
CONTROL ADD listbox , hDlg, %List01 , vList() , 5, 20, 200, 100, 0, 0
CONTROL ADD listbox , hDlg, %List02 , vList() , 5, 20, 300, 150, 0, 0
CONTROL ADD textbox , hDlg, %Text01 , "" , 5, 5, 200, 12
CONTROL ADD textbox , hDlg, %Text02 , "add here something stupid" , 5, 5, 200, 12
control add button , hDlg, %Butt01 , "Set" , 210, 5, 30, 12
control add button , hDlg, %Butt02 , "clear" , 250, 5, 40, 14
CASE %WM_COMMAND
- Clear the item listbox, but how??? I have done nothing else than "copy" the first function of the button 01 ;-)))
case %Butt02
'---Get the text from a textbox and place into a string
control get text hdlg, %Text02 to tmpStr
'---Get the window unique ID of the control
CONTROL HANDLE hDlg, %List02 TO ID_List01
'---Get the number of items present into listbox
MaxItems = sendmessage(ID_List02, %LB_GETCOUNT, 0, 0)
'---Get current selected item (remember it start at zero position)
'CurItem = sendmessage(ID_List01, %LB_GETCURSEL, 0, 0) + 1
listbox get selected hDlg, %List02 to CurItem
'---Now delete selected item ...
sendmessage(ID_List02, %LB_DELETESTRING, CurItem - 1, 0)
'---...and insert new text in same position
sendmessage(ID_List02, %LB_INSERTSTRING, CurItem - 1, strptr(tmpStr))
end select
CASE %WM_SYSCOMMAND
SELECT CASE wParam
CASE %SC_CLOSE
CASE %SC_CLEAR
EXIT WHILE
END SELECT
first part of questions here done... want to understand how the listbox run...
best regards, lionheart after stressy dog walking ;-)