Some Panel enhancements

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Some Panel enhancements

Post 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.
klaver
Enthusiast
Enthusiast
Posts: 147
Joined: Wed Jun 28, 2006 6:55 pm
Location: Schröttersburg

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Post 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.
Post Reply