Hi everyone,
As I aways state, hobby programmer here. Looking for some assistance please.
I like to try and experiment a bit and am trying to implement the Toolbar project item. Double clicking it adds it to the project but not the window. I can see how to add buttons etc to the toolbar but cannot figure out how to make it appear on the window.
As so often happens, right clicking brings up nothing in help and there are no examples or YouTube vids that I can find (not obvious anyway). I can find it in the Documentation off the intro screen but, for a beginner/hobbiest, many times these are obscure and don’t help much (well, for me anyway), and I think are written for pros. (Makes it hard to learn tho).
Anyway, some starting hints/directions would be VERY much appreciated.
Assuming you already have your DesktopToolbar appearing in the Xojo IDE Navigator on the left-hand side (where you have added buttons, icons, captions, etc.).
You then display the Window you wish to add the toolbar to (you should see the “layout designer”).
Drag the toolbar from the left Navigator to the Window layout.
If successful, your toolbar should now appear across the bottom of the “Layout Designer” in a shaded band as an icon. The toolbar should also appear, I think, as a “Control” of the Window in the Navigator. Click the control version of the toolbar to enable editing any necessary properties.
I know it seems odd, but the toolbar does not appear graphically placed on the window, just in the shaded band across the bottom. You can however, if you need to make further changes to the toolbar (after dragging it to the Window), from it’s original location in the Navigator.
I think Xojo does it this way, because the idea of combining the toolbar designer and the window layout designer into one view would be too complicated.
Sure, but just before that, can I push you for 1 more bit of info please.
Now that I’ve added the toolbar, I can add an event for pushing the buttons and respond accordingly to the item passed in. That works ok for buttons but does not recognize if it is one of the list controls. How are they recognized?
I’m typing this away from my computer so I hope it makes sense.
Are you referring to a DropDownMenu on the Toolbar?
If so, you’ll need a MenuItemSelected event. If you want to see how its done and/or if people don’t answer quick enough here for you, there’s a few toolbar examples included with Xojo, if you Select File>New Project>Examples>Desktop>Controls>Toolbar the best starter one is ToolbarExample.xojo_binary_project.
Hi Julian, speed of replied is absolutely not an issue. Thanks for that, I’ll give it a try. Often I just need the starting points and then with the docs I can delve into the rest.
I know you guys are pros but one of the good things about being a hobbiest is the detective work to get stuff going. The thrill of the chase
Hey guys,
Just a follow up thought, and for my education, this control first goes into the “general” contents section of the app. You then drag it onto the window you want it on where it is moved into the controls section of that window and you then work with it like any other (with it’s own individual methods, events etc).
My question is, is there a technical reason for the messing around with the first steps or could it have just been put straight onto the window like any other item had they wanted to. Seems like an extra (non-intuitive for a beginner) step. But, happy to be informed if there is a reason for it.
Thanks Tim, I didn’t realise that. I thought it had to go through the 2 steps I mentioned. I do note tho that it only places a “copy” on the window and the original stays in Contents. It is from here that any buttons, lists etc are added. Is that correct? I don’t understand why, but that’s cool, as long as I know where everything is.
I’m not sure what Tim is referring to, but you can’t add a Toolbar directly to a Window without first adding it to the Project on the Navigator. It’s done this way because much like a MenuBar, the same Toolbar can exist on multiple windows so you create it once, then drag it onto the windows you want to use it on, then if you decide you need to make a change, you change it in one place and it changes on all the windows.