Xplat Toolbar Control

Evaluation version available HERE

[h]rdsTOOLBAR[/h]
All the same properties and attributes of the XOJO Toolbar
Supports the same STYLE of buttons, with one minor exception,
ToolStyleDropDown and ToolSTyleSeparateDropDown operate in
an identical manner on both OSX and WIN.

Toolbuttons can be referenced by INDEX value the same as the XOJO
toolbar, but also by “Name”

 tb("Fred").visible=false
 tb(3).visible=true

New Toolbar Methods
add_BUTTON : buttons can be added by creating rdsTOOLBUTTON
objects (see below). Or for simple setups,
you can use add_BUTTON

          Syntax : add_button(style,caption,icon32,[icon24,][name,][tag])

add_FLEX : inserts a flexible space the will expand/contract based on window width
unlike the XOJO toolbar… This works properly on both OSX and WIN.

add_SEP : add a vertical Separator line. This has been deprecated in the XOJO toolbar
but I added it here if anyone wanted to use it… your choice.

add_SPACE : add a blank space between buttons

Height : returns the height of the toolbar. Since this is a canvas based control
you will have to adjust the position of controls below it. This height
will vary depending on the toolbar style you select (right click to change)

[h]rdsTOOLBUTTON[/h]
All the same properties and attributes of the XOJO ToolButton, including Style constants.
The only minor change is in the Constructor. You must specifiy the parent TOOLBAR object
in the TOOLBUTTON constructor.

    [i]tb=new rdsToolButton(rdstoolbar1)[/i]

ICON property by default works the same as the XOJO toolbutton. It creates a 32x32 icon.
However in order to produce a nicer looking display, rdsToolButtons allow you to specify TWO
icons. A large and a small. If you only specify one, it will internally create the other
as best it can.

       [i]tb.Icon=picture  ' creates a 32x32 icon (and a 24x24 if required)
       tb.Icon(True)=picture ' same as above
       tb.Icon(Fals)=picture ' creates a 24x24 icon (and a 32x32 if required)[/i]

Icon will take the supplied picture and rescale it to fit the icon size IF REQUIRED.
If this is running on a OSX RETINA Mac, then it will be 64x64 and 48x48 icons instead.

A new property was added. VISIBLE… this allows you to “remove” buttons from view without
having to rebuilt the entire toolbar.

[h]OS Differences[/h]
OSX : Xojo Toolbar does not allow multiple Buttons (Togglestyle) to be active at the same time.
WIN : Xojo Toolbar Flexible space does not work.

the rdsTOOLBAR fixes both those problems, plus allows you to change any attribute of any button on the fly.

NOTE : These have NOT been tested under any version of LINUX, and there ARE OS specific sections, so no telling
what will happen on a LINUX Machine.

[h]SAMPLE PROJECT[/h]
This project contains encrypted versions of both rdsTOOLBAR and rdsTOOLBUTTON objects. These are
for EVALUATION purposes only. They are 100% operational… but will ONLY run in the IDE

You will need to supply your own graphics to make a running demo. Refer to the commented code for examples

These objects are available for $15.00 for encrypted with NAG turned off, or $35 for source code.

It seems that you change the window type to a textured window… Also, the window does not drag via the toolbar area…

As far as textture window… there is no choice… by adding the unified area… it does that automatically.

Does it allow TextFields (unlike the Xojo toolbar)?

As of right now … not “integrated”… but because it is a canvas control… you can place anything over it you want…

The main reason I developed this was
OSX : Xojo Toolbar does not allow multiple Buttons (Togglestyle) to be active at the same time.
WIN : Xojo Toolbar Flexible space does not work.

I needed both those features to work in both OS… plus the ref by name, VISIBLE.

I have been thinking about making a version of DROPDOWN that looks like a popup menu instead of an icon… but my first priority was a working toolbar so I could finish a larger project on my docket.

Nice work Dave.
This looks quite smart, and I’m seriously considering it.

Although I don’t think I’d want the function myself, ‘hide toolbar’ in the popup menu doesn’t seem to work.
Other than that, I think the only thing I’d want added is for it to recognise the parent window is narrow, and chuck up a menu for the buttons it can’t fit on the screen.

well darn… you are right… “Hide Toolbar” does not work. And once it does (it did, so not sure what happened)… You will NOT be able to make it visible by right clicking again… you have to call Tb.visible=true … this in unlike the built-in toolbar that allows mouse events even when the toolbar is invisible. Since this is a canvas… that doesn’t work.

“Chuck up”… this a technical term? :slight_smile:

Right now the behaviour is the same as native. they don’t fit… they don’t show…

I have just integrated this into the main project for which i designed it… and have found a few niggly litte things that I have and will be fixing…

Has anybody tried this on a RETINA machine? I don’t know if it works properly or not. Basically if it detects Retina… it scales everything up…

