Questions about ExplorerListGadget
Posted: Fri Jul 01, 2005 3:20 pm
First, a bit of code as an example:
Question #1 - How can I eliminate the little icon from each line?
Question #2 - Is there any way to eliminate the filename extension?
Question #3 - When the checkbox is checked, how can I set the item to be selected similar to howworks for the ListIconGadget?
Question #4 - How can I put a checkmark in every check box?
Thanks for your help
Terry
Code: Select all
; Based on example by freak
#LVM_SETEXTENDEDLISTVIEWSTYLE = #LVM_FIRST + 54
#LVS_EX_CHECKBOXES = 4
#ExpListG = 0
#ButtonG1 = 1
If OpenWindow(0,0,0,400,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"File Selection") And CreateGadgetList(WindowID(0))
ButtonGadget(#ButtonG1, 180, 220, 80, 20, "Process")
; Set flags for the Explorer List
Flag = #PB_Explorer_MultiSelect|#PB_Explorer_NoParentFolder|#PB_Explorer_AutoSort|#PB_Explorer_NoFolders
ExplorerListGadget(#ExpListG, 10, 10, 380, 180, "\purebasic\examples\sources\*.PB", Flag)
; Change to List format
ChangeListIconGadgetDisplay(#ExpListG, 2)
; Remove unwanted columns
RemoveGadgetColumn(#ExpListG, 3)
RemoveGadgetColumn(#ExpListG, 2)
RemoveGadgetColumn(#ExpListG, 1)
; Enable Checkboxes in the ExplorerListGadget
SendMessage_(GadgetID(#ExpListG), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_CHECKBOXES, #LVS_EX_CHECKBOXES)
Repeat
Event = WaitWindowEvent()
If Event = #PB_EventGadget And EventGadgetID() = #ButtonG1
Count = SendMessage_(GadgetID(#ExpListG), #LVM_GETSELECTEDCOUNT, 0, 0)
; MessageRequester("Debug","The number of file selected: " + Str(count),0)
; Loop through all displayed items
For I = 0 To CountGadgetItems(#ExpListG) - 1
State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, I, #LVIS_STATEIMAGEMASK)
If State >> 12 > 1
; The checkbox is checked, do processing here
MessageRequester("Debug","Process this file: " + GetGadgetItemText(#ExpListG, I, 0),0)
; Uncheck the box
State = SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, I, #LVIS_STATEIMAGEMASK)
EndIf
Next I
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Question #2 - Is there any way to eliminate the filename extension?
Question #3 - When the checkbox is checked, how can I set the item to be selected similar to how
Code: Select all
SetGadgetItemState(gadget, item, #PB_ListIcon_Selected)
Question #4 - How can I put a checkmark in every check box?
Thanks for your help
Terry