Loading ".nib" Files for Customized Interfaces

Mac OS X only

This feature is available under Mac OS X only.

breve offers basic support for loading customized ".nib" files to give more customized interfaces to simulations. Users can design a customized window of controls (like buttons, sliders, checkboxes, etc.) and load it when the simulation is run. This feature is only available on the Mac OS X version of breve.

In order to build customized interfaces, the Mac OS X development tools including "Interface Builder", must be installed. A basic understanding of Interface Builder is also very helpful.

To implement a customized interface for your simulation, follow the following steps:

When the user interface element with the corresponding tag is activated, these methods will be called with the string value of the interface element. In the case of most types of controls, like buttons or sliders, you'll generally want to use the string value as a number to set some parameter.

Creating ".nib" Files Without Using the Included Template

It is best to use the included template for creating your own custom nib files because the process for creating them from scratch can be a bit confusing. Nevertheless the process is described below for those who are curious:

  • Launch interface builder

  • Create a new "Cocoa, Empty" nib file

  • In the document window, click on the "Classes" tab

  • Control-click on "NSObject", select the menu entry "subclass NSObject". A new object called "MyObject" will appear--rename this object to "slBreveNibLoader"

  • With the slBreveNibLoader object selected, bring up the info window with Command-1

  • In the "Outlet" tab of this window, click add. Name the new outlet "window".

  • Click back to the "Instances" tab of the project. Click on "File's Owner", and type Command-5 to bring up the "Custom Class" inspector. Find the object "slBreveNibLoader" from this list and select it.

  • Go back to the "Instances" tab of the project. From the "Cocoa Views" palette, drag a "Window" object to the "Instances" area.

  • Select the "File's Owner" icon. Control-click and drag from the "File's Owner" icon to the icon of the newly created window.

  • In the "File's Owner" info window that appears, select the item "window" and then click on the connect button.