Ok… it now allows you to embed Popup and/or Textfields… Just create the Popup or Textfield control like normal, set the desired with, etc…
and then attach it to the Toolbar using the ADD_BUTTON function . The toolbar will move the control, and lock it in its proper location automatically. You manage these controls the same as if they were NOT on the toolbar…

  rdsToolbar1.add_Button(popupmenu1,"PopUp!")
  rdsToolbar1.add_Button(textfield1,"TextField!")

Embedded Controls

This toolbar allows controls to be embedded and displayed as part of the Toolbar.
Currently TEXTFIELD, POPUPMENU and COMBOBOX are supported.

To use this feature add one or more of the above controls to your window (location is not important)
Then using the ADD_BUTTON procedure to embed the control. You will interface with the control in exactly
the same manner as you would have normally. The only thing the toolbar control does is control the location,
and adjust the spacing relative to the other toolbar buttons. Use the ITEM(x).VISIBLE and .ENABLED properties
of the toolbar button array instead of accessing these properties directly otherwise the display of the toolbar
may become out of synch.

THIS VERSION HAS REPLACED THE VERSION UPLOADED PREVIOUSLY

I get an error while compiling: “Message: This item does not exist. File: RBXML Location: rdsToolbar.btn_width”. Sad panda.

my Bad… I had left a tag from my debug/tracer in the code when I uploaded it.

Replaced it with a tested version… should be ok now… sorry bout that.

The regular Xojo ones do that, and aren’t they native? See:

I just wrote an article on Toolbars for the new issue of xDev and I’m very interested in your class, Dave. Haven’t had a chance to try it out yet, but I will.

The native toolbar that WAS in my app (just replaced it with my new class) did NOT do that…

Just for curious… why the button and radiobuttons to change your toolbar display… just Rightclick …

The screenshot is of the demo app I wrote for my article, hence the controls to test various features. It’s not a “real” app. :slight_smile:

I just checked… and dang you are correct…

Now to figure how to handle the embedded controls if they go off screen.
Not something the native toolbar has to worry about …

Could this be something that’s changed with Xojo recently? Like it didn’t do that with R1 or something?

Still need some testing… but I just updated my toolbar to have SCROLLING buttons… this behaviour is DIFFERENT than the native toolbar.
If the window is smaller than the width of the toolbar… then it will display a “>>” … clicking this scrolls the toolbar… and a “<<” will appear at the left side … This makes it easier to contend with the embedded controls.

Dave,
This is looking great.

It doesn’t come with a built-in option to allow the user to pick his own toolbar items, though, as it’s possible with the native OSX toolbar, or does it? It’s quite some work to get that done, unfortunatly.

A tip for Retina: if you have a Mac with a decently large monitor (1920x1200 the least, the higher the better), you can turn it into Retina display more. There’s quite a few hints to find on this. In Retina mode, your display will then switch to HiDPI mode, thereby turning your 1920x1200 display into 960x600. Everything will be 4 times as large, but you can immediately spot what draws in full resolution in that mode and what not. For instance, Xojo apps will not draw at 2x by default. You have to (a) build as Carbon and (b) add this line as a Build Automation Script for OSX:

[code] const key = “NSHighResolutionCapable”
const keyType = “bool”
const value = “true”

dim infoPlistPath as string = CurrentBuildLocation+"/"""+CurrentBuildAppName + “.app/Contents/Info.plist”
dim cmd as string = “/usr/libexec/PlistBuddy -c ““Add :” + key + " " + keyType + " " + value + “”” " + infoPlistPath + “””"
dim result as string = DoShellCommand(cmd)

if result <> “” then
print “PlistBuddy not installed. This tool is necessary for the UpdatePlist script to function properly.”+EndOfLine+EndOfLine+cmd+EndOfLine+EndOfLine+result
end[/code]

And enable the script for both Debug and Release. Then you can hit “Run” and see all in its Retina glory.

It doesn’t… and won’t.
As a matter of fact, the best I can tell… the Xojo version SHOWS the customize pallete… but doesn’t really allow you to do much. As there is no way that I have seen to add addtional buttons to choose from etc. I’m sure there are with declares, but then we start to diverge from XPlat. Also since mine allows embedded controls… I think that makes the trade off worth while.

When Xojo can support a toolbar where all the features work in all the OS then I will happily remove this class from my projects and install a proper native one. But right now… mine does 5 things that I need that Xojo Native Toolbar cannot

  1. Flexible space on OSX and WIN (Xojo on OSX only)
  2. “Checkbox” style button behaviour on OSX and WIN (Xojo on Win only)
  3. ability to embed Popup,Combo or Textfields into the Toolbar Area
  4. a VISIBLE property on each individulal button (Xojo : not at all)
  5. ability to change the attribute of any button on the fly (Xojo ; must destroy/rebuild)

Hi Dave,
where can I buy the license? there’s no link on your site…

Luciano