IconBarGadget - custom graphical toolbars

Share your advanced PureBasic knowledge/code with the community.
juror
Enthusiast
Enthusiast
Posts: 232
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: IconBarGadget - custom graphical toolbars

Post by juror »

Nice.

Might just be one of the things legends are made of :D
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: IconBarGadget - custom graphical toolbars

Post by Fangbeast »

In your case, if you really wanted to, you could put [ IconBarGadget | Strings and Combos | Another IconBarGadget ], in fact there is already a helper procedure which creates a one-button IconBarGadget.
D'oh!! I am so dumb that I never thought of that!! Remind me to soundly bash myself around the head with a rubber chicken!
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: IconBarGadget - custom graphical toolbars

Post by Fangbeast »

Strange one. I made an extra 'exit' button with the helper "IconBarGadgetButton" so that I could have other gadgets in between but the highlight over the button is a good 2-3mm shorter in height than the full bar as I hover over it?

If I hover over the "Add" button, the highlight box is nearly the height of the bar. If I hover over the "Exit" button, the highlight box comes up right underneath the last pixel of the word "exit".

Can't see anything obvious.

Code: Select all

  IBG(0) = IconBarGadget(0, 490, 790, 78, #IconBarDisplay_ImageAndText)
  
  AddIconBarGadgetItem(IBG(0), "Add",           #butAdd)
  AddIconBarGadgetItem(IBG(0), "Copy",          #butCopy)  
  AddIconBarGadgetItem(IBG(0), "Delete",        #butDelete)
  AddIconBarGadgetItem(IBG(0), "Edit",          #butEdit)
  AddIconBarGadgetItem(IBG(0), "Undelete",      #butUndelete)
  AddIconBarGadgetItem(IBG(0), "Export",        #butExport)
  AddIconBarGadgetItem(IBG(0), "Import",        #butImport)
  AddIconBarGadgetItem(IBG(0), "Find",          #butFind)
  AddIconBarGadgetItem(IBG(0), "Help",          #butHelp)
  AddIconBarGadgetItem(IBG(0), "Print",         #butPrint)
  AddIconBarGadgetItem(IBG(0), "Sticky",        #butStickywindow)
  AddIconBarGadgetItem(IBG(0), "ToolTips",      #butTooltips)
  AddIconBarGadgetItem(IBG(0), "TitleClock",    #butClock)
  AddIconBarGadgetItem(IBG(0), "Setup",         #butSetup)
    
  SetIconBarGadgetFontID(IBG(0),    LoadFont(0, "Comic Sans MS", 10))
  SetIconBarGadgetColor(IBG(0),     #IconBar_BackgroundColor,   $BFBFBF)
  SetIconBarGadgetColor(IBG(0),     #IconBar_HighlightColor,    $400040)
  SetIconBarGadgetColor(IBG(0),     #IconBar_TextColor,         $701919)
  SetIconBarGadgetRadius(IBG(0), 7)
  
  SetIconBarGadgetAttribute(IBG(0), #IconBar_MouseOverEvents, #True)
  
  IBG(1) = IconBarGadgetButton(800, 490, 54, 78, #butExit, "Exit", #IconBarDisplay_ImageAndText)
  
  SetIconBarGadgetFontID(IBG(1),    LoadFont(1, "Comic Sans MS", 10))
  SetIconBarGadgetColor(IBG(1),     #IconBar_BackgroundColor,   $BFBFBF)
  SetIconBarGadgetColor(IBG(1),     #IconBar_HighlightColor,    $400040)
  SetIconBarGadgetColor(IBG(1),     #IconBar_TextColor,         $701919)
  SetIconBarGadgetRadius(IBG(1), 7)  
  
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
kenmo
Addict
Addict
Posts: 2043
Joined: Tue Dec 23, 2003 3:54 am

Re: IconBarGadget - custom graphical toolbars

Post by kenmo »

I think I know why... The "Button" procedure changes the default margin around the highlight to 0.

I assumed if someone was using a standalone button and gave coordinates, then they want the highlight at those exact coordinates with no margin. Didn't really think too much about this small change.

But if you want the "button" version to look exactly like the "normal" version, maybe try:

Code: Select all

SetIconBarGadgetMargin(IBG(1), #IconBar_Default)
or just use another "normal" IconBar? (I can't test right now.)
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: IconBarGadget - custom graphical toolbars

Post by davido »

@kenmo,

The Ribbon is great addition. Thank you very much. :D

I wonder; is it possible to add or delete icons dynamically?
I tried this but they were always added on the last tab. Couldn't delete any, though.

This is not a request for you to add this feature, unless of course you wish to: it would be nice if it could be done as is.
DE AA EB
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: IconBarGadget - custom graphical toolbars

Post by Fangbeast »

kenmo wrote:I think I know why... The "Button" procedure changes the default margin around the highlight to 0.

I assumed if someone was using a standalone button and gave coordinates, then they want the highlight at those exact coordinates with no margin. Didn't really think too much about this small change.

But if you want the "button" version to look exactly like the "normal" version, maybe try:

Code: Select all

SetIconBarGadgetMargin(IBG(1), #IconBar_Default)
or just use another "normal" IconBar? (I can't test right now.)
Didn't change it. I'll try a normal iconbar when I get back from the shopping and junk food expedition :)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
kenmo
Addict
Addict
Posts: 2043
Joined: Tue Dec 23, 2003 3:54 am

Re: IconBarGadget - custom graphical toolbars

Post by kenmo »

davido wrote:The Ribbon is great addition. Thank you very much. :D

I wonder; is it possible to add or delete icons dynamically?
I tried this but they were always added on the last tab. Couldn't delete any, though.
Thanks davido. :) The Ribbon isn't really an addition (yet) just a rough start of an idea. It needs A LOT MORE features, even if it's icons-only (no ComboBoxes or other gadgets).

There are no functions for dynamic RibbonBars written yet. But you can use a function like this to get an individual IconBarGadget from a Ribbon tab, and then use dynamic IconBarGadget functions on it!

Code: Select all

Procedure.i GetIconBarFromRibbonBar(*RB.RB_RIBBONBAR, Tab.i)
  If (*RB And (Tab >= 0) And (Tab < ListSize(*RB\IconBar())))
    SelectElement(*RB\IconBar(), Tab)
    ProcedureReturn (*RB\IconBar())
  EndIf
EndProcedure
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: IconBarGadget - custom graphical toolbars

Post by davido »

@kenmo,
An unexpected bonus!
Thank you very much. :D
DE AA EB
Joris
Addict
Addict
Posts: 890
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: IconBarGadget - custom graphical toolbars

Post by Joris »

@kenmo, nice and very usefull stuff.

Thanks.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: IconBarGadget - custom graphical toolbars

Post by doctorized »

Nice work but no dpi awareness included.
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Re: IconBarGadget - custom graphical toolbars

Post by ebs »

I would like to experiment with this code, but the link to the ZIP file containing the images is broken.

Does anyone have the file "iconbargadget_1.2.zip"?
If not, I guess I'll just find/create some suitable images. Thanks!
User avatar
blueb
Addict
Addict
Posts: 1116
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: IconBarGadget - custom graphical toolbars

Post by blueb »

I have version 1.12 of Kenmo's IconBarGadget.pbi and included images.

PM me and I'll zip it up for you :)
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: IconBarGadget - custom graphical toolbars

Post by BarryG »

Can you please put the zip file online somewhere? Like https://filebin.net or something? I don't do PMs anymore.
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Re: IconBarGadget - custom graphical toolbars

Post by ebs »

PM me and I'll zip it up for you
PM sent - thank you very much!
User avatar
blueb
Addict
Addict
Posts: 1116
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: IconBarGadget - custom graphical toolbars

Post by blueb »

Hi Barry,

Here's my Dropbox link: https://www.dropbox.com/scl/fi/jenqi1ym ... dyycm&dl=0


I'll make it available for a month or so. (I hate cluttering my Dropbox account with files that are there 'forever') :mrgreen:
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Post Reply