Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 8 of 18

Qlarity-Based Terminal Programmer's Reference Manual: Chapter 3 Messages and Message Handler Prototypes, pages 40 to 46

Pages 40 to 46 of 134, from Qlarity-Based Terminal Programmer's Reference Manual

The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the QSI Corp QTERM-G70

Page 40

28

QSI Qlarity-based Terminal Programmer’s Reference

Direct If immediate processing was specified, the return value is the return value of the UserDirectMsg() API function. If not immediate, the return value is ignored.

3.6 Direct Messages Direct messages are sent by the system to a specific object. They are similar to a direct user message except that they are sent by the system rather than the user application. The messages are enqueued in the message queue as are most other messages, but they are only passed to a single object when they are handled. The object must have a handler for the message. Message: MSG_COMM_ACCEPT comm resource can be obtained with a GetComMessageSource() API call. Handler Format: func (<errcode> as integer, <errmsg>[] as -> byte) handles MSG_COMM_ERROR [...] endfunc

Parameters: <errcode> An integer indicating what type of error occurred. <errmsg> A byte array containing an error message string. Message: MSG_ZENABLED

Description: This message is generated as the result of a successful call to the NetOpen() API function. When the network channel is opened, the associated communications resource is passed to the object that called NetOpen() via this message. The communications resource may then be used to transmit data using the Send(), Transmit(), and (for TCP channels) TransmitUrgent() API functions. The resource may also be used to register for the MSG_COMM_RECEIVE message. Handler Format: func <name> (<socket> as comm) handles MSG_COMM_ACCEPT [...] endfunc

Description: This message is a direct message sent by the system software to notify an object whether or not it is enabled back to root (this does not include the object’s enabled status). Any changes in the object’s enabled path to root generate this message. Handler Format: func <name> (<status> as boolean) handles MSG_ZENABLED [...] endfunc

Parameters: Parameters: <socket> A value of type “comm” that is associated with the opened network communications channel. (See section 4.1, “Communications Interface”.)

<status> Indicates whether the path to root is enabled (true = enabled to root). This does not take into account whether the object receiving the message is enabled. Message: MSG_SOUND_DONE

Message: MSG_COMM_ERROR Description: This message is generated when errors are detected with a network channel. An error code and an error message are passed to the object that opened the channel. In general, the network channel should be closed with a call to NetClose() in the MSG_COMM_ERROR handler. If necessary, the

Description: This message is issued by the system software when a sound event (note or sound) is generated by the PlayNoteNotify or PlaySoundNotify API functions has been completed. The object that receives this message is determined by the <obj> parameter passed to the PlayNoteNotify and PlaySoundNotify API functions. The <parm> parameter

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 41

QSI Qlarity-based Terminal Programmer’s Reference allows the application to determine which sound has completed. Handler Format: func <name> (<remaining> as integer, -> <parm> as integer) handles MSG_SOUND_DONE [...] endfunc

29

Refer to Chapter 10, “Advanced Design,” in the Qlarity Foundry User’s Manual for sample implementations of the functions. If you elect to have Qlarity Foundry generate an object “ready to operate in Qlarity Foundry,” handlers appropriate for most objects are included. Message: MSG_TOOL_ATTACH Description:

Parameters: <remaining> Number of sound events (notes and sounds) that remain to be played by the system. <parm> The identifier that was passed to the PlayNoteNotify or PlaySoundNotify API functions as the <parm> parameter.

3.7 Tool Messages Because objects may be completely defined by the user, Qlarity Foundry has no knowledge about the appearance or behavior of a given object. Therefore, the object itself must define its behavior for Qlarity Foundry development activities such as drag-and-drop, resize by dragging resize grips on a selected object, and so on. Tool messages are generated by the Qlarity Foundry system software to tell an object that these activities are taking place. The object must have message handlers for these events to properly function in Qlarity Foundry.

This message is sent by Qlarity Foundry when an object needs to be attached to a parent container, usually due to mouse activity in the object hierarchy window. The handler should call the Attach() API function using “<newparent>” as the new parent. Handler Format: func <name> (<newparent> as objref) handles MSG_TOOL_ATTACH Attach (me,<newparent>) [...] endfunc

Parameters: <newparent> A reference to the container to which the object should attach itself. Do not assign the “parent” property to “newparent” (i.e., do not do “parent := newparent”). This will be done in the MSG_TOOL_ATTACHED handler.

Tool message handlers must be enclosed in “#if _TOOL/ #endif” compiler directives. This only includes the handlers used during development with Qlarity Foundry.

This handler code will suffice for almost any conceivable object, because Qlarity Foundry first calls “attach,” but the object doesn’t have to attach.

Since the tool message handlers usually change the properties of an object, the system software must be informed that these properties have changed so that it can update its object data structures. This is the purpose of the Tool_Persist() API function. Tool_Persist() is a special API function (available only in Qlarity Foundry) that takes a property name as its only parameter. If Tool_Persist() is not called when a property is changed by a message handler, the change is not properly recorded in the application. Therefore, Tool_Persist() must be called once for each changed object property in a tool message handler.

