Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 19 in printed book and digital formats -- plus a one-year subscription (beginning with 20.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 5.5


Toolbar Utilities

Issue: 5.5 (July/August 2007)
Author: David Mancuso
Article Description: No description available.
Article Length (in bytes): 3,757
Starting Page Number: 10
Article Number: 5507
Related Web Link(s):


Full text of article...

Toolbar Utilities began as a thread on the REALbasic Network User's Group mailing list (the NUG). The email discussion thread was about setting window toolbar modes. OS X users expect the window title bar toolbar widget (I call it the "tic-tac") to be able to remember the modes of the toolbar. For instance, clicking the widget hides the toolbar, and Apple-clicking the toolbar cycles through icon, text, and icon and text modes. REALbasic apps use the tic-tac, but you can't get the state of the toolbar and use it later. The question on the NUG list was essentially "How do we get access to this state and use it?"

The discussion resulted in some examples from Thom McGrath and Charles Yeomans. They showed how declares could add this toolbar mode functionality to REALbasic applications. Brad Rhine felt that the tips should be bundled into a module, so he created Toolbar Utilities and posted it on his website as open source. The posted module is ready to drop into a project and use immediately. It requires REALbasic 2006r2 or greater.

The module contains eight methods. One method lets you cycle an application's modes from Icon Only to Text Only and then Icon and Text. Another method lets you set icons to large and small icon size. Default, a third available size, is effectively the same as large (it's in the toolbar framework, just not used at this point). You can also set toolbars to be visible or not visible for each window. Finally, you can turn the title bar widget on or off in windows so that it's gone completely if you wish. You can get or set properties for each of these behaviors. Most importantly, you can save the state of the toolbar and bring that state back when you reinstantiate a window in your app.

Toolbar Utilities comes with documentation notes in the module. They explain what the methods do and how to call them. The declares themselves are straightforward and easy to use.

The methods work for Mac but won't provide any functionality for Windows or Linux platforms, since they're all declares to Carbon. In the future, it's hoped that the module can be expanded to include Windows and Linux functionality. While there's no toolbar widget on those platforms, the ability to get and set toolbar properties is still desirable. As Toolbar Utilities is an open source project, contributors to development are welcome.

Toolbar Utilities is a great leveraging of REALbasic community resources. The NUG list and the REALbasic forums are valuable places to find these nuggets of code. It's nice to see developers pulling these tips and providing them in a ready to use format. Hopefully we'll see more packaged modules and classes like Toolbar Utilities.

End of article.