How can I unfold a TreeGadget?
Re: How can I unfold a TreeGadget?
Do you mean collapse them all at once?
			
			
									
									
						Code: Select all
Procedure OnExpandAll()
  Protected i
  For i = 0 To CountGadgetItems(0) - 1
    SetGadgetItemState(0, i, #PB_Tree_Expanded)
  Next
EndProcedure
Procedure OnCollapseAll()
  Protected i
  For i = 0 To CountGadgetItems(0) - 1
    SetGadgetItemState(0, i, #PB_Tree_Collapsed)
  Next
EndProcedure
If OpenWindow(0, 0, 0, 355, 180, "TreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TreeGadget(0, 10, 10, 160, 160)                                        
  For a = 0 To 10
    AddGadgetItem (ID, -1, "Normal Item "+Str(a), 0, 0) ; if you want to add an image, use
    AddGadgetItem (ID, -1, "Node "+Str(a), 0, 0)        ; ImageID(x) as 4th parameter
    AddGadgetItem(ID, -1, "Sub-Item 1", 0, 1)           ; These are on the 1st sublevel
    AddGadgetItem(ID, -1, "Sub-Item 2", 0, 1)
    AddGadgetItem(ID, -1, "Sub-Item 3", 0, 1)
    AddGadgetItem(ID, -1, "Sub-Item 4", 0, 1)
    AddGadgetItem (ID, -1, "File "+Str(a), 0, 0) ; sublevel 0 again
  Next
  ButtonGadget(1, 180, 10, 125, 25, "Expand All")
  ButtonGadget(2, 180, 40, 125, 25, "Collapse All")
  BindGadgetEvent(1, @OnExpandAll())
  BindGadgetEvent(2, @OnCollapseAll())
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIfRe: How can I unfold a TreeGadget?
Thanks!
This is ok for a few hundert items, but on 7000 items it takes 40 seconds to open them.
I hope there is a better way.
			
			
									
									This is ok for a few hundert items, but on 7000 items it takes 40 seconds to open them.
I hope there is a better way.
macOS Catalina 10.15.7
						Re: How can I unfold a TreeGadget?
Did you try HideGadget(0, #True) and HideGadget(0, #False)? 
Or was it DisableGadget()? Try it.
For Windows only:
and
			
			
									
									Or was it DisableGadget()? Try it.
For Windows only:
Code: Select all
Procedure OnExpandAll()
  Protected i
  SendMessage_(GadgetID(0),#WM_SETREDRAW,#False,0)
  For i = 0 To CountGadgetItems(0) - 1
    SetGadgetItemState(0, i, #PB_Tree_Expanded)
  Next
  SendMessage_(GadgetID(0),#WM_SETREDRAW,#True,0)
EndProcedureCode: Select all
Procedure OnCollapseAll()
  Protected i
 SendMessage_(GadgetID(0),#WM_SETREDRAW,#False,0)
  For i = 0 To CountGadgetItems(0) - 1
    SetGadgetItemState(0, i, #PB_Tree_Collapsed)
  Next
  SendMessage_(GadgetID(0),#WM_SETREDRAW,#True,0)
EndProcedure
Re: How can I unfold a TreeGadget?
No, it does not help.
If I use a shortcut (option + arrowRight) it opens in a second.
			
			
									
									If I use a shortcut (option + arrowRight) it opens in a second.
macOS Catalina 10.15.7
						Re: How can I unfold a TreeGadget?
viewtopic.php?p=576903#p576903
You can also use the asterisk (*) on the numeric keypad, this is a native way to expand the entire tree (it definitely works on Win10).
			
			
									
									
						You can also use the asterisk (*) on the numeric keypad, this is a native way to expand the entire tree (it definitely works on Win10).
Re: How can I unfold a TreeGadget?
Here is what I was looking for...
			
			
									
									Code: Select all
CocoaMessage(0, GadgetID(tree), "expandItem:", #nil,  "expandChildren:", #YES)macOS Catalina 10.15.7
						Re: How can I unfold a TreeGadget?
Wolfram
I'm sorry, I didn't even pay attention to the Mac OSX section.
			
			
									
									
						I'm sorry, I didn't even pay attention to the Mac OSX section.
Re: How can I unfold a TreeGadget?
You know that it hurts my feelings (like pineapple pizza) but I forgive you