Message:

If you use Qlarity Foundry to create the object, you have the option to create an object that already handles these messages in a manner appropriate for most types of objects.

MSG_TOOL_ATTACHED Description: When API functions that change Z-order [such as Attach()] are called, the requested change is scheduled. Because Zorder is critical to the proper functioning of the message handling system, the actual changes are postponed until the current message has been processed to completion. Therefore, it is not possible to know if an Attach() succeeded until the handler that called Attach() has finished executing. If the attach fails, properties that indicate an object's parent should not be changed. If the attach succeeds, then the property needs to be updated.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 42

30

QSI Qlarity-based Terminal Programmer’s Reference

The MSG_TOOL_ATTACHED message is sent when a successful attachment has occurred. The handler is responsible for updating any property that is affected by a change in parent. Handler Format: func <name> (<newparent> as objref) handles MSG_TOOL_ATTACHED parent := newparent tool_persist(parent) [...] endfunc

<dy> The change in the object y-position caused by the move. This code assumes that the object has properties “xpos” and “ypos,” which hold the current position of the object. Normally, the validation functions for these properties will handle updating the system software attributes, so “xpos” and “ypos” should be assigned using the validation assignment operator. The Tool_Persist() function is called once for each property that was changed. Message: MSG_TOOL_GETHANDLES

Parameters: <newparent> A reference to the container to which the object should attach itself. This handler code works for any object with an objref property named “parent” that holds a reference to the object's parent. Note that the strict assignment operator is used (to avoid calling a validation function that will likely call the Attach() API) and that the Tool_Persist() API function is called to inform the system software that the value of the parent property has changed. Message: MSG_TOOL_MOVE Description: This message indicates that the object has been moved in Qlarity Foundry (probably due to a mouse drag). The handler should update any properties relating to object position, call API functions to update the system software position attributes for the object, and call Tool_Persist() for any properties that have changed. Handler Format: func <name> (<dx> as integer, <dy> as -> integer) handles MSG_TOOL_MOVE xpos = xpos + dx ypos = ypos + dy tool_persist(xpos) tool_persist(ypos) [...] endfunc

Parameters: <dx> The change in the object x-position caused by the move.

Description: This message indicates that the object has been selected in Qlarity Foundry, causing sizing handles (resize grips) to appear on the outline of the object. The object designer has significant freedom to specify the number and location of the resize grips and the cursor that appears as the mouse cursor is positioned over the grip. The handler is passed references to three arrays that must be filled with the x-position, y-position, and desired cursor, respectively, for each grip. The handler should size the arrays to the number of grips that will be displayed on the object. Handler Format: func <name> (<xCoords>[ ] as reference to -> integer, <yCoords>[ ] as reference to -> integer, <cursors>[ ] as reference to -> GuiCursors, <closed> as reference to -> boolean) handles MSG_TOOL_GETHANDLES [...] endfunc

Parameters: <xcoords>[] An array that defines the x-position of each grip. <ycoords>[] An array that defines the y-position of each grip. <cursor>[] An array that defines the cursor type for each grip. <closed> A boolean value that determines whether a selection outline segment should be drawn between the last grip and the first grip (outline segments are always drawn between all other grips). A value of “true” causes the outline segment to be

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 43

QSI Qlarity-based Terminal Programmer’s Reference

31 drawn. This also indicates whether clicking inside the object will select it.

GuiCursors

GuiCursors is a standard defined type with the following possible values:

CSR_OBJFIXED

Use on first resize grip to indicate that the object cannot be moved by the mouse (in a fixed location).

CSR_DELETE

Cursor has a different color resize grip for selection. Resize grip cannot be dragged.

CSR_PLUS

Cursor has a different color resize grip for selection. Resize grip cannot be dragged.

GuiCursors CSR_UPDOWN

CSR_LEFTRIGHT

CSR_UPLEFT

Description Cursor has arrows pointing up and down. The resize grip can only be dragged vertically. Cursor has arrows pointing left and right. The resize grip can only be dragged horizontally. Cursor has arrows pointing diagonally up and left and down and right. The resize grip can be dragged in any direction.

CSR_UPRIGHT

Cursor has arrows pointing diagonally up and right and down and left. The resize grip can be dragged in any direction.

CSR_DOWNLEFT

Cursor has arrows pointing diagonally down and left and up and right. The resize grip can be dragged in any direction.

CSR_DOWNRIGHT

Cursor has arrows pointing diagonally down and right and up and left. The resize grip can be dragged in any direction. Cursor has four arrows pointing in all directions. The resize grip can be dragged in any direction.

CSR_ALL

CSR_BLOCK

Cursor appears as a block. The resize grip may not be dragged.

CSR_NONE

Cursor does not indicate the presence of a resize grip, and the resize grip is not drawn. The location cannot be dragged.

CSR_SELECT

Cursor has a different color resize grip for selection. Resize grip cannot be dragged. (Usually combined with CSR_NOLINETO.)

CSR_NOLINETO

Cannot draw a line between.

