User Manual for wxBuilder 1.5 ____________________________________________________________________ Julian Smart Decision Support Group Artificial Intelligence Applications Institute 80 South Bridge University of Edinburgh EH1 1HN October 1994 Artificial Intelligence Applications Institute University of Edinburgh 80 South Bridge EH1 1HN Tel. 031-650-2746 Contents 1 Introduction 1 1.1 Status of wxBuilder : : : : : : : : : : : : : : : : : : : : : : : : : * * 1 1.2 Change log : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :* * 2 2 Creating a project with wxBuilder 3 2.1 Running wxBuilder : : : : : : : : : : : : : : : : : : : : : : : : : : 3 2.2 Setting up for a new project : : : : : : : : : : : : : : : : : : : : : * * 3 2.3 Creating a main window : : : : : : : : : : : : : : : : : : : : : : : 5 3 Procedures 6 3.1 Changing project and global settings : : : : : : : : : : : : : : : : 6 3.1.1 Project settings : : : : : : : : : : : : : : : : : : : : : : : : 6 3.1.2 Global settings : : : : : : : : : : : : : : : : : : : : : : : : 6 3.2 Using the object editor : : : : : : : : : : : : : : : : : : : : : : : : * * 7 3.3 Generating C++ : : : : : : : : : : : : : : : : : : : : : : : : : : : 8 3.4 Viewing the window hierarchy : : : : : : : : : : : : : : : : : : : : 8 3.5 Managing GDI objects : : : : : : : : : : : : : : : : : : : : : : : : 8 3.6 Creating a frame : : : : : : : : : : : : : : : : : : : : : : : : : : : * * 8 3.6.1 Subwindow tiling : : : : : : : : : : : : : : : : : : : : : : : 9 3.7 Creating a dialog box : : : : : : : : : : : : : : : : : : : : : : : : * *10 3.8 Creating a menu bar : : : : : : : : : : : : : : : : : : : : : : : : : 10 3.8.1 Hotkeys : : : : : : : : : : : : : : : : : : : : : : : : : : : : 11 3.8.2 Deleting a menu bar : : : : : : : : : : : : : : : : : : : : : 11 3.9 Creating a tool bar : : : : : : : : : : : : : : : : : : : : : : : : : :* * 11 i ________________________________________________________CONTENTS____ 3.9.1 Deleting a tool bar : : : : : : : : : : : : : : : : : : : : : : 12 3.10Creating a panel subwindow : : : : : : : : : : : : : : : : : : : : : 12 3.11Creating a canvas subwindow : : : : : : : : : : : : : : : : : : : : 13 3.11.1Displaying a bitmap : : : : : : : : : : : : : : : : : : : : : 13 3.12Creating a text subwindow : : : : : : : : : : : : : : : : : : : : : 14 3.13Creating a button item : : : : : : : : : : : : : : : : : : : : : : : : 14 3.14Creating a checkbox item : : : : : : : : : : : : : : : : : : : : : : 14 3.15Creating a listbox item : : : : : : : : : : : : : : : : : : : : : : : : * *15 3.16Creating a choice item : : : : : : : : : : : : : : : : : : : : : : : : * *15 3.17Creating a radiobox item : : : : : : : : : : : : : : : : : : : : : : 16 3.18Creating a message item : : : : : : : : : : : : : : : : : : : : : : : 16 3.19Creating a slider item : : : : : : : : : : : : : : : : : : : : : : : : * *17 3.20Creating a text item : : : : : : : : : : : : : : : : : : : : : : : : : * *17 3.21Creating a multi-line text item : : : : : : : : : : : : : : : : : : : 17 3.22Editing a window object's properties : : : : : : : : : : : : : : : : 18 3.23Deleting a window object : : : : : : : : : : : : : : : : : : : : : : 18 3.24Associating actions with events : : : : : : : : : : : : : : : : : : : 18 3.25Converting Windows resource files : : : : : : : : : : : : : : : : : 19 4 Code generation details 20 5 Resources 21 Index 22 ii 1. Introduction ____________________________________________________________________ wxBuilder is a tool for interactively building the GUI (Graphical User Interfac* *e) component of a wxWindows application. The user chooses and places frames, dialog boxes, subwindows and panel items, and wxBuilder generates appropriate C++ code for compiling with the wxWindows library on Windows or X. The user may then populate this skeleton program with further code to complete the application, or use the results as a design and prototyping aid. wxBuilder could also find use as a learning aid for a beginning wxWindows user, since there is a clear correspondence between GUI and C++ code. wxBuilder may also be used as a migration tool from straight Windows to wxWindows, by importing existing Windows resource (.RC) files (Windows ver- sion only). wxBuilder is not unique in the kind of facilities it provides, but it is the on* *ly known freely available tool to generate multi-platform code, and is the only one to support wxWindows. 1.1 Status of wxBuilder wxBuilder now compiles under Windows and Motif. An XView release is avail- able but there are problems related to multiple modal dialogs that will be fixed shortly. Under Motif, there is a problem with the `simulated' windows not always being drawn correctly; this is a tricky Motif-related problem. The current work-around is to move the simulated frame or dialog box, and the display will be refreshed correctly. Various facilities are planned for a later release, including: o one source file per window option o MDI support o command line parser generation o help file generation o wxCLIPS generation o extend repertoire of GDI objects, such pens, brushes and colours. o Output of RC files o Support for wxForm 1 ________________________________________________________CHAPTER_1___ 1.2 Change log Version 1.6 October 1994 o Add support for wxSlider o Changed `int' window styles to `long' o Added support for bitmap buttons. Version 1.5 October 1994 o Cured bug in conversion of Windows menu resource to wxWindows menu (menu items lost their parents). o First release of Motif version, with more stable Motif wxWindows imple- mentation. o Added ability to load bitmaps into canvases, for more detailed `simulation' of interfaces. o Added provision for extra (user-defined) library and include paths. o Improved UNIX and DOS makefile generation. o Solved several bugs (e.g. right-click editing of a window caused a crash). Version 1.3 June 1994 o File history now has names added to front of list o Added Cancel button to on-exit dialog box o Fixed delete bug wxRadioBox/wxListBox/wxChoice properties dialogs o Fixed bug which disabled loading on the first attempt o Fixed code generation bugs for X/Windows icons o Fixed OnSize code generation bug (statements in wrong order) o Fixed UNIX makefile generation bugs o Windows version no longer uses CTL3D since it seems to crash wxWin- dows programs on some PCs. Now uses CTL3DV2 instead. Version 1.2 May 1994 o Added file history o Some code generation bugs fixed 2 2. Creating a project with wxBuilder ____________________________________________________________________ This chapter guides the user through the main processes involved in creating a new application. 2.1 Running wxBuilder Run wxbuild.exe (Windows) or wxbuild (UNIX) with an optional project filename. Project files contain all information relevant to an application exce* *pt bitmap files and icons; their extension is .WXP (for wxWindows Project). Below is a screen shot of the main wxBuilder window, with a project already loaded. A menu bar is supplemented by a tool bar to accelerate certain com- mands. The object editor canvas displays a representation of the actual windows (also displayed, but not in the figure). This representation is used for creati* *ng, deleting, positiong, sizing and editing windows interactively, and the actual windows will immediately reflect these operations. Below the object editor canvas is a listbox containing a list of all top-level windows (all the frames and dialog boxes). Clicking on a window in this listbox creates the window and updates the object editor to show a representation of this window. The status line is divided into two fields: the left field displays help messag* *es, and the right field shows the current `mode', either edit or test mode. In test mode, certain events from project windows (such as pressing buttons or selecting menu items) will do the user-defined action, whereas in edit mode, the same events will pop up a dialog to allow editing of that action. An object palette is displayed in a sepearate frame. This allows selection of a window object (such as a canvas or button) - the cursor in the object editor window changes to a cross, and left-clicking in the object editor creates an ob* *ject of that kind. 2.2 Setting up for a new project It's wise to set things up properly before starting to create windows. The Project menu has two items you should look at: Edit project settings and Edit global settings. Project settings are saved with the project file and are changed on a per-proje* *ct basis. These include project name (used as a base for generating files), and project directory name. 3 ________________________________________________________CHAPTER_2___ Figure 2.1: Main wxBuilder window Figure 2.2: Object palette 4 ________________________________________________________CHAPTER_2___ Global settings are variables that are likely to change on a per-user basis, and are stored in WIN.INI (under Windows) or .Xdefaults (under X). Under X, the .Xdefaults file should be edited by hand, since the X versions of wxBuilder do not currently save global settings. See Resources (section 5) . In addition, set the name of the application class (to be used as a derivative of wxApp) and a brief description of the project, using the Edit application properties item on the File menu. 2.3 Creating a main window Every wxWindows must have a frame which is the main window (in C++, returned from the wxApp::OnInit function). The first frame you create is taken to be this main window. Choose Edit: New frame or click on the frame tool on the palette, and then on the object editor. You can size and position this frame using the representation on the object editor (try to resist the temptation to edit the real windows directly!). See Using the object editor (section 3.2) for further details. 5 3. Procedures ____________________________________________________________________ 3.1 Changing project and global settings 3.1.1 Project settings Project settings are saved with the project file and are changed on a per-proje* *ct basis. These include project name (used as a base for generating files), and project directory name. 3.1.2 Global settings Global settings are variables that are likely to change on a per-user basis, and are stored in WIN.INI (under Windows) or .Xdefaults (under X). Under X, the .Xdefaults file should be edited by hand, since the X versions of wxBuilder do not currently save global settings. These are the global settings. 6 ________________________________________________________CHAPTER_3___ Setting Description ________________________________________________________________________________ Windows compiler Set to the desired Windows compiler. At present* *, the only recognised compilers are Microsoft's C++ ve* *rsion 7, Visual C++ and the NT compiler. For other com* *pil- ers, please write the makefile by hand or use a * *Microsoft compatibility mode if available. UNIX compiler Type in the name of the UNIX compiler. The defau* *lt is gcc-2.1. X GUI target UNIX makefiles are generated with three targets,* * al- lowing simultaneous compilation of XView , Sun M* *o- tif and HP Motif binaries. This target s* *pecifies which one should be used for auto-compiling (not* * yet implemented). X includes Switches specifying where to find X include dire* *ctories. X libs Switches specifying where to find X library dire* *ctories. Extra includes (UNIX) Allows specification of extra include paths for * *UNIX makefiles. Extra libs (UNIX) Allows specification of extra library paths for * *UNIX makefiles. Extra includes (Windows) Allows specification of extra include paths for * *Windows makefiles. Extra libs (Windows) Allows specification of extra library paths for * *Windows makefiles. UNIX wxWindows directory wxWindows home directory under UNIX. Windows wxWindows directory wxWindows home directory under Windows. See also Resources (section 5) . 3.2 Using the object editor The object editor is the scrollable canvas in the main wxBuilder window. When a window is being edited, it is represented in the object editor as rectangles, each with the name of the object. To edit a window, you may create a new frame or dialog box, or click on a window name in the listbox on the main wxBuilder window, or click on a window name in the object hierarchy display (see Window hierarchy (section 3.4) ). Most windows may be repositioned by dragging with the left mouse button, selected and deselected with left click, and resized by dragging on the handles visible when the object is selected. 7 ________________________________________________________CHAPTER_3___ Each type of window has a property editor associated with it, allowing tailoring of specific window characteristics. To invoke a property editor, either right-c* *lick on the object, or select the object and choose Edit properties for selection from the Edit menu. To align panel items, select two or more items, and use an alignment tool on the tool bar. The first item selected is taken as the reference for aligning the other items. 3.3 Generating C++ Click on the C++ tool on the tool bar, or choose Generate C++ from the Project menu. A report window will be displayed with error and warning messages, and if successful, source files will be written in the current project directory. 3.4 Viewing the window hierarchy Click on the tree tool on the tool bar to view the structure of your interface. Left-clicking on a dialog box or frame will associate the window with the object editor. Right-clicking on any window in the hierarchy will invoke the appropria* *te property editor. 3.5 Managing GDI objects wxBuilder allows the user to define a set of GDI (Graphics Device Interface) objects to be used in a program. Currently only fonts are supported, but in future this will be extended to colours, pens, brushes, bitmaps, icons and curs* *ors. To define a set of fonts for the project, invoke the Font Manager from the GDI menu. Quit Quit from the Font Manager. Help Invoke help for the Font Manager. Add Add a font. Delete Delete the selected font. 3.6 Creating a frame Left-click on the frame icon on the object palette, and left-click again on the object editor canvas, or choose New frame from the Edit menu. The frame properties editor will be shown, with the following controls. Name The name of this frame instance. Description A textual description of the frame. 8 ________________________________________________________CHAPTER_3___ Class name The name of the C++ class that will be created for this frame. At present, each frame must have a unique class. Icon name The name of the icon file to be used for this frame. TitleThe default title for the frame. No. status line fieldsThe number of divisions for the status line. Zero indi- cates no status line. Vertical subwindow tiling If checked on, the subwindow tiling (section 3.6.1) is vertical. Otherwise it is horizontal. Thick frame If checked on, the frame has a thick border for resizing (Windows only). Caption If checked on, the frame has a caption (Windows only). System menu If checked on, the frame has a system menu (Windows only). Minimize button If checked on, the frame has a minimize button (Windows only). Maximize button If checked on, the frame has a maximize button (Windows only). Shuffle subwindows If pressed, the subwindow positioning order is rearranged. 3.6.1 Subwindow tiling The way in which subwindows are positioned and sized in wxWindows is very different from the method for panel items, dialog boxes and frames. This is because subwindows are often sized relative to their parent frame. If there is only one subwindow, the default wxWindows method is used, which is simply to resize the subwindow to the frame client area when the frame is created or resized. If there is more than one subwindow, wxBuilder uses an algorithm to layout the windows. It is hoped that this algorithm will cater for most subwindow layout needs. These are the options and constraints: 1. Zero or more subwindows may be children of a frame. 2. All subwindows must be tiled either vertically or horizontally. Mixture of the two tiling modes is not allowed (horizontal tool bars work indepen- dently and may be discounted from this constraint). 3. Each subwindow has a resize strategy, one of Fixed, Proportional and Grow. 4. The mix of resize strategies must be such as to allow wxBuilder to deter- mine all subwindow sizes. If the resize strategy is Fixed, the specified width (if in horizontal tiling m* *ode) or height (if in vertical mode) is used. The other dimension is determined by the size of the frame (and possibly the presence of a tool bar). 9 ________________________________________________________CHAPTER_3___ If the resize strategy is Proportional, the free dimension of the subwindow is determined from that dimension of the frame, together with the percentage specified in the subwindow property editor. If the resize strategy is Grow, the free dimension of the subwindow is determin* *ed by adjacent subwindows. In practice only one subwindow may use this strategy. 3.7 Creating a dialog box Left-click on the dialog box icon on the object palette, and left-click again on the object editor canvas, or choose New dialog from the Edit menu. The dialog box properties editor will be shown, with the following controls. Name The name of this dialog box instance. Description A textual description of the dialog box. Class name The name of the C++ class that will be created for this dialog box. TitleThe default title for the dialog box. Width The width of the dialog box. Height The width of the dialog box. Fit contentsIf checked on, the panel will fit itself to its contents. Horizontal labelsIf checked on, the default labelling orientation is horizontal, otherwise it is vertical. Label font The name of the font to be used for panel item labels. The font should have been created previously using the font manager, accessible from the GDI menu. Button font The name of the font to be used for panel item contents. 3.8 Creating a menu bar To create a menu bar for a frame displayed in the object editor, select the Edit menu bar option on the Edit menu. The Menu Bar Editor will appear with a large listbox for menu and item names, fields for editing text, and buttons below it for creating and deleting items. Menus List of menus and menu items. Name Contains the name of a new or currently selected menu item. Id Allows the user to specify the name of the menu item identifier, as used in a wxMenu::Append call. These names will be associated with integers automatically by wxBuilder. If the user leaves this field blank, wxBuilder will generate a suitable identifier. 10 ________________________________________________________CHAPTER_3___ Help string Allows the user to specify a help string which will appear on the status line when the mouse cursor is over that menu item (Motif and Windows only). New item Creates an item at the same level as the currently selected menu item. So, if the currently selected item is a menu called Edit, pressing t* *his button will create a new menu, not an item on the Edit menu. Note that you must fill in the fields before you press the button. New child Creates a child of the currently selected menu item, i.e. it creates a new submenu. So to create the first item of the Edit menu, select the Edit item and press this button. Note that you must fill in the fields before y* *ou press the button. New separator Creates a separator after the selected menu item. Delete item Deletes the currently selected menu item. Save item Saves the displayed values in the currently selected menu item. 3.8.1 Hotkeys To specify a hotkey, insert an ampersand (&) before the letter which serves as the hotkey (Windows and Motif). For example, E&xit. 3.8.2 Deleting a menu bar To remove the entire menu bar, delete the object in the usual way from the object editor (select the menu bar object and choose the Delete object option from the Edit menu). Alternatively, delete all the menus from the menu bar editor. 3.9 Creating a tool bar To create a tool bar for a frame displayed in the object editor, select the Edit tool bar option on the Edit menu. The tool bar properties editor will appear with the following controls. Name The name of this tool bar instance. Description A textual description of the tool bar. Class name The name of the C++ class that will be created for this tool barl. Rows/cols The maximum number of columns for this toolbar (set to a high number since only one row is allowed). Tools A list of the current tools in the tool bar. Id Contains the name of the identifier for a new or currently selected tool. wxBuilder allocates actual integer identifiers for these names automati- cally. 11 ________________________________________________________CHAPTER_3___ Help string Allows the user to specify a help string which will appear on the status line when the mouse cursor is over that menu item (Motif and Windows only). Bitmap The name of the bitmap file for the tool. A full path or extension should not be given; the project path will be prepended, and a .BMP or .XBM extension added as appropriate. Toggle If checked on, this tool will be a toggle tool. Add Press to add a tool to the tool bar. Note that you must fill in the fields before you press the button. Save Saves the displayed values in the currently selected toggle. Delete Deletes the currently selected tool. Demote Moves the selected tool to the end of the tool bar. 3.9.1 Deleting a tool bar To remove the entire tool bar, delete the object in the usual way from the obje* *ct editor (select the tool bar object and choose the Delete object option from the Edit menu). 3.10 Creating a panel subwindow Left-click on the panel icon on the object palette, and left-click again on the object editor, inside a frame object. The panel properties editor will be shown, with the following controls. Name The name of this panel instance. Description A textual description of the panel. Class name The name of the C++ class that will be created for this panel. Border If checked on, the panel will have a border. Resize strategy One of Fixed, Proportional and Grow. See subwindow tiling (section 3.6.1) . Width The width of the panel. Height The width of the panel. % frame If Resize strategy is Proportional, this value specifies the proportion of the frame for determining the subwindow size. Fit contentsIf checked on, the panel will fit itself to its contents. Horizontal labelsIf checked on, the default labelling orientation is horizontal, otherwise it is vertical. Label font The name of the font to be used for panel item labels. The font should have been created previously using the font manager, accessible from the GDI menu. Button font The name of the font to be used for panel item contents. 12 ________________________________________________________CHAPTER_3___ 3.11 Creating a canvas subwindow Left-click on the canvas icon on the object palette, and left-click again on the object editor, inside a frame object. The canvas properties editor will be show* *n, with the following controls. Name The name of this canvas instance. Description A textual description of the canvas. Class name The name of the C++ class that will be created for this canvas. Border If checked on, the canvas will have a border. Resize strategy One of Fixed, Proportional and Grow. See subwindow tiling (section 3.6.1) . Width The width of the canvas. Height The width of the canvas. % frame If Resize strategy is Proportional, this value specifies the proportion of the frame for determining the subwindow size. Bitmap The name of a bitmap file to be loaded into the canvas. Load Allows selection of a bitmap to be displayed in the canvas. Remove Clears the bitmap field. Retained canvas If checked on, the canvas will be retained under X. Pixels/unit X The number of pixels per logical X unit. If zero, no horizontal scrollbar will be shown. Pixels/unit Y The number of pixels per logical Y unit. If zero, no vertical scrollbar will be shown. No units X The number of logical units in the X dimension. No units Y The number of logical units in the Y dimension. Units/page X The number of logical units per horizontal page. Units/page Y The number of logical units per vertical page. 3.11.1 Displaying a bitmap A Windows bitmap (or GIF under X) may be displayed in the canvas. For code generation purposes, this facility should only be used if the wxImage library (* *X) or DIB library (Windows) is available at your site. 13 ________________________________________________________CHAPTER_3___ 3.12 Creating a text subwindow Left-click on the text subwindow icon on the object palette, and left-click aga* *in on the object editor, inside a frame object. The text subwindow properties editor will be shown, with the following controls. Name The name of this text subwindow instance. Description A textual description of the text subwindow. Class name The name of the C++ class that will be created for this text subwindow. Border If checked on, the text subwindow will have a border. Resize strategy One of Fixed, Proportional and Grow. See subwindow tiling (section 3.6.1) . Width The width of the subwindow. Height The width of the subwindow. % frame If Resize strategy is Proportional, this value specifies the proportion of the frame for determining the subwindow size. Text fileThe name of a text file to be loaded onto the canvas on creation. 3.13 Creating a button item Left-click on the button icon on the object palette, and left-click again on the object editor inside a panel or dialog box object. The button properties editor will be shown, with the following controls. Name The name of this button. Description A textual description of the button. Label Label for the button. Auto size If checked on, the button will size itself according the the text lab* *el. If off, the size will be determined by the interactively sizing the button from the object editor. Bitmap name If this field is used, the name (without path or extension) is used to denote the name of a bitmap to be used for the button. Under Windows, the extension .BMP is added to the name and this file is as- sumed to exist in the project directory. Under X, the extension .XBM is assumed (so mono bitmaps only) and the file is compiled into the program. 3.14 Creating a checkbox item Left-click on the checkbox icon on the object palette, and left-click again on the object editor inside a panel or dialog box object. The checkbox properties editor will be shown, with the following controls. 14 ________________________________________________________CHAPTER_3___ Name The name of this checkbox. Description A textual description of the checkbox. Label Label for the checkbox. Auto size If checked on, the checkbox will size itself according the the text label. If off, the size will be determined by the interactively sizing the checkbox from the object editor. Label position Horizontal, vertical or panel default placement. Under Win- dows the checkbox label is always horizontal. 3.15 Creating a listbox item Left-click on the listbox icon on the object palette, and left-click again on t* *he object editor inside a panel or dialog box object. The listbox properties editor will be shown, with the following controls. Name The name of this listbox. Description A textual description of the listbox. Label Label for the listbox. Auto size If checked on, the listbox will size according to wxWindows defaults. If off, the size will be determined by interactively sizing the listbox fr* *om the object editor. Label position Horizontal, vertical or default panel placement. Values A list of default string values. Value Text field for entering a listbox value. Add Add the text in the current field to the list of default values. Delete Delete the currently selected item. 3.16 Creating a choice item Left-click on the choice item icon on the object palette, and left-click again * *on the object editor inside a panel or dialog box object. The choice item properti* *es editor will be shown, with the following controls. Name The name of this choice item. Description A textual description of the choice item. Label Label for the choice item. Auto size If checked on, the choice item will size according to wxWindows defaults. If off, the size will be determined by interactively sizing the choice item from the object editor. Label position Horizontal, vertical or default panel placement. 15 ________________________________________________________CHAPTER_3___ Values A list of default string values. Value Text field for entering a choice item value. Add Add the text in the current field to the list of default values. Delete Delete the currently selected item. 3.17 Creating a radiobox item Left-click on the radiobox icon on the object palette, and left-click again on * *the object editor inside a panel or dialog box object. The radiobox properties edit* *or will be shown, with the following controls. Name The name of this radiobox. Description A textual description of the radiobox. Label Label for the radiobox. Auto size If checked on, the radiobox will size according to wxWindows de- faults. If off, the size will be determined by interactively sizing the r* *a- diobox from the object editor. Label position Horizontal, vertical or default panel placement. Rows/cols Number of rows or columns (depending on label orientation value). Values A list of default string values. Value Text field for entering a radiobox value. Add Add the text in the current field to the list of default values. Delete Delete the currently selected item. 3.18 Creating a message item Left-click on the message item icon on the object palette, and left-click again on the object editor inside a panel or dialog box object. The message item properties editor will be shown, with the following controls. Name The name of this message item. Description A textual description of the message item. Label Label for the message item. Auto size If checked on, the message item will size according to wxWindows defaults. If off, the size will be determined by interactively sizing the message item from the object editor. 16 ________________________________________________________CHAPTER_3___ 3.19 Creating a slider item Left-click on the slider icon on the object palette, and left-click again on the object editor inside a panel or dialog box object. The slider properties editor will be shown, with the following controls. Name The name of this slider. Description A textual description of the slider. Label Label for the slider. Auto size If checked on, the slider will size according to wxWindows defaults. If off, the size will be determined by interactively sizing the slider from the object editor. Min Value Minimum integer slider value Max Value Maximum integer slider value The current position of the slider will be used as the default value. 3.20 Creating a text item Left-click on the text item icon on the object palette, and left-click again on the object editor inside a panel or dialog box object. The text item properties editor will be shown, with the following controls. Name The name of this text item. Description A textual description of the text item. Label Label for the text item. Auto size If checked on, the text item will size according to wxWindows de- faults. If off, the size will be determined by the interactively sizing t* *he text item from the object editor. Label position Horizontal, vertical or default panel placement. Value Text field for the default text value. 3.21 Creating a multi-line text item Left-click on the multitext item icon on the object palette, and left-click aga* *in on the object editor inside a panel or dialog box object. The multitext item properties editor will be shown, with the following controls. Name The name of this multitext item. Description A textual description of the multitext item. Label Label for the multitext item. 17 ________________________________________________________CHAPTER_3___ Auto size If checked on, the multitext item will size according to wxWindows defaults. If off, the size will be determined by the interactively sizing * *the multitext item from the object editor. Label position Horizontal, vertical or default panel placement. Value Text field for the default text value. 3.22 Editing a window object's properties An object's properties may be edited by one of three methods. 1. Select the object with left click on the object editor, and choose Delete object from the Edit menu. 2. Right-click on the object in the object editor. 3. Left-click on the object name in the object hierarchy window. 3.23 Deleting a window object An object may be deleted by selecting it with left click on the object editor, and choosing Delete object from the Edit menu. 3.24 Associating actions with events In order to give the interface some dynamics, a small repertoire of actions is available for association with some events. For example, a menu command called Open report window might be associated with with the Open window action, to open another frame in the interface. To create an action, execute the event you wish to associate with an action. These events are currently: o Menu commands o Button depression o Tool depression You will be presented with a list of possible actions. Once you have chosen an action, the appropriate action editor is invoked. The next time you invoke the event in Edit mode, the action editor will be presented. You may delete the action using the Delete button. In Test mode, the event will cause the appropriate action to be executed. Currently, only one action per event is allowed. A later release of wxBuilder may allow multiple events, so (for example) an event could cause a window to be opened and a file to be loaded. 18 ________________________________________________________CHAPTER_3___ Note that some actions are mandatory for a working C++ program to be gener- ated. For example, a modal dialog box with no action dismissing it will cause t* *he window to be uncloseable, which might require the user to quit the windowing system to recover. 3.25 Converting Windows resource files Menu bars and dialog boxes can be converted from Windows resource files, using Petr Smilauer's resource parser (Windows version of wxBuilder only). Menu bars convert well, but due to the differences between wxWindows panel items and Windows controls, dialog boxes convert less well. Use the Load Windows resources option from the Edit menu. This opens a dialog box from which .RC files may be loaded, or added to the existing database of resources. Once the resource file has been loaded, quit from this dialog and use the Convert menu bar or Convert dialog option from the Edit menu. 19 4. Code generation details ____________________________________________________________________ Some or all of the following files may be generated: o a header file (.H) o a main source file (.CC) o UNIX and DOS makefiles o a module definition file (.DEF) o a Windows resource file (.RC) For every frame, dialog box and subwindow, a class is generated, to allow cus- tomization for each window instance except for panel items. Frames, dialog boxes and subwindows are generated with data members for their contained windows. Pointers to all frame objects are held in the wxApp-derived class. The description property is used to document class declarations and definitions. If the user has specified actions for menu commands, buttons or tool bar tools, the appropriate wxFrame::OnMenuCommand members functions, wxToolBar::OnLeftClick member functions, or button callbacks are generated with working code, other- wise empty stubs (or case statements) are generated for the user to fill in. Platform-specific resource loading is dealt with using conditional compilation statements. 20 5. Resources ____________________________________________________________________ The following is a list of the WIN.INI or .Xdefaults resources associated with wxBuilder. Under Windows, the resources follow the [wxBuilder] section in WIN.INI. Under X, each resource name should be prefixed by wxBuilder. in the .Xdefaults file. 21 ________________________________________________________CHAPTER_5___ Resource Description _____________________________________________________________________ autoCompile 1 or 0. autoRun 1 or 0 (not implemented). compilerDOS The name of the compiler in the DOS/Windows environment. compilerUNIX The name of the compiler in the UNIX environment. xIncludes List of X include directories. xLib List of X include directories. extraIncludesX List of extra include directories (under UNIX). extraLibsX List of extra library directories (under UNIX). extraIncludesMSW List of extra include directories (under Windows). extraLibsMSW List of extra library directories (under Windows). wxDirUNIX wxWindows directory under UNIX. wxDirDOS wxWindows directory under DOS. mainX Main wxBuilder window X coordinate. mainY Main wxBuilder window Y coordinate. mainWidth Main wxBuilder window width. mainHeight Main wxBuilder window height. reportX Report window X coordinate. reportY Report window Y coordinate. reportWidth Report window width. reportHeight Report window height. treeX Tree window X coordinate. treeY Tree window Y coordinate. treeWidth Tree window width. treeHeight Tree window height. paletteX Palette X coordinate. paletteY Palette Y coordinate. 22