TabBarGadget - Tabs like in a browser

Share your advanced PureBasic knowledge/code with the community.
User avatar
freepurebasic
Enthusiast
Enthusiast
Posts: 123
Joined: Fri Sep 24, 2010 12:02 pm
Location: world wide web

Re: TabBarGadget - Tabs like in a browser

Post by freepurebasic »

:mrgreen: :lol: :P :twisted: :o :shock: :D
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: TabBarGadget - Tabs like in a browser

Post by Derren »

Nice work.
But when I add several more tabs the only indicator that there are many tabs out of view are the small arrows on the sides.
I feel the tabs should be cut at the edges. I don't use tabs in Firefox anymore, but I believe that's how they did it.
Speeking of which: Scrollwheel support to scroll through the tabs would be nice, too.

Also some way to add text and/or an icon to the "new tab"-tab.

And some more events like, doubleclick and right mouseclick on tab.

Nice touch with the double click on emty space that creates a new tab.
But this should also be handled with a independent double-click event so we can disable this feature.

Nice job, again.

Soon I will not use any standard gadgets anymore. So many cool Canvas-versions :lol:
User avatar
STARGÅTE
Addict
Addict
Posts: 2090
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by STARGÅTE »

Derren wrote:Speeking of which: Scrollwheel support to scroll through the tabs would be nice, too.
yes, I include it
Derren wrote:Also some way to add text and/or an icon to the "new tab"-tab.
good idea, like a special constant for position for AddTabBarGadgetItem or SetTabBarGadgetText like
Derren wrote:And some more events like, doubleclick and right mouseclick on tab.
I think at this point we also can use EventType() of PureBasic.
I then add just a EventTab, which returns the tab position of the event, ok?
Derren wrote:Nice touch with the double click on emty space that creates a new tab.
But this should also be handled with a independent double-click event so we can disable this feature.
yes, thats right, the new EventTab() will then return #TabBarGadget_Space or so.
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 moreTypeface - Sprite-based font include/module
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: TabBarGadget - Tabs like in a browser

Post by Derren »

STARGÅTE wrote:I think at this point we also can use EventType() of PureBasic.
I then add just a EventTab, which returns the tab position of the event, ok?
Totally fine.
And sounds consistent with PB.
A command to determine what happened and one to determine where it happened.
Thanks for considering my ideas.
User avatar
STARGÅTE
Addict
Addict
Posts: 2090
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by STARGÅTE »

It took a little longer, but here are the first beta of the new update:

Update 1.1 (Beta) (12. Dec 2011)
  • Many new procedures for the gadget added
  • Optional text cut in too little space
  • EventTab() for use with EventType() to determine the tab with the event
  • Using mouse wheel for navigation
  • tool tip text for each tab
  • Improved (animated) representation of the shift tab
Image

TabBarGadget - Include (12. Dec 2011)
TabBarGadget - Beispiel (12. Dec 2011)
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 moreTypeface - Sprite-based font include/module
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: TabBarGadget - Tabs like in a browser

Post by c4s »

Oh wow, this looks wonderful!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
idle
Always Here
Always Here
Posts: 5098
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TabBarGadget - Tabs like in a browser

Post by idle »

looks great thanks
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
flaith
Enthusiast
Enthusiast
Posts: 704
Joined: Mon Apr 25, 2005 9:28 pm
Location: $300:20 58 FC 60 - Rennes
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by flaith »

A real "must have", thanks a lot for sharing :D
“Fear is a reaction. Courage is a decision.” - WC
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: TabBarGadget - Tabs like in a browser

Post by srod »

Looks very nice - thanks for sharing.
I may look like a mule, but I'm not a complete ass.
User avatar
electrochrisso
Addict
Addict
Posts: 980
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: TabBarGadget - Tabs like in a browser

Post by electrochrisso »

Good coding, Thanks for sharing. :)
Should something happen when I use the mouse wheel. :?:
PureBasic! Purely one of the best 8)
User avatar
Lord
Addict
Addict
Posts: 849
Joined: Tue May 26, 2009 2:11 pm

Re: TabBarGadget - Tabs like in a browser

Post by Lord »

electrochrisso wrote:...
Should something happen when I use the mouse wheel. :?:
Yes. If you select a TabBar with "<" or ">" on the ends, you can scroll
the tabs to left/right.
Image
User avatar
electrochrisso
Addict
Addict
Posts: 980
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: TabBarGadget - Tabs like in a browser

Post by electrochrisso »

Yes. If you select a TabBar with "<" or ">" on the ends, you can scroll the tabs to left/right.
Strange, this computer not playing the game, I can delete tabs by clicking on the mousewheel though.
Might need to play with the mouse settings.
PureBasic! Purely one of the best 8)
ebs
Enthusiast
Enthusiast
Posts: 530
Joined: Fri Apr 25, 2003 11:08 pm

Re: TabBarGadget - Tabs like in a browser

Post by ebs »

Stargate,

This is great! Thank you for sharing.

Would you consider adding a flag to prevent the user from being able to move the tabs?
There are some cases when I wouldn't want to allow the tabs to be rearranged by the user.

Thanks,
Eric
WilliamL
Addict
Addict
Posts: 1224
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: TabBarGadget - Tabs like in a browser

Post by WilliamL »

I guess I'm the first to try the TabBarGadget on a Mac.

Small problem. For some reason, in line 128,

Code: Select all

\FontID=GetGadgetFont(#PB_Default)
returns zero. I substituted

Code: Select all

\FontID =FontID(LoadFont(#PB_Any,"Geneva",9)) ; edited 
to see if it would work. It did work so I guess the Mac users will need to know what font/size to use.

[edit] Well, there is a mention of this behavior in the Help manual. Maybe if the font is defined on the Mac version then GetGadgetFont(#PB_Default) would work but that ends up with having to load the font either way...
Last edited by WilliamL on Thu Dec 15, 2011 11:51 pm, edited 1 time in total.
MacBook Pro-M1 (2021), Sonoma 14.4.1, PB 6.10LTS M1
User avatar
STARGÅTE
Addict
Addict
Posts: 2090
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: TabBarGadget - Tabs like in a browser

Post by STARGÅTE »

ebs wrote:Would you consider adding a flag to prevent the user from being able to move the tabs?
I will add it.
WilliamL wrote:I guess I'm the first to try the TabBarGadget on a Mac.
thx for test it on mac.

but \FontID is the Font-ID not the Font-Number, so if you replace it, use this one:

Code: Select all

\FontID = FontID(LoadFont(#PB_Any,"Geneva",9))
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 moreTypeface - Sprite-based font include/module
Post Reply