TabBarGadget - Tabs like in a browser
-
- Enthusiast
- Posts: 349
- Joined: Thu Jul 02, 2009 5:42 am
Re: TabBarGadget - Tabs like in a browser
I am trying to display an image in the TabBarGadget, here is my code
SetTabBarGadgetItemImage( #TabBarGadget, 0, CatchImage(#Image_Image_18, ?Image_Image_18))
I have UsePNGImageDecoder() declared since it is a .png file, but the image does not get displayed on the tab
SetTabBarGadgetItemImage( #TabBarGadget, 0, CatchImage(#Image_Image_18, ?Image_Image_18))
I have UsePNGImageDecoder() declared since it is a .png file, but the image does not get displayed on the tab
Re: TabBarGadget - Tabs like in a browser
I have no problem with SetTabBarGadgetItemImage.
But you have to use the ImageID (not the Image number), I don't know if CatchImage() returns an ID ...
But you have to use the ImageID (not the Image number), I don't know if CatchImage() returns an ID ...
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: TabBarGadget - Tabs like in a browser
The CatchImage code as posted will return an ID and not the #. If it isn't working you should isolate the CatchImage line and verify that it is indeed returning a handle and not failing. If it's returning 0 you could try supplying the optional length parameter.
What am I missing here? The tabs in the IDE are courtesy of STARGATE's TabBarGadget, Bisonte was just pointing out a fact - right? Or did something go over my head?Gee, just what a need, a comedian.
BERESHEIT
Re: TabBarGadget - Tabs like in a browser
I guess he wanted a native TabBarGadget as part of the Purebasic command set (instead of a 3rd party lib)
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: TabBarGadget - Tabs like in a browser
Yes, right over your head because you are shorter than me. (I saw a bald spot!! And a bird's nest??? ) It was easy enough to understand that I meant included as a component for programmers to access. heh, heh, heh, heh.What am I missing here? The tabs in the IDE are courtesy of STARGATE's TabBarGadget, Bisonte was just pointing out a fact - right? Or did something go over my head?
Amateur Radio, D-STAR/VK3HAF
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: TabBarGadget - Tabs like in a browser
This is even better than a native gadget. It is a) good enough for Fred and b) complete with source code so you can tweak/upgrade it yourself. And I sprayed my bald spot, so you were lying when you said you saw it!
BERESHEIT
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: TabBarGadget - Tabs like in a browser
No, a native pb gadget with pb commands would be better:):) PBISE the heck out of good stuff like that!!! :):):)This is even better than a native gadget.
I claim copyright over the term PBISE than you very much.
Good code like that would be nice to be native, it's so nice to have. Being in the visual designer would be even betetr for bad old eyes.Complete with source code so you can tweak/upgrade it yourself.
Thank you so much for making me fall out of the chair snorting mouthwash through both nostrils and squich the can!!And I sprayed my bald spot, so you were lying when you said you saw it!
P.S. Why did you leave that hamster tatto on the spray?
Amateur Radio, D-STAR/VK3HAF
Re: TabBarGadget - Tabs like in a browser
STARGÅTE Thank you for this great code.
I have one feature request : A function to change the background color of the tabbargadget.
Example :Snippet codeThanks
I have one feature request : A function to change the background color of the tabbargadget.
Example :
Code: Select all
SetTabBarGadetColor(Gadget.i, Color.i)
Code: Select all
XIncludeFile "TabBarGadget.pbi"
Enumeration
#MainForm
#TB
EndEnumeration
Procedure OnTabBarClick()
Protected Position.i
Static Number.i = 3
Select EventType()
Case #TabBarGadget_EventType_Change
Debug "selected item changed, now at position "+Str(GetTabBarGadgetItemPosition(EventGadget(), #TabBarGadgetItem_Event))
EndSelect
EndProcedure
OpenWindow(#MainForm, 0, 0, 800, 600, "TabBarGadget test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
SetWindowColor(#MainForm, RGB(210, 180, 140))
;I have one feature request : A function to change the background color of the tabbargadget.
;Example : SetTabBarGadetColor(Gadget.i, Color.i)
TabBarGadgetInclude\TabBarColor = RGB(210, 180, 140) ;Comment this line To see the difference
TabBarGadget(#TB, 10, 60, WindowWidth(#MainForm)-20, 30, #TabBarGadget_CloseButton, #MainForm)
AddTabBarGadgetItem(#TB, #PB_Default, "Any tab 1")
AddTabBarGadgetItem(#TB, #PB_Default, "Any tab 2")
AddTabBarGadgetItem(#TB, #PB_Default, "Any tab 3")
SetTabBarGadgetState(#TB, 0)
ContainerGadget(-1, 5, 90, WindowWidth(#MainForm)-10, 500)
CloseGadgetList()
BindGadgetEvent(#TB, @OnTabBarClick())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: TabBarGadget - Tabs like in a browser
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: TabBarGadget - Tabs like in a browser
Yes, i have a configuration structure, but these settings are for all tab bar gadgets.
It is a good request to set the colors (background, border and so on) individually for each gadget.
I will implement it, if I have time.
It is a good request to set the colors (background, border and so on) individually for each gadget.
I will implement it, if I have time.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: TabBarGadget - Tabs like in a browser
Question about resize TabBarGadget : Is this code correct ?■ Snippet codeGreetings ... falsam
Code: Select all
ResizeGadget(#TB, #PB_Ignore, #PB_Ignore, WindowWidth(#MainForm)-20, #PB_Ignore)
SetTabBarGadgetAttribute(#TB, #PB_Ignore, WindowWidth(#MainForm)-20)
Code: Select all
XIncludeFile "TabBarGadget.pbi"
Enumeration Font
#FontGlobal
EndEnumeration
Enumeration Window
#MainForm
#PopupMenu
EndEnumeration
Enumeration Gadget
#TB
#Container
EndEnumeration
Declare Start()
Declare OnTabBarClick()
Declare OnResize()
Declare OnExit()
Start()
Procedure Start()
LoadFont(#FontGlobal, "", 10)
SetGadgetFont(#PB_Default, FontID(#FontGlobal))
OpenWindow(#MainForm, 0, 0, 800, 600, "TabBarGadget Test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget)
SetWindowColor(#MainForm, RGB(245, 222, 179))
;Tabbargadget.
TabBarGadgetInclude\TabBarColor = GetWindowColor(#MainForm)
TabBarGadget(#TB, 10, 60, WindowWidth(#MainForm)-20, 40, #TabBarGadget_PopupButton, #MainForm)
AddTabBarGadgetItem(#TB, #PB_Default, "Any tab 1")
AddTabBarGadgetItem(#TB, #PB_Default, "Any tab 2")
AddTabBarGadgetItem(#TB, #PB_Default, "Any tab 3")
SetTabBarGadgetState(#TB, 0) ;Set active panel
SetTabBarGadgetItemColor(#TB, 0, #PB_Gadget_BackColor, RGB(255, 255, 255) )
SetTabBarGadgetItemColor(#TB, 1, #PB_Gadget_BackColor, RGB(210, 180, 140) )
SetTabBarGadgetItemColor(#TB, 2, #PB_Gadget_BackColor, RGB(210, 180, 140) )
;Container
ContainerGadget(#Container, 5, 100, WindowWidth(#MainForm) - 10, WindowHeight(#MainForm) - 120)
CloseGadgetList()
;PoppupButton Menu
CreatePopupMenu(#PopupMenu)
MenuItem(0, "Setup")
MenuItem(1, "Exit")
;Trigger
BindGadgetEvent(#TB, @OnTabBarClick())
BindMenuEvent(#PopupMenu, 1, @OnExit())
BindEvent(#PB_Event_SizeWindow, @OnResize())
BindEvent(#PB_Event_CloseWindow, @OnExit())
Repeat : WaitWindowEvent() : ForEver
EndProcedure
Procedure OnTabBarClick()
Static OlDPosition.i
Protected Position.i = GetTabBarGadgetItemPosition(EventGadget(), #TabBarGadgetItem_Selected)
Select EventType()
Case #TabBarGadget_EventType_PopupButton
DisplayPopupMenu(#PopupMenu, WindowID(#MainForm))
Case #TabBarGadget_EventType_Change
SetTabBarGadgetItemColor(#TB, OlDPosition, #PB_Gadget_BackColor, RGB(210, 180, 140) )
SetTabBarGadgetItemColor(#TB, Position, #PB_Gadget_BackColor, RGB(255, 255, 255) )
OlDPosition = Position
EndSelect
EndProcedure
Procedure OnResize()
;Resize tabbargadget
ResizeGadget(#TB, #PB_Ignore, #PB_Ignore, WindowWidth(#MainForm)-20, #PB_Ignore)
SetTabBarGadgetAttribute(#TB, #PB_Ignore, WindowWidth(#MainForm)-20)
;Resize container
ResizeGadget(#Container, #PB_Ignore, #PB_Ignore, WindowWidth(#MainForm)-10, WindowHeight(#MainForm) - 120)
EndProcedure
Procedure OnExit()
End
EndProcedure
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: TabBarGadget - Tabs like in a browser
ResizeGadget() is sufficient, but you have to call UpdateTabBarGadget(Gadget.i) to update the drawing:
Code: Select all
Procedure OnResize()
;Resize tabbargadget
ResizeGadget(#TB, #PB_Ignore, #PB_Ignore, WindowWidth(#MainForm)-20, #PB_Ignore)
UpdateTabBarGadget(#TB)
;Resize container
ResizeGadget(#Container, #PB_Ignore, #PB_Ignore, WindowWidth(#MainForm)-10, WindowHeight(#MainForm) - 120)
EndProcedure
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: TabBarGadget - Tabs like in a browser
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: TabBarGadget - Tabs like in a browser
Hi STARGATE,
I'm getting TabBarGadget freezes on MacOS 10.12 Sierra. Wondering if you have any advice.
- My program has one TabBar
- If all the tabs fit, I can drag the tabs around with no problem
- If the tabs DON'T fit (left and right arrows appear), then when I start to drag a tab left/right, it freezes the program
- Usually I have to kill it with the debugger
- Sometimes, the debugger catches it on this line in TabBarGadget_Timer()
The error is
EDIT: Just saw this post, looks like Xcode 8 broke this
http://www.purebasic.fr/english/viewtop ... tchingMask
I'm getting TabBarGadget freezes on MacOS 10.12 Sierra. Wondering if you have any advice.
- My program has one TabBar
- If all the tabs fit, I can drag the tabs around with no problem
- If the tabs DON'T fit (left and right arrows appear), then when I start to drag a tab left/right, it freezes the program
- Usually I have to kill it with the debugger
- Sometimes, the debugger catches it on this line in TabBarGadget_Timer()
Code: Select all
PostEvent(#PB_Event_Gadget, \TabBarGadget\Window, \TabBarGadget\Number, #TabBarGadget_EventType_Pushed, \Type)
Any ideas? Event bug in PB? I am going to update the OS to 10.12.1 and see what happens.nextEventMatchingMask should only be called from the Main Thread!
EDIT: Just saw this post, looks like Xcode 8 broke this
http://www.purebasic.fr/english/viewtop ... tchingMask
Re: TabBarGadget - Tabs like in a browser
Unless I am missing something, I cannot find how you would identify the tab a user right clicked on. Does anyone know?