ExplorerTreeGadget Refresh Listing Question

Just starting out? Need help? Post your questions and find answers here.
tss
New User
New User
Posts: 4
Joined: Sat Feb 19, 2005 12:23 pm

ExplorerTreeGadget Refresh Listing Question

Post by tss »

Hi,

Is there a way to force the ExplorerTreeGadget to refresh to display an updated file listing?

I've got a program which allows the user to select a file, then it creates a backup of the file in the same directory. Can the explorertreegadget be forced to refresh so that the new file can be seen?

Thanks in advance.
Paul
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Post by Shardik »

Simply do a SetGadgetText(GadgetID, GetGadgetText(GadgetID) + "*.*") to refresh the ExplorerTreeGadget as in the example below:

Code: Select all

OpenWindow(1, 0, 0, 290, 370, "ExplorerTreeGadget Refresh", #PB_Window_ScreenCentered | #PB_Window_SystemMenu) 

CreateGadgetList(WindowID(1)) 
ExplorerTreeGadget(1, 10, 10, 270, 300, "C:\") 
ButtonGadget(2, 45, 320, 200, 40, "Create backup of Boot.ini and refresh ExplorerTree", #PB_Button_MultiLine | #PB_Button_Default) 

Repeat 
  WindowEventID = WaitWindowEvent() 

  If WindowEventID = #PB_Event_Gadget And EventGadget() = 2 
    If CopyFile("C:\Boot.Ini", "C:\Boot.Bak") = #False
      MessageRequester("Error", "File copy of Boot.Ini to Boot.Bak failed!")
      End
    EndIf

    SetGadgetText(1, GetGadgetText(1) + "*.*") 
    DisableGadget(2, #True) 
  EndIf 
Until WindowEventID = #PB_Event_CloseWindow
tss
New User
New User
Posts: 4
Joined: Sat Feb 19, 2005 12:23 pm

Post by tss »

Thanks. That forces a refresh, although it is limiting the files to be only those that match the SetText+"*.*" criteria.

But changing it to do a SetGadgetText(#GadgetID, "*.*"), it is refreshing the listing, although it is changing back to the original directory location.

But it is a workable solution.

Thanks.
Post Reply