Page 1 of 1

Other virtual folders for ExplorerTreeGadget()

Posted: Thu Mar 23, 2017 10:39 am
by Marc56us
Hi PB Team,

:idea: It would be nice to have for ExplorerTreeGadget(), not only #PB_Directory_Documents, but also the other virtual folders (if possible ?)

#PB_Directory_Desktop
#PB_Directory_Downloads
#PB_Directory_Pictures
#PB_Directory_Musics
#PB_Directory_Videos
#PB_Directory_Public

:arrow: So flag to disable it, like: _NoMyDocuments
#PB_Explorer_NoMyDocuments : The 'My Documents' Folder will not be displayed as a separate item.

Thank's
:wink:

Re: Other virtual folders for ExplorerTreeGadget()

Posted: Thu Apr 27, 2017 7:12 pm
by RSBasic
I don't know if this wish function will be implemented, otherwise with own code?
Example:

Code: Select all

EnableExplicit

Procedure AddTreeGadgetSpecialItem(Gadget, ItemText$, Image)
  Protected TV_INSERTSTRUCT.TV_INSERTSTRUCT
  Protected ImageList
  Protected ItemIcon
  
  ImageList = SendMessage_(GadgetID(Gadget), #TVM_GETIMAGELIST, #TVSIL_NORMAL, 0)
  ItemIcon = ImageList_AddIcon_(ImageList, Image)
  
  TV_INSERTSTRUCT\hParent = 0
  TV_INSERTSTRUCT\hInsertAfter = #TVI_FIRST
  TV_INSERTSTRUCT\Item\Mask = #TVIF_TEXT | #TVIF_IMAGE | #TVIF_SELECTEDIMAGE
  TV_INSERTSTRUCT\Item\pszText = @ItemText$
  TV_INSERTSTRUCT\Item\cchTextMax = Len(ItemText$)
  TV_INSERTSTRUCT\item\iImage = ItemIcon
  TV_INSERTSTRUCT\item\iSelectedImage = ItemIcon
  
  SendMessage_(GadgetID(Gadget), #TVM_INSERTITEM, 0, TV_INSERTSTRUCT)
  
  ImageList_Destroy_(ImageList)
  
EndProcedure

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerTreeGadget(1, 0, 0, WindowWidth(0), WindowHeight(0), "", 0)
  
  AddTreeGadgetSpecialItem(1, "Desktop", ExtractIcon_(GetModuleHandle_(0), "imageres.dll", 125))
  AddTreeGadgetSpecialItem(1, "Downloads", ExtractIcon_(GetModuleHandle_(0), "imageres.dll", 175))
  AddTreeGadgetSpecialItem(1, "Pictures", ExtractIcon_(GetModuleHandle_(0), "imageres.dll", 108))
  AddTreeGadgetSpecialItem(1, "Musics", ExtractIcon_(GetModuleHandle_(0), "imageres.dll", 103))
  AddTreeGadgetSpecialItem(1, "Videos", ExtractIcon_(GetModuleHandle_(0), "imageres.dll", 178))
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf
(Only Windows and my example code is incomplete.)

Re: Other virtual folders for ExplorerTreeGadget()

Posted: Mon May 01, 2017 8:06 pm
by Kwai chang caine
and my example code is incomplete
Yes but it works, thanks for sharing 8)