Add columns to ExplorerListGadget?

Just starting out? Need help? Post your questions and find answers here.
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Add columns to ExplorerListGadget?

Post by ozzie »

Is there a way to add columns other than the standard #PB _Explorer_... columns to an ExplorerListGadget (Windows only)? Specifically I want to add the 'Length' for audio files. 'Title' would also be useful.
firace
Addict
Addict
Posts: 902
Joined: Wed Nov 09, 2011 8:58 am

Re: Add columns to ExplorerListGadget?

Post by firace »

I know this topic is old, but I have the exact same question... :)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4661
Joined: Sun Apr 12, 2009 6:27 am

Re: Add columns to ExplorerListGadget?

Post by RASHAD »

Hi ozzie
Hi firace

Code: Select all

Procedure AddColumn(gad,index)
  col.LVCOLUMN 
  col\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT 
  col\fmt = #LVCFMT_CENTER
  col\cx = 110 
  col\pszText = @"ozzie"
  SendMessage_(GadgetID(gad), #LVM_INSERTCOLUMN, index, @col)
EndProcedure

Procedure DeleteColumn(gad,index)
  SendMessage_(GadgetID(gad), #LVM_DELETECOLUMN, index, 0)
EndProcedure
  
  
If OpenWindow(0, 0, 0, 400, 200, "ExplorerListGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerListGadget(0, 10, 10, 380, 180, "*.*", #PB_Explorer_MultiSelect)
  Header = SendMessage_(GadgetID(0), #LVM_GETHEADER, 0, 0)
  ColCount = SendMessage_(Header,  #HDM_GETITEMCOUNT, 0, 0)
  
  AddColumn(0,ColCount)
  DeleteColumn(0,3) 
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Egypt my love
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: Add columns to ExplorerListGadget?

Post by ozzie »

Many thanks, RASHAD. You're a master of Windows functions like SendMessage_()!
Post Reply