I have been looking around for information on creating a custom toolbar and not finding to much
information on how to create one. Can anyone give me some direction on how to make a custom toolbar ?
I have looked at the one in the Eddies Electronics example and could use that but it does not give any
information on how it was made and also does not have the capability to have smaller icons. Also it does
not explain what size the icons (.png) files should be.
Any input would be helpful.
Web or desktop?
Have you reviewed User Guide Book 2: User Interface? There are sections on Toolbars for both desktop and web.
As far as icon sizes, you can use what you want. 32x32 seems to be pretty common.
Desktop I’m using RS2012r2.1 and did not see those guides in the help.
The Xojo toolbar always has the large icon buttons even if you have no icons in the toolbar item… On Mac OS you can use declares (or macoslib) to set the default size of the toolbar, but you’d have to figure it out for the other platforms… If you decide to use 64x64 icons for the toolbar the icons will not be scaled down on Linux and will be 64x64 in the launched application
There are two ways to create a toolbar, either in the IDE using the graphical toolbar creator or through code (which you really shouldn’t need to do, but I am sure there are reasons to do it)…
I shared an example recently about Object2D THAT HAVE a ToolBar in a window.
download from here
Get an eye on it and do it from yourself
BTW: it is a xojo project: download the current version and look at it.
Thanks for the information guys. I did read and created the toolbar and got it where I wanted it
but had to make damn sure the icons were 32x32 or windows did not show like the mac does.
I just wish there was a way to show the icons smaller.
One last question… Is there a way to turn tool tips on or off with code. I do it through out my
program but my routine has no effect on the tool bar.
I posted a custom toolbar a while back that supported 32x32 and 24x24 icons (and was switchable at runtime)
[quote=67603:@shao sean]The Xojo toolbar always has the large icon buttons even if you have no icons in the toolbar item… On Mac OS you can use declares (or macoslib) to set the default size of the toolbar
Hi @shao sean , could you please lay out to me how to change the MacOS icons to 48x48 or even 64x64 instead of 32x32? I know you mentioned declare but quite frankly I have no idea how and what I need to change to achieve that. I’d be very thankful if you could post the relevant code snippet and where to use it.
Just read somewhere on the web that they can distinguish between retina-ready icons in 64x64? Is that a retina-only standard? Just out of curiosity as I anyway have a retina MBP.
I do think (and maybe it’s my old eyes) that the 32x32 icons are too small in my desktop app.
Thanks in advance
The icons are displayed only in two sizes - 32x32 and 16x16… You can use a 64x64 icon for use on retina screens, but it will still be a 32x32 toolbar icon… To use 48x48 or 64x64 you would need to either write your own toolbar class (canvas) or look at one of the ones already written… (On Linux, the built-in toolbar will grow and display huge icons though )
actually… I believe there are 24x24 and 32x32
those are the sized I used in my custom toolbar and matched the display of the native one
I figured the 16x16 was wrong, but was too lazy to look it up in the HIG
In the Apple ToolBar documentation, the advice is to use a pdf file.
On the other hand, you can save (using Print) your Object2D icon in a PDF as Vector.
Now you have work on your pane (IMHO).