Send commands to ExplorerListGadget? (go back. limit path)

Just starting out? Need help? Post your questions and find answers here.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Send commands to ExplorerListGadget? (go back. limit path)

Post by dagcrack »

Hi guys,

Is there a known way to send a "go back" message to an ExplorerListGadget?.
Namely I'm using #PB_Explorer_NoParentFolder so the user can't navigate outside of the program data path / directory. Thus I need a way to navigate the current path via buttons.

Is the ExplorerListGadget a PB implementation or is it OS native?
In case it matters this is a Windows-only application.

Worst case scenario, is there a simple way to limit the path so I can stop using #PB_Explorer_NoParentFolder but make it so I can't get past a certain path? (the program's path in this case).

I'm using the gadget as a simple way to organize program data using the actual file system. Just trying to avoid writing a gadget from scratch if I can.

Thanks,
Gus
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Send commands to ExplorerListGadget? (go back. limit pat

Post by RSBasic »

dagcrack wrote:Is there a known way to send a "go back" message to an ExplorerListGadget?.
Namely I'm using #PB_Explorer_NoParentFolder so the user can't navigate outside of the program data path / directory. Thus I need a way to navigate the current path via buttons.

Code: Select all

EnableExplicit

Define CurrentPath$

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerListGadget(1, 0, 20, 500, 380, "C:\Windows\", #PB_Explorer_NoParentFolder)
  ButtonGadget(2, 0, 0, 100, 20, "Back", 0)
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 2
            CurrentPath$ = GetGadgetText(1)
            SetGadgetText(1, GetPathPart(Mid(CurrentPath$, 1, Len(CurrentPath$)-1)))
        EndSelect
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf
dagcrack wrote:Worst case scenario, is there a simple way to limit the path so I can stop using #PB_Explorer_NoParentFolder but make it so I can't get past a certain path? (the program's path in this case).

Code: Select all

EnableExplicit

Define RootPath$ = "C:\Windows\"

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerListGadget(1, 0, 0, 500, 400, RootPath$, 0)
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 1
            Select EventType()
              Case #PB_EventType_Change
                If Len(GetGadgetText(1)) < Len(RootPath$)
                  SetGadgetText(1, RootPath$)
                EndIf
            EndSelect
        EndSelect
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf
Image
Image
Post Reply