Page 10 of 13

Re: TabBarGadget - Tabs like in a browser

Posted: Mon Dec 03, 2018 1:10 pm
by Dude
D'oh! :( I won't bother using it for this current project, then. Too many gadgets involved to be re-coded. Thanks for clarifying, anyway.

Re: TabBarGadget - Tabs like in a browser

Posted: Mon Dec 03, 2018 1:32 pm
by STARGÅTE
GenRabbit wrote:This is awesome. Any chance of getting a Module version of it?
This is a good idea, I think I will implement that.
Niffo wrote:You can resize the gadget then call UpdateTabBarGadget()
Right. I saw, that we have a new constant (#PB_EventType_Resize), I will try it to implement this, that you haven't call UpdateTabBarGadget().
Dude wrote:Do you mean I have to put a ContainerGadget inside each TabBarGadget tab, with all gadgets inside those containers?
The TabBarGadget is no direct replacement for the PanelGadget. The TabBarGadget tabs have no own conainer.
Typically, when you use a TabBarGadget you have only one container for all tabs and you just change the content (like in an editor or a browser)

Re: TabBarGadget - Tabs like in a browser

Posted: Sun Mar 24, 2019 7:25 pm
by wombats
Hi,

Is this a bug? I cannot move tab 0 to position 1. It seems to expect a 1-based position, but the documentation says it starts at 0. Am I missing something?

Code: Select all

XIncludeFile "TabBarGadget.pbi"

Enumeration
  #Window
  #TabGadget
  #MoveButton
EndEnumeration

OpenWindow(#Window, 0, 0, 320, 240, "TabBarGadget", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)

TabBarGadget(#TabGadget, 0, 0, WindowWidth(#Window), 32, #TabBarGadget_None, #Window)
AddTabBarGadgetItem(#TabGadget, #PB_Default, "One")
AddTabBarGadgetItem(#TabGadget, #PB_Default, "Two")
AddTabBarGadgetItem(#TabGadget, #PB_Default, "Three")

ButtonGadget(#MoveButton, 10, 45, 90, 25, "Move")

Repeat
  
  Select WaitWindowEvent()
      
    Case #PB_Event_CloseWindow
      End

    Case #PB_Event_Gadget
      If EventGadget() = #MoveButton
        SetTabBarGadgetItemPosition(#TabGadget, 0, 1)
      EndIf
      
  EndSelect
  
ForEver

Re: TabBarGadget - Tabs like in a browser

Posted: Sun Mar 24, 2019 7:57 pm
by STARGÅTE
Thanks for the bug report.
You are right, it is a bug in the procedure.
Please replace this procedure in the include and check whether is works.

Code: Select all

Procedure SetTabBarGadgetItemPosition(Gadget.i, Tab.i, Position.i)
	
	Protected *TabBarGadget.TabBarGadget = GetGadgetData(Gadget)
	Protected *NewItem.TabBarGadgetItem = TabBarGadget_ItemID(*TabBarGadget, Position)
	Protected *Item.TabBarGadgetItem = TabBarGadget_ItemID(*TabBarGadget, Tab)
	
	If *Item And *Item <> *TabBarGadget\NewTabItem
		If *NewItem And *NewItem <> *TabBarGadget\NewTabItem
			If Position > Tab
				MoveElement(*TabBarGadget\Item(), #PB_List_After, *NewItem)
			Else
				MoveElement(*TabBarGadget\Item(), #PB_List_Before, *NewItem)
			EndIf
		Else
			MoveElement(*TabBarGadget\Item(), #PB_List_Last)
		EndIf
		TabBarGadget_PostUpdate(*TabBarGadget)
	EndIf
	
EndProcedure

Re: TabBarGadget - Tabs like in a browser

Posted: Sun Mar 24, 2019 8:09 pm
by wombats
That seems to fix it.

Thanks for the fast response and fix!

Re: TabBarGadget - Tabs like in a browser

Posted: Sun Mar 24, 2019 10:02 pm
by Dude
wombats wrote:That seems to fix it.
Are the download links in the first post fixed?

Re: TabBarGadget - Tabs like in a browser

Posted: Mon Mar 25, 2019 12:41 am
by STARGÅTE
I have replaced the Include in the Link (only for the Version 1.5)

Re: TabBarGadget - Tabs like in a browser

Posted: Mon Sep 16, 2019 1:49 pm
by infratec
Hi STARGÅTE,

a feature request:

Allow rectangle images, not only square ones.

We 'abuse' the entry to show an additional status icon.
(a circle with a number inside)
Now we have to show 2 status values. Instead of 16 by 16 it would be nice if we can use 32 by 16.

I also looked in the source code. Adding/changing ImageSize to ImageWidth and ImageHeight is not a big deal,
but I don't know where I have to make the changes to size the tab accordingly.

Tal'ma'te

Re: TabBarGadget - Tabs like in a browser

Posted: Mon Sep 16, 2019 2:20 pm
by infratec
Ok,

for our personal use I changed NewImageID to NewImage. (TabBarGadget_ReplaceImage())
So it is possible to get the size via ImageWidth() and ImageHeight().

Code: Select all

*Item\Image = CreateImage(#PB_Any, ImageWidth(NewImage), ImageHeight(NewImage), 32, #PB_Image_Transparent)
And in TabBarGadget_RotateImage():

Code: Select all

*Item\DrawedImage = CreateImage(#PB_Any, ImageHeight(*Item\Image), ImageWidth(*Item\Image), 32, #PB_Image_Transparent)
Ok, it is a bit difficult since man applications are already using the TabBarGadget.
But maybe in V2.0 :wink:

Re: TabBarGadget - Tabs like in a browser

Posted: Mon Sep 16, 2019 4:28 pm
by STARGÅTE
I am very interested in a screenshot of your application with my TabBarGadget and your status icon, can you show me?

To your feature request:
Fun fact: the constant #TabBarGadget_ImageSize is already declared but never used ^^
I can implement this attribute as follows?:
  • By default the image is scaled to the value set in TabBarGadgetInclude\ImageSize, as it is already implemented.
  • You can set the image size with SetTabBarGadgetAttribute(Gadget, #TabBarGadget_ImageSize, Size)
  • With Size = #PB_Default, the TabBarGadget uses the original size of each image.

Re: TabBarGadget - Tabs like in a browser

Posted: Tue Sep 17, 2019 7:13 am
by infratec
Hi,

we use it as a part of our CTI solution.
In this case we use it to show the state of the scheduled calls.
Red for calls where the time is exited and blue for calls which should be done in the next 2 hours.

Image

Image

Also for our english speakers :wink:

Image

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Dec 04, 2019 5:31 pm
by StarBootics
Hello Stargate,

I have some "Invalid Memory Access" on all DrawingFont(\FontID) lines (Line 1613, Line 1937 , Line 2189 and Line 2268). I'm under Ubuntu 19.10 x64 and I'm using PB 5.71 LTS.
If I comment these lines everything work except the text is draw using the default font.

Best regards
StarBootics

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Dec 04, 2019 5:54 pm
by STARGÅTE
This \FontID comes from this code part (Line 2581-2588):

Code: Select all

		CompilerSelect #PB_Compiler_OS
			CompilerCase #PB_OS_Windows
				\FontID                  = GetGadgetFont(#PB_Default)
			CompilerDefault
				DummyGadget = TextGadget(#PB_Any, 0, 0, 10, 10, "Dummy")
				\FontID                  = GetGadgetFont(DummyGadget)
				FreeGadget(DummyGadget)
		CompilerEndSelect
On non-Windows system, I create a dummy gadget to get the standard gadget font of the system.
My idea is that this part does not work on your system.
You can modify the code and use your one font like this:

Code: Select all

\FontID                  = FontID(LoadFont(#PB_Any, ...))

Re: TabBarGadget - Tabs like in a browser

Posted: Tue Jan 07, 2020 10:32 pm
by kenmo
Hi STARGATE, I am wondering:

1. Do you have any TabBarGadget changes since v1.5 beta 2?

2. Do you use GitHub?

3. Would you be interested in hosting the TabBarGadget on GitHub?


Over the years, I have made changes to the TabBarGadget which have never been shared, but I would be happy to share.

And with the PB IDE going open-source, it looks very likely there will be edits to the TabBarGadget, and it would be nice to track and maintain bugfixes and new features in a public place like GitHub.


Thanks for all your hard work, by the way!

Re: TabBarGadget - Tabs like in a browser

Posted: Wed Jan 08, 2020 1:16 pm
by STARGÅTE
kenmo wrote:1. Do you have any TabBarGadget changes since v1.5 beta 2?
No. Only Freak did some changes for the DPI compatibility during his implementation into the PB IDE.
kenmo wrote:2. Do you use GitHub?
No.
kenmo wrote:3. Would you be interested in hosting the TabBarGadget on GitHub?
What do I have to do if i "host" the TabBarGadget code on GitHub?