It is currently Fri Dec 04, 2020 8:24 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Send commands to ExplorerListGadget? (go back. limit path)
PostPosted: Fri Feb 08, 2019 3:13 am 
Offline
Addict
Addict
User avatar

Joined: Sun Mar 07, 2004 8:47 am
Posts: 1861
Location: Argentina
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!)


Top
 Profile  
Reply with quote  
 Post subject: Re: Send commands to ExplorerListGadget? (go back. limit pat
PostPosted: Thu Apr 18, 2019 12:52 pm 
Offline
Moderator
Moderator

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1113
Location: Gernsbach (Germany)
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:
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:
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

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 70 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye