[SOLVED] Cannot select explorer item

Just starting out? Need help? Post your questions and find answers here.
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Cannot select explorer item

Post by Shardik »

Danilo wrote:Undocumented, but seems to work (on Windows):
That's right, it's only documented for the ListViewGadget but it seems indeed to work cross-platform for the ExplorerListGadget. The following example code was successfully tested on
- MacOS X 10.6.8 (Snow Leopard)
- Ubuntu 14.04 x64 with KDE
- Windows 7 x64 SP1

Code: Select all

OpenWindow(0, 100, 100, 420, 310, "Test")
ButtonGadget(0, 150, 280, 120, 25, "Unselect row 1")
ExplorerListGadget(1, 10, 10, 400, 260, "/",
  #PB_Explorer_FullRowSelect | #PB_Explorer_MultiSelect)
SetGadgetItemState(1, 1, #PB_Explorer_Selected)
SetActiveGadget(1)

Repeat
   Select WaitWindowEvent()
     Case #PB_Event_CloseWindow
       Break
     Case #PB_Event_Gadget
       If EventGadget() = 0
         SetGadgetItemState(1, 1, 0)
       EndIf
   EndSelect
ForEver
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

Re: Cannot select explorer item

Post by SkyManager »

Thanks for the answer

My little experiment is as follow :

Code: Select all

state = GetGadgetItemState(#DirExplorer, k)
    If state & #PB_Explorer_File 
       SetGadgetItemState(#DirExplorer, k, #PB_Explorer_File)
    ElseIf state & #PB_Explorer_Directory
       SetGadgetItemState(#DirExplorer, k, #PB_Explorer_Directory)
    EndIf
That seems to work also
Post Reply