How do you instantiate a Toolbar in code?

  1. ‹ Older
  2. 4 months ago

    Jean-Yves P

    Jun 10 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    @Kristin G Yes. Thank you. I'm fully aware of what Active Record is and it is a great idea for an environment such as PHP where you might use MVC... but Xojo wasn't built that way. We shouldn't have to use AR in Xojo. Why would I go and type all my field names a second time into a class that describes my object? The window itself should do that. It has a text field for each property into which I can add validation, store the value, and until recently... bind it to a column in a database.

    I did it for my apps, making a database editor app, that copies windows items from the database definition, and paste it in the xojo ide. took me some time to build it, but now it works fine and gives me a lot of flexibility in programming database windows.

  3. Norman P

    Jun 10 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Kristin G Was that not the original vision of Realbasic?
    "Programming for the rest of us"

    In many ways I would say it is true - just not in the way you're imagining
    Its not writing C/C++/Obj-C/Java which IS the norm

    I have literally been using it since before version 1.0 shipped in 1998 and I dont recall it ever having been presented or promoted as what you envision which seems more like Filemaker/Access but with a lot lower level coding ability when needed

    Thats not to say it couldnt have components that make that kind of work easier.
    Just that they dont

  4. @Norman P I have literally been using it since before version 1.0 shipped in 1998 and I don't recall it ever having been presented or promoted as what you envision

    From the User Guide ...

    Welcome to Xojo, the easiest tool for creating your own apps. Xojo is made up of a rich set of graphical user interface objects, a modern object-oriented language, an integrated debugger, and a multi-platform compiler. Together they make up the Xojo Integrated Development Environment or IDE.

    With the IDE, you can build your app's interface simply by dragging and dropping interface objects onto the apps’s windows and dialogs. In this QuickStart, you will see how easy it is. Xojo provides you with all the tools you need to build virtually any app you can imagine.

    You'll have to forgive me if I imagined an app more complex than Eddie's Electronics.

  5. Norman P

    Jun 10 Pre-Release Testers, Xojo Pro great-white-software.com/blog
    Edited 4 months ago

    "build the interface" - not "build your app"

    Maybe that should say "layout your interface" instead of "build your interface" so you dont get fooled into thinking that building the interface IS how you build the entire app

    Xojo is not a zero-code tool
    Never has been and has never been sold as such

    Its just not Xcode, interface builder etc

    FWIW the IDE is built using Xojo

  6. @Norman P "Xojo is not a zero-code tool. Never has been and has never been sold as such

    I never expected zero code but is it not the goal of a 'RAD' application to reduce the amount of code necessary? Xojo's own website claims to have Native Controls that allow you to quickly build your interface. Isn't a date picker part of the interface?

    I remember that one of the big complaints about RB from VB users was the lack of available controls and pre-built code compared to what they were used to. At the time, I assumed that RB would eventually catch up but it's been 20 years and we still only have TextField and PasswordField.

    Far be it for me to say what Xojo should be or shouldn't be but as an ex-FMP developer and someone who has struggled to master Xojo over the years, if the goal is to provide RAD to casual programmers, yeah... we could do with a bit more FileMaker.

  7. Julian S

    Jun 10 Pre-Release Testers, Xojo Pro UK

    I might be missing something obvious has I've not read every word of this thread, but why don't you have a container control for each "table view" then just use embedwithin to dynamically pull in the container relating to the table you're currently viewing? You can then have your primary window with your toolbar and your containers with have the logic for each "view" and with a simple bit of code to dynamically alter the toolbar buttons relating to each container?

  8. Norman P

    Jun 10 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Kristin G I never expected zero code but is it not the goal of a 'RAD' application to reduce the amount of code necessary? Xojo's own website claims to have Native Controls that allow you to quickly build your interface. Isn't a date picker part of the interface?

    I'm the wrong person to ask
    I dont work there or speak for them

    You should address this to @Geoff P

  9. @Julian S I might be missing something obvious has I've not read every word of this thread, but why don't you have a container control for each "table view" then just use embedwithin to dynamically pull in the container relating to the table you're currently viewing? You can then have your primary window with your toolbar and your containers with have the logic for each "view" and with a simple bit of code to dynamically alter the toolbar buttons relating to each container?

    I had considered this. I'm not saying 'no'... I just wish that I had a RAD tool that didn't make me jump through such hoops.

    Thanks for the input. It is appreciated.

  10. Bob K

    Jun 10 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City
    Edited 4 months ago

    @Kristin G] Isn't a date picker part of the interface?

    I've been part of the community for close to 18 years. There are two controls that practically everyone wants day one: Date Picker and a Grid Control. For the former I'd recommend going to Einhugur. For the latter I'd recommend using the PiDog DataView control (to be fair, the Listbox is quite powerful but it's not out-of-the-box powerful.

    It is *sad* that these controls are not part of Xojo since, as you said, Xojo's website claims to have native controls to quickly build your interface. I wonder how many developers skip Xojo because it doesn't have a native Date or Grid control?

  11. Michel B

    Jun 10 Pre-Release Testers, Xojo Pro RubberViews.com

    Kristin, no offense, but you seem to be mentally pretty rigid about what you expect Xojo to be.

    Since I started back in 1982, I programmed in several languages, and each of them have limitations.

    Right now, I use another language than Xojo to develop an Android app. There are limitations to it, but instead of blaming the conception, I use imagination and try to make due.

    About imagination, precisely, just run the attached project. It should satisfy what you were after. On Mac, it adds a toolbar dynamically very nicely.

    DynamicToolbar.xojo_binary_project

  12. @Michel B Kristin, no offense, but you seem to be mentally pretty rigid about what you expect Xojo to be.

    No offence taken, sir. I'm not sure that 'rigid' is the correct term though. I have certain expectations about what Xojo is supposed to be based on the marketing... but perhaps I'm wrong about that and I need to reset my expectations?

  13. Markus W

    Jun 10 Pre-Release Testers #JeSuisHuman New Zealand, Auc...
    Edited 4 months ago

    @Kristin G No offence taken, sir. I'm not sure that 'rigid' is the correct term though. I have certain expectations about what Xojo is supposed to be based on the marketing... but perhaps I'm wrong about that and I need to reset my expectations?

    Expectations lead to disappointment. Disappointment leads to anger. Anger leads you to the Dark Side …

    ;)

  14. James D

    Jun 10 Pre-Release Testers, Xojo Pro Europe (Switzerland)

    @Kristin G I had considered this. I'm not saying 'no'... I just wish that I had a RAD tool that didn't make me jump through such hoops.

    Thanks for the input. It is appreciated.

    Out of interest how many other RAD tools have you used to build full blown application? Every RAD tool I have ever used had one thing in common - they do not allow you to do things your way! You need to follow the philosophy of the tool to be successful.

    In an app I’m working on at present I have around 10 different container controls that are used to edit and display data from about 300 tables. They interact with the main window via a set of events and a common interface. Events are used to get the main window to enable buttons on the toolbar for importing or exporting data etc and the main window calls methods on the common interface to cause the container to refresh the data and so on. I understand this is a common approach in XOJO to do solve this problem.

    At the end of the day you will have to decide if you are going to go with the philosophy of the RAD tool you select, XOJO or something else, or opt for an all purpose language and acceptance the associated drop in productivity.

  15. @James D You need to follow the philosophy of the tool to be successful.

    I could not agree more! Perhaps I misunderstood what the Xojo philosophy was?

  16. @Michel B About imagination, precisely, just run the attached project. It should satisfy what you were after. On Mac, it adds a toolbar dynamically very nicely.

    Yes it does! I never considered putting it within a ContainerControl like that but you are correct, it can now be instantiated via code... however, I still can't seem to interact with it. For example, if you add a second button that enables one of the buttons in the toolbar, the IDE complains and says that the object does not exist... which is true as it won't exist until runtime. Unless I'm doing something wrong, I don't think this is the answer I was looking for.

  17. @James D In an app I’m working on at present I have around 10 different container controls that are used to edit and display data from about 300 tables. They interact with the main window via a set of events and a common interface. Events are used to get the main window to enable buttons on the toolbar for importing or exporting data etc and the main window calls methods on the common interface to cause the container to refresh the data and so on.

    I'm new to ContainerControls but I'll give this a shot. Thanks!

  18. @Michel B ... just run the attached project. It should satisfy what you were after. On Mac, it adds a toolbar dynamically very nicely.

    I take it back... I had to reference the Toolbar within the Container and I had to ensure that it's scope was public... but this worked and did exactly what I was trying to do. Thank you! :-)

    Sub Action() Handles Action
      CC1.Toolbar11.SaveButton.Enabled = True
    End Sub
  19. Dave S

    Jun 10 San Diego, California USA

    @Markus W Expectations lead to disappointment. Disappointment leads to anger. Anger leads you to the Dark Side …

    ;)

    The Dark Side leads you to Tattoine

  20. Michel B

    Jun 11 Pre-Release Testers, Xojo Pro RubberViews.com

    @Kristin G Yes it does! I never considered putting it within a ContainerControl like that but you are correct, it can now be instantiated via code... however, I still can't seem to interact with it. For example, if you add a second button that enables one of the buttons in the toolbar, the IDE complains and says that the object does not exist... which is true as it won't exist until runtime. Unless I'm doing something wrong, I don't think this is the answer I was looking for.

    This demonstrates that with some creativity, many things considered impossible are in fact doable. That is what I call flexible thinking. Or creative, if you will.

    There is no perfect tool, that explains the profusion of languages. Xojo may not be perfect, yet it is good enough to have permitted a lot of people to be successful. Including myself.

    About how to interact with the toolbar embedded in the Container Control, you need to make it available from outside of the container control. You can add a property myToolbar as toolbar to the CC, and set it to the toolbar.

    You can also add toolbar events to the ContainerControl. See http://docs.xojo.com/RaiseEvent

    Or add event handlers to your toolbar in code. See http://docs.xojo.com/AddHandler

    A good deal of your frustration also comes from your relative lack knowledge of the tool. The more you use it, the more you discover.

    Another little detail, which has nothing to do with the piece of software : this forum is one of the few where you will not be looked down as a newcomer, but rather, members will do their best to help you get what you want to achieve (as I did).

    IMHO, priceless.

  21. Richard D

    Jun 13 Pre-Release Testers, Xojo Pro Europe (UK, London)

    @Michel B Kristin, no offense, but you seem to be mentally pretty rigid about what you expect Xojo to be.

    Since I started back in 1982, I programmed in several languages, and each of them have limitations.

    Right now, I use another language than Xojo to develop an Android app. There are limitations to it, but instead of blaming the conception, I use imagination and try to make due.

    About imagination, precisely, just run the attached project. It should satisfy what you were after. On Mac, it adds a toolbar dynamically very nicely.

    DynamicToolbar.xojo_binary_project

    thanks for the sample project, Michel

    ion my project, i used to include the toolbar on each for that i want to toolbar.

    now i just called the code to create the dynamic toolbar only when needed.

    So much more effecient!!!

or Sign Up to reply!