Page 1 of 1

Some Panel enhancements

Posted: Tue Aug 25, 2009 9:57 pm
by Justin
Support for #PB_EventType_Change when a Panel item changes selection and SetGadgetItemData() to store a value in a Panel item. I have to use API for this.

Posted: Wed Aug 26, 2009 8:13 pm
by klaver
+1
That's sad, but actually #PB_EventType_Change is working only for 3 gadgets:

- StringGadget
- ExplorerTreeGadget
- TreeGadget (not mentioned in docs of EventType())

So as you can see, there's quite long way for PanelGadget to be supported.

Posted: Wed Aug 26, 2009 8:44 pm
by Trond
Here is a code to track change of panel without API. It is still not what is requested, though. It is just a workaround without API.

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
PanelGadget(0, 10, 10, 300, 200)
AddGadgetItem(0, -1, "Panel 0")
AddGadgetItem(0, -1, "Panel 1")
AddGadgetItem(0, -1, "Panel 2")
AddGadgetItem(0, -1, "Panel 3")
AddGadgetItem(0, -1, "Panel 4")
AddGadgetItem(0, -1, "Panel 5")

Panel = 0

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_Gadget
      If EventGadget() = 0
        If GetGadgetState(EventGadget()) <> Panel
          Panel = GetGadgetState(EventGadget())
          Debug "Panel changed to " + Str(Panel)
        EndIf
      EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver

Posted: Wed Aug 26, 2009 9:25 pm
by Justin
That´s a good workaround, i'll try it.
But i think it would take minutes to implement #PB_EventType_Change for the devs, SetGadgetItemData() would take more work if the item data is already in use but not much, the gadget is a little naked as is.