Description

CSR_NOLINETO and CSR_OBJFIXED are flags that should be combined with another flag using the “or” operator (e.g., cursor[2] = CSR_ALL or CSR_NOLINETO) The typical handler for this function has three local arrays (one integer array for x, one integer array for y, and one array of GuiCursors for cursors) with the dimension size indicating the number of resize grips. The array elements should be assigned to the desired values. The arrays are then assigned to xCoords, yCoords, and cursors, respectively. Since the parameters are references to arrays, the values assigned in the handler are passed back to the system, which uses the data to create the resize grips for the object. NOTE: The initial size for the parameters is 0 (zero) elements. Message: MSG_TOOL_MOVEHANDLE Description: This message indicates that one of the object's resize grips has been dragged in Qlarity Foundry. The typical response to this activity is to resize the object, although certain handles may be associated with other object properties. The handler should set object properties relating to size (or whatever property is associated with the dragged grip), call API functions to alter attributes in the system software (usually done in property validation functions), and call Tool_Persist() for any property that has been modified. Handler Format: func <name> (<handle> as reference to -> integer, <dx> as integer, <dy> as integer) handles MSG_TOOL_MOVEHANDLE [...] endfunc

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 44

32

QSI Qlarity-based Terminal Programmer’s Reference

Parameters:

Parameters:

<handle> An index of the handle defined in the arrays in the MSG_TOOL_GETHANDLES handler. If the handle type is CSR_SELECT, “<dx>” and “<dy>” are zero. If the handle number changes due to dragging, change the value of the handle to the appropriate number.

<parent> A reference to the parent to which the new object should attach itself.

<dx> The change in the resize grip’s x-position caused by the drag.

<y1> The y-position of the location where the drag was initiated.

<dy> The change in the resize grip’s y-position caused by the drag. Message: MSG_TOOL_DRAGCREATE Description: This message indicates that an object is being created by a click-and-drag operation in the Qlarity Foundry workspace. The format for the handler differs depending on the type of object being created. Non-drawable objects receive information about the parents to which they should attach. Area and container objects receive information about their position, size, and parents. The handler should set the object’s initial properties, call API functions to set the object attributes in the system software (usually done in property validation functions), and finally call Tool_Persist() for any property that has been modified. Handler Format:

<x1> The x-position of the location where the drag was initiated.

<x2> The x-position of the location where the drag was completed <y2> The y-position of the location where the drag was completed. The coordinates (x1,y1) and (x2,y2) are not normalized, which means that (x2,y2) might be above and to the left of (x1,y1). The handler should normalize these coordinates, if necessary, before calculating the initial position and size of the object. A typical handler for a rectangular object will normalize (x1,y1) and (x2,y2) if necessary, set the values for local properties that indicate position, size, and parent, call Tool_Persist() for all modified properties, and then call the object's MSG_INIT handler to handle the object initialization. For more information on these messages and their handlers, refer to Chapter 10 in the Qlarity Foundry User’s Manual.

(if handled by an area or container object) func <name> (<parent> as objref, <x1> as -> integer, <y1> as integer, <x2> as integer, -> <y2> as integer) handles MSG_TOOL_DRAGCREATE [...] endfunc

(if handled by a non-drawable object) func <name> (<parent> as objref) handles MSG_TOOL_DRAGCREATE [...] endfunc

Message: MSG_TOOL_DELETEOBJ Description: This message is sent to an object in the GUI development environment just before the object is deleted. This allows the object to notify other objects that it is being removed from the workspace so other objects can respond appropriately. Handler Format: func <name> () handles MSG_TOOL_DELETEOBJ [...] endfunc

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 45

QSI Qlarity-based Terminal Programmer’s Reference

3.8 Special Messages

33

Message: MSG_DRAW_DONE

This section describes messages that are unique or that do not fit into another message category.

Description: This message is sent by the system after a draw message has completed. The parameters indicate the bounding rectangle which was redrawn. This message, like MSG_ERROR, is only sent to a global message handler.

Message: MSG_ERROR Description: This message is issued by the system software if an exception remains unhandled after all possible enclosing “check error/on error” blocks have been checked. It indicates to the handler that at least one unhandled exception resides in the system exception stack. The MSG_ERROR message can only be handled by a global message handler. Since the handler takes no parameters, the exception information must be retrieved by calling the GetException() API function. Refer to the Qlarity Foundry User’s Manual for more information on the exception handling system.

Handler format: func DrawDone(<left> as integer, <top> -> as integer, <width> as integer, <height> -> as integer) handles MSG_DRAW_DONE return [...] endfunc

Parameters:

Handler Format:

<left> The x-location of the upper left corner pixel of the invalid region.

func <name> () handles MSG_ERROR [...] endfunc

<top> y-location of the upper left corner pixel of the invalid region.

Parameters:

<width> Width of the invalid region in pixels.

MSG_ERROR handlers take no parameters and do not have a return value.

<height> Height of the invalid region in pixels.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 46

34

QSI Qlarity-based Terminal Programmer’s Reference

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770