Special

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 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.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.3

REVIEW

SmartSplitter

Issue: 5.3 (March/April 2007)
Author: Toby Rush
Article Description: No description available.
Article Length (in bytes): 3,856
Starting Page Number: 10
Article Number: 5306
Related Web Link(s):

http://www.harryhooie.com/source/

Full text of article...

Window splitters -- controls that allow you to move a divider within a window, resizing or hiding the controls on either side of it -- are incredibly useful, and extremely simple to use. Trying to create one in a REALbasic application, on the other hand, is rather difficult; it quickly becomes clear that there is a tremendous amount of calculation and choreography that must take place to make one work. Perhaps the most difficult aspect of it is the fact that the control has to work in concert with all of the other controls in the window..

In this regard, Harry Hooie's SmartSplitter is a godsend. Not only is the control fully functional on Mac OS X and Windows, matching the interface expectations of both platforms, it's also free and open-source. The control's handle can be set to any of the various splitter handles commonly seen on this type of control, and will even work as expected inside tabpanels or groupboxes.

The most amazing thing about SmartSplitter, however, is the fact that it is indeed "smart"-- when placed in a window, the control will automatically sense its orientation and automatically resize nearby (i.e., within 5 pixels) controls. Absolutely no code needs to be added to other controls, and controls do not need to be reported to the SmartSplitter. SmartSplitter's algorithm automatically detects which controls should be affected by the splitter, and resizes them appropriately when the splitter is moved. Controls will even be hidden if the splitter is moved all the way in their direction, and they appear again when the splitter is moved back.

Using SmartSplitter involves a few simple steps. First, drag a SmartSplitter to the window and resize it to encompass the area you want to serve as a divider. Second, make sure that the controls in the window are locked appropriately (using LockTop, LockLeft, and so on). At this point, the splitter will act exactly as you'd expect without any more configuration or work... as long as you do not resize the window. To make the SmartSplitter resize-savvy, simply add a call to SmartSplitter.behave to the window's Resized and Resizing events.

SmartSplitter also allows for a tremendous amount of tweaking for special cases: the splitter's position (in pixels) and proportion (as a ratio) can be read and set, controls farther away than 5 pixels can be attached easily, specific control behavior (when it should disappear, how it should resize or move, and so forth) can be set, minimums and maximums can be enforced, and the splitter can be instructed to keep its proportion of window width when the window is resized.

SmartSplitter would be worth its price even if priced at $20 or so-- the actual price of $0 makes it an absolute steal for the power and flexibility it can give to any application.

End of article.