Page 8 of 13
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Sep 28, 2014 5:01 pm
				by spacebuddy
				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  

 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Sep 28, 2014 6:43 pm
				by STARGÅTE
				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 ...
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Mon Sep 29, 2014 11:31 pm
				by netmaestro
				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.
Gee, just what a need, a comedian.
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?
 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Mon Sep 29, 2014 11:43 pm
				by Derren
				I guess he wanted a native TabBarGadget as part of the Purebasic command set (instead of a 3rd party lib)
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Tue Sep 30, 2014 3:34 am
				by Fangbeast
				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?
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.
 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Tue Sep 30, 2014 3:40 am
				by netmaestro
				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!
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Tue Sep 30, 2014 3:54 am
				by Fangbeast
				This is even better than a native gadget.
No, a native pb gadget with pb commands would be better:):) PBISE the heck out of good stuff like that!!!   

:):):)
I claim copyright over the term PBISE than you very much.
Complete with source code so you can tweak/upgrade it yourself.
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.
And I sprayed my bald spot, so you were lying when you said you saw it!
Thank you so much for making me fall out of the chair snorting mouthwash through both nostrils and squich the can!!
P.S. Why did you leave that hamster tatto on the spray?
 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Feb 28, 2016 1:42 pm
				by falsam
				STARGÅTE Thank you for this great code.
I have one feature request : A function to change the background color of the tabbargadget. 
Example : 
Code: Select all
SetTabBarGadetColor(Gadget.i, Color.i)
Snippet code
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 
Thanks  

 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Feb 28, 2016 1:50 pm
				by falsam
				sorry I just saw help : 
http://help.unionbytes.de/tbg/Configuration/
Realy a good job.
Thanks.
 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Feb 28, 2016 2:05 pm
				by STARGÅTE
				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.
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Feb 28, 2016 5:15 pm
				by falsam
				Question about resize TabBarGadget : Is this code correct ?
Code: Select all
  ResizeGadget(#TB, #PB_Ignore, #PB_Ignore, WindowWidth(#MainForm)-20, #PB_Ignore)
  SetTabBarGadgetAttribute(#TB, #PB_Ignore, WindowWidth(#MainForm)-20)
■ Snippet code
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
Greetings ... falsam
 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Feb 28, 2016 7:25 pm
				by STARGÅTE
				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
 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sun Feb 28, 2016 9:01 pm
				by falsam
				Ok. Thanks for your help and your online documentation.
 
 http://help.unionbytes.de/tbg/ 
			 
			
					
				Re: TabBarGadget - Tabs like in a browser
				Posted: Sat Nov 05, 2016 4:52 pm
				by kenmo
				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()
Code: Select all
PostEvent(#PB_Event_Gadget, \TabBarGadget\Window, \TabBarGadget\Number, #TabBarGadget_EventType_Pushed, \Type)
The error is
nextEventMatchingMask should only be called from the Main Thread!
Any ideas? Event bug in PB? I am going to update the OS to 10.12.1 and see what happens.
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
				Posted: Sun Mar 12, 2017 11:55 pm
				by wombats
				Unless I am missing something, I cannot find how you would identify the tab a user right clicked on. Does anyone know?