Page 1 of 1

Wrong item number in treegadget

Posted: Wed Aug 27, 2025 10:43 pm
by erlend
I guess this must be a bug as this code behaves very different on PB and SB:

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
      For a = 0 To 10
        AddGadgetItem(0, -1, "Normal Item "+Str(a), 0, 0) ; if you want to add an image, use
      Next
      For a = 0 To 10
        AddGadgetItem(0, 3, "Sub Item "+Str(a), 0, 1) ; if you want to add an image, use
      Next
EndIf
  
Procedure debugevent()
  Debug GetGadgetState(0)  
EndProcedure
  
BindEvent(#PB_Event_Gadget,@debugevent())

CompilerIf #PB_Compiler_OS <> #PB_OS_Web
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
CompilerEndIf
I assume when you click through the tree items should be from 0 and upwards?

BR
Erlend