Hi,
it would be nice if the PanelGadget was able to fire a Changed-Event when a new page is selected (like the other gadgets which contain items). It should be occur every time the GetGadgetState() value got changed. The available Clicked-Event is not suitable, because it will also be fired if the page is clicked but not changed.
Best Regards
Uwe
#PB_EventType_Changed for PanelGadget
#PB_EventType_Changed for PanelGadget
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: #PB_EventType_Changed for PanelGadget
I can't confirm your statement for PB 5.00 and Linux (Kubuntu 9.04, Ubuntu 12.04 LTS and Fedora 17, all 32 bit) with the following code example. Only a click onto a previously inactive tab is reported:uwekel wrote:The available Clicked-Event is not suitable, because it will also be fired if the page is clicked but not changed.
Code: Select all
OpenWindow(0, 1400, 100, 300, 200, "PanelGadget", #PB_Window_SystemMenu)
PanelGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 20)
AddGadgetItem(0, -1, "Panel 1")
AddGadgetItem(0, -1, "Panel 2")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 0
Debug "Click onto tab " + #DQUOTE$ + GetGadgetItemText(0, GetGadgetState(0)) + #DQUOTE$
EndIf
EndSelect
ForEver
Code: Select all
OpenWindow(0, 1400, 100, 300, 200, "PanelGadget", #PB_Window_SystemMenu)
PanelGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 20)
AddGadgetItem(0, -1, "Panel 1")
AddGadgetItem(0, -1, "Panel 2")
LastTab = GetGadgetState(0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 0
NewTab = GetGadgetState(0)
If NewTab <> LastTab
Debug "Click onto tab " + #DQUOTE$ + GetGadgetItemText(0, GetGadgetState(0)) + #DQUOTE$
LastTab = NewTab
EndIf
EndIf
EndSelect
ForEver
Re: #PB_EventType_Changed for PanelGadget
Shardik's first code sample works fine in PB 5 on Linux. I didn't bother checking the second piece of code because the 1st worked.uwekel wrote:The available Clicked-Event is not suitable, because it will also be fired if the page is clicked but not changed.
Re: #PB_EventType_Changed for PanelGadget
Hi,
thank you for your comments! I just did some further testing with the following code:
My conclusion:
- The event type should be #PB_EventType_Changed instead of #PB_EventType_LeftMouseClick, because in both OS this event is also fired if you change the current tab with your keyboard and not with the mouse.
- In Windows there is also a mouse up event, but not so in Linux. For better cross platform function it should match to all OS.
- In Windows there is no event if the current tab will be closed. You can check it with a click on the button (see my code above).
- Windows does not fire an event when creating the first tab, but Linux do, what is correct because the value GetGadgetState() is changed.
Best regards
Uwe
thank you for your comments! I just did some further testing with the following code:
Code: Select all
If OpenWindow(0, 0, 0, 300, 200, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(0, 10, 10, 280, 140)
AddGadgetItem(0, -1, "Panel 1")
AddGadgetItem(0, -1, "Panel 2")
CloseGadgetList()
ButtonGadget(1, 10, 154, 280, 36, "Click to remove panel 2")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Debug "Event " + Str(EventType()) + " on tab " + Str(GetGadgetState(0))
Case 1
RemoveGadgetItem(0, 1)
EndSelect
EndSelect
ForEver
EndIf
- The event type should be #PB_EventType_Changed instead of #PB_EventType_LeftMouseClick, because in both OS this event is also fired if you change the current tab with your keyboard and not with the mouse.
- In Windows there is also a mouse up event, but not so in Linux. For better cross platform function it should match to all OS.
- In Windows there is no event if the current tab will be closed. You can check it with a click on the button (see my code above).
- Windows does not fire an event when creating the first tab, but Linux do, what is correct because the value GetGadgetState() is changed.
Best regards
Uwe
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2