Some insight about REALbasic toolbars
By Thom McGrath on
So upon looking into a new rewrite of HIToolbar, I've wanted to hit at least one of two incredible features: controls-in-toolbars and cross-platform toolbars.
Focusing on the latter in this post, I said to myself "If REAL Software can do it, then there is no reason why my class cannot do the same."
This statement, as it turns out, is incorrect.
After struggling to find the content I was looking for on MSDN, I finally found it. Windows toolbars support many of the same conventions as the Mac OS X HIToolbar & NSToolbar. The more I looked into it, the more I thought I could certainly make a completely new HIToolbar that wrapped both the Mac OS X HIToolbar and the Windows Toolbar.
So I started reading on how to actually accomplish this and got defeated right from the get go.
Windows Toolbars are created using the CreateWindowEx function. Basically, the toolbar needs to be created at the same time as the window. Since REALbasic does not open the functionality to me in any way, it seems I've been shot down before even starting.
Well, not completely. But it'd be awkward. I could have the developer place an RB Toolbar on the window, and then my class could work with it and control it's content. But it's not worth it.
This does, however, explain why we cannot create or remove the RB Toolbar in code. Once again, Windows ruins the fun for all of us. The developers of the REALbasic team found a way to make it work, but it certainly feels like a hack. I'm certain that toolbars in REALbasic would be completely different if Windows could create and assign toolbars to active windows on-the-fly, just like Mac OS X can. But it can't.
However, there still is no reason that the RB Toolbar cannot support customization (unless it is Linux holding them back - I don't know). Both Windows and Mac OS X support it. Both the Windows and Mac OS X toolbars are very similar, and support similar view styles - despite being named differently.
So what is the next option for cross-platform using HIToolbar? Well, in the next version, I'm experimenting with replacing the RB Toolbar at runtime. See, the idea is that the developer will create an RB Toolbar and work with it like normal. On Windows, it works. On Mac OS X, the developer would call a simple routine that would replace the toolbar with one of mine. In theory, this will work. In practice, I don't know yet.
I'm also thinking about renaming HIToolbar. Soon (hopefully in 2008 according to Geoff Perlman), it will become a wrapper for both HIToolbar and NSToolbar. And if true cross-platform ever happens, the name will be very wrong. It's also strange for terminology sake. But I really like the idea of HIToolbar 2, and not alienating my existing users.
And lastly, I'm learning to create REALbasic plugins. I know I can do it, but the documentation is awful and outdated. My goal is to make HIToolbar 2 a plugin, which will allow me to interact with the OS more naturally - rather than some of this crap I have to do now. I'm also far more likely to be able to support controls-in-toolbars this way than without. I've tried. I've already rewritten HIToolbar (this rewrite is cool, but not public and never will be) with this feature nearly working - but it just doesn't.
So that's my "state of the toolbars" address. I'm still interested in completing REALSyndication and progress moves on that slowly. The task is extraordinarily daunting and boring. And I'll leave you with a nugget of interest. I've been interviewing with REAL Software for the past month. I've talked to many important names, starting with Geoff Perlman and then Mars Saxman. My last interview was with the REALbasic team - Aaron Ballman, William Yu, and Mike Bailey.
I found out yesterday that I would not be helping as their new Mac OS developer. I understand though, as I have no formal training or experience. I still feel I would be an excellent member of their team, but I respect and understand their decision.