|
GUI Objects A graphical user interface (GUI) has four main types of graphical components: windows, dialogs, controls, and menus. You can lay out all these GUI objects with XVT-Design. XVT-Design also constructs the C-language source code to manage the objects. Portable Resources
XVT-Design transforms your WYSIWYG layout of GUI objects into a portable resource language called URL. Since the URL code is portable, you need only use XVT-Design to generate it once. You can compile the URL code to any supported native resource format. XVT's curl compiler translates URL resource specifications into the native resource language. The native resources are bound to the executable program, either by loading the resources directly into the executable image or by creating a resource file with a canonical name. (Native environments use differing methods to bind resources.) Universal Resource Language (URL) file
This file defines the external resources of the project. You can inspect these files, or change their names, by choosing Generate Application from the File menu. Note: The project file does not display when you choose Generate Application. The prefix of the project filename matches the name of the project, but you can configure its suffix in XVT-Design's configuration file. Events XVT bases its Portability Toolkit on a set of abstract, portable event representations. These deliver user and GUI system event data to GUI objects within your application. Each type of event is represented by a tag in the Action Code Editor. Developers generally use the Action Code Editor to enter calls to functions (defined in external source files), which are executed in response to particular events. Event Handlers An event handler is a function with the proper prototype for receiving events, meaning that it accepts a WINDOW and an EVENT as arguments. Most windows, and all dialogs, must be assigned an event handler to process the events generated during their lives. The exception is the screen window, which has no event handler because it receives no events. Windows can have unique event handlers, or multiple windows can share a common event handler. GUI Object Attributes All the GUI objects provided by the XVT Portability Toolkit have a number of attributes that describe their appearance and behavior. For example, windows might be sizeable or iconizable, or might contain scrollbars or titlebars. XVT-Design allows you to set the values of GUI objects interactively, rather than specifying them programmatically. Geometry
Rectangles specify the size and position of windows, dialogs, and controls. Instead of describing the size and position of objects in resource-description text files, XVT-Design lets you create and modify objects graphically.
Title
All objects have a title string, which is the name of the object from the application user's point of view. The object may or may not have a visible title, depending on the type and conventions of the native windowing system. (For instance, document windows and buttons almost always have visible titles, but scrollbars do not.)
Symbolic Identifier
Objects have a second string that is used by the application developer, rather than the user. This symbolic identifier string lets you refer to the object with a symbolic name, instead of its resource ID number. The symbolic identifier string associates a symbolic name with the ID number that is used in the resource file.
Other Attributes
Each type of object has additional attributes, specific to its type. For instance, windows have attributes that describe their border decorations, and menus have attributes that specify acceleratorand mnemonic keys. User Interface Code In addition to creating resources graphically, XVT-Design helps you create the program code for your application's user interface objects. Integrated Code Editing
XVT-Design's Action Code Editor (ACE) lets you create and edit your user interface source code without leaving XVT-Design. This ensures that the code you enter is preserved as part of the interface definition.
Tip: XVT recommends putting only small fragments of source code into your project with the Action Code Editor and putting the bulk of your user-written code in external files. Structural Code
XVT-Design creates event-handling functions and other code that produces a structure for your application's user interface. Rather than writing your event handlers and other "generic" code from scratch, you can use XVT-Design to generate this code for you.
Note: While using XVT-Design, you do not actually see the structural code. The code you create is integrated with the structural code when XVT-Design generates The source code files for your application. Tags
XVT-Design assigns two types of tags to your user interface objects: event tags and special tags.
- Event tags - All user interface objects have a number of associated events, that is, occurrences that the application responds to. XVT-Design assigns event tags to these events. The event tags correspond exactly to the E_* events defined in the XVT API. Each object also has a number of special tags.
- Special tags - Special tags do not correspond to any runtime events, but are "markers" in the generated code for an object. They indicate positions in the framework where you may want to insert your own code. For instance, the Var Decl special tag marks a location appropriate for declaring local variables for an object's event handler.
Action Code
Action code is C source code that implements some action in response to an event. You add action code to your application with the Action Code Editor. XVT-Design incorporates it into structural code when generating your application?s source code files.
Context
Action code is always associated with a specific context. In most cases, the context represents an event generated by a specific action or specific user interface object. (If the context includes a special tag, it represents a place for you to insert code not related to an event, for example allocating or releasing dynamic memory.)
A context is composed of three parts: - Module - A module is a user-interface component that contains other components. Windows, dialogs, menubars, and the application itself are all modules.
- Object - An object is one of the components contained by a module. Controls and menu items are objects. In XVT-Design, modules are also considered to be objects (in a sense, they contain themselves).
- Tags - Every object has one or more tags (event or special), as described above.
The unique combination of a module, an object, and a tag makes up a context. Three list buttons in the Action Code Editor specify the context for action code. TestMode XVT-Design's TestMode lets you view an application's user interface without compiling and linking source code. As a result, you can rapidly refine the appearance of user interface objects without leaving XVT-Design. Connections Rather than interpreting or executing an application's source code, XVT-Design's Test Mode defines relationships between objects by using connections. Like action code, connections are associated with tags. A connection opens or closes a container (window or dialog) when a tag's event occurs. Connections can also invoke XVT's predefined dialogs, such as the standard open-file and save-file dialogs. External Source Code You can include other source code modules into an XVT application by adding them to your XVT-Design project. To do this, choose External Files from the File menu. XVT-Design includes any files specified in this way when it generates the makefile. Tip: XVT recommends the following approach to adding your code to the default c-language structural code supplied by XVT-Design: - Write functions in external files to hold any large blocks of action coder.
- In the Action Code Editor, place calls to the functions that you defined in external files.
- Then, using the External Files option from the File menu, tell XVT-Design to include the external files in the makefile.
XVT recommends this approach for several reasons: - It supports modularity
- It keeps the code generated by XVT-Design simple and free of errors
- It keeps the code that is more apt to be changed and added to during the application's development external to the XVT-Design project
- It lets you edit external code without modifying the XVT-Design project file
Note: With XVT-Design, you can edit the generated files using a text editor and later recover code from inside of XVT-Design. If you check the Code Recovery checkbox in the Project Attributes dialog, code fragments are enclosed between special comments in the generated code. You can edit the code between the comments using a standard text editor. Then click on a "Recover Code" button to recover all the changes you have made to the generated files. XVT-Design Files Your XVT-Design project file, a portable, binary file, contains the layout, GUI objects, action code, and configurations made within XVT-Design. In addition, XVT-Design generates the following files: Module Source and Header Files
XVT-Design generates source (.c) files and a header (.h) file for the application module (task window), and for each window, menubar, and dialog in the project.
Makefile
XVT-Design generates an application makefile, using a template appropriate for the Platform/compiler. You select the template from a list in the Generate Application dialog.
Universal Resource Language (URL) file
This file defines the external resources of the project. You can inspect these files, or change their names, by choosing Generate Application from the File menu.
Note: The project file does not display when you choose Generate Application. The prefix of the project filename matches the name of the project, but you can configure its suffix in XVT-Design's configuration file. |