Page 1 of 1

Re: Cannot select explorer item

Posted: Tue Mar 31, 2015 10:34 am
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

Re: Cannot select explorer item

Posted: Tue Mar 31, 2015 11:49 am
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