I have searched high and low and I can not figure out how to have the TreeGadget default to expanded. I have seen many references in this forum to what must be a old, and now non existent method of expanding the tree.
The suggestion in the user manual says to set the SetGadgetItemState with #PB_Tree_Expanded, well it is not working for me in a manner that is understandable or predictable. I am testing on WIN7. Any suggestions would be appreciated.
Thanks
Expand TreeGadget
Re: Expand TreeGadget
Hi BillyBob, ...BillyBob wrote:The suggestion in the user manual says to set the SetGadgetItemState with #PB_Tree_Expanded, well it is not working for me in a manner that is understandable or predictable. I am testing on WIN7. Any suggestions would be appreciated.
as you can see in the follwing code, #PB_Tree_Expanded works fine, like it should.
Code: Select all
If OpenWindow(0, 0, 0, 355, 180, "TreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TreeGadget(0, 10, 10, 160, 160) ; TreeGadget Standard
TreeGadget(1, 180, 10, 160, 160, #PB_Tree_CheckBoxes|#PB_Tree_NoLines) ; TreeGadget mit Checkboxen + ohne Linien
For ID = 0 To 1
For a = 0 To 10
AddGadgetItem (ID, -1, "Normal Item "+Str(a), 0, 0) ; wenn Sie ein Bild hinzufügen möchten, dann
AddGadgetItem (ID, -1, "Node "+Str(a), 0, 0) ; benutzen Sie ImageID(x) als 4. Parameter
AddGadgetItem(ID, -1, "Sub-Item 1", 0, 1) ; diese sind auf dem ersten 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) ; hier wieder Sublevel 0
Next
Next
SetGadgetItemState(0, 1, #PB_Tree_Expanded)
SetGadgetItemState(1, 8, #PB_Tree_Expanded)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
PL.
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
Re: Expand TreeGadget
I guess placement on of the SetGadgetItemState must be critical as I had originally placed this function after each AddGadgetItem and it did not work for me. However, when I arranged the order like you have suggested, all is working well.
THANK YOU VERY MUCH from Canada!
THANK YOU VERY MUCH from Canada!
Re: Expand TreeGadget
You are welcome.BillyBob wrote:THANK YOU VERY MUCH from Canada!

[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
Re: Expand TreeGadget
Setting the #PB_Tree_Expanded state works well when you do it immediately after adding the first item on the sub-level:BillyBob wrote:I guess placement on of the SetGadgetItemState must be critical as I had originally placed this function after each AddGadgetItem and it did not work for me.
SetGadgetItemState(#tree, item_number-1, #PB_Tree_Expanded)
Of course, this requires controlling the item_number.
Horst.
Re: Expand TreeGadget
Hello,
just dropped in to hint at Shardiks remarkable code of how to expand subitems onto a prescribed level: TreeGadget ganz entfalten ...
edit: removed additional remark as is was very Linux specific, as the pointed effects don't arise on Windows the same way.
greetings ~ Vera
just dropped in to hint at Shardiks remarkable code of how to expand subitems onto a prescribed level: TreeGadget ganz entfalten ...
edit: removed additional remark as is was very Linux specific, as the pointed effects don't arise on Windows the same way.
greetings ~ Vera
Two growing code-collections: WinApi-Lib by RSBasic ~ LinuxAPI-Lib by Omi
Missing a download-file on the forums? ~ check out this backup page.
Missing a download-file on the forums? ~ check out this backup page.