Hi,
How it is possible to embed CheckBox into PanelGadget header and trap CheckBox event?
Embed CheckBox into PanelGadget header and trap CheckBox eve
Re: Embed CheckBox into PanelGadget header and trap CheckBox
Hi
Code: Select all
OpenWindow(0, 0, 0, 400, 300, "Check to Tab", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(1,5,5,390,290)
AddGadgetItem(1, -1, "Tab #1 ")
AddGadgetItem(1, -1, "Tab #2 ")
AddGadgetItem(1, -1, "Tab #3 ")
CloseGadgetList()
CheckBoxGadget(10,55,8,15,15,"")
BringWindowToTop_(GadgetID(10))
CheckBoxGadget(20,116,8,15,15,"")
BringWindowToTop_(GadgetID(20))
CheckBoxGadget(30,178,8,15,15,"")
BringWindowToTop_(GadgetID(30))
DisableGadget(20,1)
DisableGadget(30,1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Select EventType()
Case #PB_EventType_Change
state = GetGadgetState(1)
If state = 0
DisableGadget(10,0)
DisableGadget(20,1)
DisableGadget(30,1)
EndIf
If state = 1
DisableGadget(10,1)
DisableGadget(20,0)
DisableGadget(30,1)
EndIf
If state = 2
DisableGadget(10,1)
DisableGadget(20,1)
DisableGadget(30,0)
EndIf
EndSelect
Case 10,20,30
Debug EventGadget()
Debug GetGadgetState(EventGadget())
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
Re: Embed CheckBox into PanelGadget header and trap CheckBox
Hmm, awesome...
Rashad, enormous thanks to You.
But what about instead of absolute coordinates of CheckBox items using relative coordinates of PanelGadget headers?
Rashad, enormous thanks to You.
But what about instead of absolute coordinates of CheckBox items using relative coordinates of PanelGadget headers?
Re: Embed CheckBox into PanelGadget header and trap CheckBox
Hi
Code: Select all
LoadFont(0,"Tahoma",12)
OpenWindow(0, 0, 0, 400, 300, "Check to Tab", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(1,5,5,390,290)
SetGadgetFont(1,FontID(0))
SetWindowLongPtr_( GadgetID(1), #GWL_STYLE, GetWindowLongPtr_( GadgetID(1), #GWL_STYLE )|#TCS_FIXEDWIDTH )
SendMessage_( GadgetID(1), #TCM_SETITEMSIZE, 0,120|30<<16)
AddGadgetItem(1, -1, "Tab #1 ") ;Spaces to set the text left padding
AddGadgetItem(1, -1, "Tab #2 ")
AddGadgetItem(1, -1, "Tab #3 ")
CloseGadgetList()
CheckBoxGadget(10,GadgetX(1)+100,GadgetY(1)+8,15,15,"") ; x = GadgetX(1)+Tab Width(120)- CheckBox width - 5 (-20)
BringWindowToTop_(GadgetID(10))
CheckBoxGadget(20,GadgetX(1)+220,GadgetY(1)+8,15,15,"") ;x = GadgetX(1)+Tab Width(120)- CheckBox width - 5 (-20) + 120
BringWindowToTop_(GadgetID(20))
CheckBoxGadget(30,GadgetX(1)+340,GadgetY(1)+8,15,15,"")
BringWindowToTop_(GadgetID(30))
DisableGadget(20,1)
DisableGadget(30,1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Select EventType()
Case #PB_EventType_Change
state = GetGadgetState(1)
If state = 0
DisableGadget(10,0)
DisableGadget(20,1)
DisableGadget(30,1)
EndIf
If state = 1
DisableGadget(10,1)
DisableGadget(20,0)
DisableGadget(30,1)
EndIf
If state = 2
DisableGadget(10,1)
DisableGadget(20,1)
DisableGadget(30,0)
EndIf
EndSelect
Case 10,20,30
Debug EventGadget()
Debug GetGadgetState(EventGadget())
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
Re: Embed CheckBox into PanelGadget header and trap CheckBox
I have a folder in my pb sources: pbsnippets\RASHAD
<3
<3
Proud supporter of PB! * Musician * C64/6502 Freak
Re: Embed CheckBox into PanelGadget header and trap CheckBox
Thanks oreopa
Much appreciated
You can use it to add BurttonGadget() and alike
Much appreciated
You can use it to add BurttonGadget() and alike
Egypt my love
Re: Embed CheckBox into PanelGadget header and trap CheckBox
Many thanks but expecting something different like instead of making tabs fixed length maybe get tab startX and width then create checkbox in proper place (because tabs should stay dynamic width according to text size)
Again huge thanks for effort.
Again huge thanks for effort.
Re: Embed CheckBox into PanelGadget header and trap CheckBox
No fixed width
Different tabs widths
Different tabs widths
Code: Select all
LoadFont(0,"Tahoma",12)
OpenWindow(0, 0, 0, 400, 300, "Check to Tab", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(1,5,5,390,290)
SetGadgetFont(1,FontID(0))
AddGadgetItem(1, -1, "Tab1 ") ;Spaces to set the text left padding
AddGadgetItem(1, -1, "Tab2 #2 ")
AddGadgetItem(1, -1, "Tab333 #3 ")
CloseGadgetList()
SendMessage_(GadgetID(1),#TCM_GETITEMRECT,0,r.RECT)
cbtrim = (r\bottom-r\top -15)/2
CheckBoxGadget(10,r\right-12,GadgetY(1)+r\top+cbtrim,15,15,"")
BringWindowToTop_(GadgetID(10))
SendMessage_(GadgetID(1),#TCM_GETITEMRECT,1,r.RECT)
CheckBoxGadget(20,r\right-12,GadgetY(1)+r\top+cbtrim,15,15,"")
BringWindowToTop_(GadgetID(20))
SendMessage_(GadgetID(1),#TCM_GETITEMRECT,2,r.RECT)
CheckBoxGadget(30,r\right-12,GadgetY(1)+r\top+cbtrim,15,15,"")
BringWindowToTop_(GadgetID(30))
DisableGadget(20,1)
DisableGadget(30,1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Select EventType()
Case #PB_EventType_Change
state = GetGadgetState(1)
If state = 0
DisableGadget(10,0)
DisableGadget(20,1)
DisableGadget(30,1)
EndIf
If state = 1
DisableGadget(10,1)
DisableGadget(20,0)
DisableGadget(30,1)
EndIf
If state = 2
DisableGadget(10,1)
DisableGadget(20,1)
DisableGadget(30,0)
EndIf
EndSelect
Case 10,20,30
Debug EventGadget()
Debug GetGadgetState(EventGadget())
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
Re: Embed CheckBox into PanelGadget header and trap CheckBox
Rashad, You are faster than 911.
These huge Thanks even not enough for You.
I didn't expect so fast and while searching, found same Your solution with getting rect from NetMaestro's (Add Close buttons to Panel Tabs).
That's why I'd like to thank NetMaestro as well.
Good night my friend.
These huge Thanks even not enough for You.
I didn't expect so fast and while searching, found same Your solution with getting rect from NetMaestro's (Add Close buttons to Panel Tabs).
That's why I'd like to thank NetMaestro as well.
Good night my friend.