Note: You cannot use configurations to associate certain mouse clicks that are intercepted by your platform's window manager. For example, the Alt-mouse-down user gesture is meaningful for the HP-Vue window manager on Hewlett-Packard 900 series workstations.
Associating Selection with a Menu Choice or User Menu Choice
Use the selecting ... implies clause to configure selection operations that apply to one item. create-subworkspace operation with selecting an item of the CONVEYOR-STATION class:
selecting any conveyor-station implies
create-subworkspace
selecting ... implies clause, which is appropriate for configuring operations directed at one item, such as create-by-cloning, and the typing ... implies clause, which is appropriate for configuring operations not directed at any particular item, such as save-KB. selecting ... absolutely implies clause to override all other configurations that use a selecting ... implies clause for the specified class in the same hierarchy. G2 resolves configurations in the same hierarchy with selecting ... absolutely implies clauses that conflict according to G2's precedence rules for configurations. For example, the following configuration statement, which associates the system-defined
go-to-subworkspace operation with selecting an item of the NAVIGATE-DOWN-BUTTON class, overrides any other conflicting configurations in the configured item's hierarchy:
selecting any navigate-down-button absolutely implies
go-to-subworkspace
selecting ... implies clause always overrides a menu choices for clause for the same target item identified by class. pressing ... implies clause to associate a mouse-down event with an operation:
any mouse button phrase
any mouse button phrase
releasing ... implies clause to associate a mouse-up event with an operation:
any mouse button phrase
any mouse button phrase
pressing ... on ... starts clause, as described in the section Associating a Mouse Click with a Mouse-Tracking Procedure.
You can associate the mouse-down or mouse-up events with an operation that is targeted on:
pressing any mouse button on this item does nothing
releasing any mouse button on this item implies lift-to-top
pressing any mouse button on any kb-workspace implies hide-workspace
releasing any mouse button implies inspect
pressing ... implies clause or the releasing ... implies clause, G2 prompts you to enter the name of a user menu choice, or to select from a list of system-defined menu choices, system-defined workspace-oriented operations, and system-defined KB-wide operations.
You can configure items for drag and drop capabilities with:
any mouse button phrase
any mouse button phrase
configure the user interface as follows:
when in my-drag-mode:
pressing any mouse button on this item impliesole-clone;
To configure an item for cloning or transferring with a combination of a modifier key and a mouse button, use a statement such as:
configure the user interface as follows:
when in my-transfer-mode:
pressing control+any mouse button on this item impliesole-transfer;
when in my-transfer-mode:
pressing alt+any mouse button on this item impliesole-clone;
pressing ... on ... starts clause to declare that mouse clicks on items of one or more classes cause G2 to call a user-defined mouse-tracking procedure. You code this procedure to respond to a change in the mouse pointer's location within a particular window, until the next mouse-click event within that window. This allows your KB to support state-based, user-interface operations, including drag-and-drop operations such as a simple drawing command and opening and selecting from pulldown menus.
For example, you can code a phrase like this:
pressingany mouse buttononany custom-objectstarts
track-mouse-over-custom-object as the mouse tracks over any item
track-mouse-over-custom-object procedure after the user depresses any mouse button over any custom-object, and to call that procedure again each time the mouse pointer passes over any other item in G2's own window. You can also code a phrase like this:
pressingcontrol + any mouse buttononany custom-objectstarts
track-mouse-over-custom-object as the mouse tracks
continuously over any item
track-mouse-over-custom-object procedure after the user simultaneously depresses Control and any mouse button over any custom-object; to call that procedure again each time the workstation's window manager updates the mouse position; and to call the procedure again each time the mouse pointer passes over any other item in G2's own window. In a
pressing ... on ... starts clause you can configure these mouse-click-events:
any mouse button
any mouse button
any mouse button
any mouse button
any mouse button
PROCEDURE class) that G2 calls to respond to the triggering mouse-click-event and to the mouse pointer's subsequent movement onto, off of, or over items of the tracked-class.
METHOD or METHOD-DECLARATION class as the mouse-tracking-procedure. However, your mouse-tracking procedure can call or start a method.
mouse-tracking-procedure(event: symbol , tracked-window: class g2-window,
trigger-item: item-or-value, tracked-item: item-or-value,
x-mouse-position: integer, y-mouse-position: integer,
event-timing-in-milliseconds: integer, state-of-modifier-keys: integer )
| Position of Modifier Keys | |||
|---|---|---|---|
| Alt | Control | Shift | Return Value |
|
Up
|
Up
|
Up
|
0
|
|
Up
|
Up
|
Down
|
1
|
|
Up
|
Down
|
Up
|
2
|
|
Up
|
Down
|
Down
|
3
|
|
Down
|
Up
|
Up
|
4
|
|
Down
|
Up
|
Down
|
5
|
|
Down
|
Down
|
Up
|
6
|
|
Down
|
Down
|
Down
|
7
|
START-TRACKING event: when the configured mouse-click-event occurs over an item of trigger-class
ENTER event: when the mouse pointer passes onto any item of tracked-class
MOTION event: (if the configuration includes the continuously keyword) when the host platform's window manager notifies G2 with a new location of the mouse pointer
LEAVE event: when the mouse pointer passes off of any item of tracked-class
STOP-TRACKING event: when the user releases the mouse button
ABORT-TRACKING event: when the user interrupts mouse-tracking by pressing Control + a
start-tracking
enter
ENTER event occurred
ENTER event occurred
ENTER event occurred
leave
LEAVE event occurred
LEAVE event occurred
LEAVE event occurred
stop-tracking
STOP-TRACKING event occurred
continuously over, then for each tracked-item over which the mouse pointer passes, G2 automatically calls the mouse-tracking-procedure each time the workstation's window manager updates the mouse position. When G2 calls the mouse-tracking-procedure, G2 passes to it:
motion
MOTION event occurred
MOTION event occurred
MOTION event occurred
PULL-DOWN-MENU class, whose instances are related to instances of the PULL-DOWN-MENU-CHOICE class. You can use a configuration statement with a pressing ... on ... starts clause, as follows, to implement operations that support selection of pulldown menu choices:
configure the user interface as follows :
unless in administrator mode :
pressingalt + any mouse buttononany pull-down-menustarts
start-procedure use-pull-down-menu as the mouse tracks over
any pull-down-menu-choice or pull-down-menu
pressing ... on ... starts clause in the configuration requires that you write a procedure named use-pull-down-menu, as follows:
use-pull-down-menu ( event : symbol, tracked-window : class g2-window,
trigger-item : item-or-value, tracked-item : item-or-value,
x-mouse-position : integer, y-mouse-position : integer,
event-time-stamp : integer, keys-mask : integer ) = ( )
begin
{ Respond to the four mouse-tracking procedure events ... }
case ( event ) of
START-TRACKING :
begin
call highlight-a-pull-down-menu ( trigger-item ) ;
call select-a-pull-down-menu ( trigger-item ) ;
end ;
ENTER :
{ First, verify that a "tracked-item" value was returned }
if tracked-item has a current value then
begin
{ Second, perform this operation only if the "tracked-item"
still exists. }
if tracked-item exists then
call highlight-a-choice-on-pull-down-menu
( tracked-item ) ;
end ;
MOTION :
{ This case is necessary only if the relevant configuration
statement specifies "continuously over". }
{ First, verify that a "tracked-item" value was returned }
if tracked-item has a current value then
begin
{ Second, perform this operation only if the "tracked-item"
still exists. }
if tracked-item exists then
call display-menu-for-traversed-item ( tracked-item ) ;
end ;
LEAVE :
{ First, verify that a "tracked-item" value was returned }
if tracked-item has a current value then
begin
{ Second, perform this operation only if the "tracked-item"
still exists. }
if tracked-item exists then
call unhighlight-a-choice-on-pull-down-menu
( tracked-item ) ;
end ;
STOP-TRACKING :
{ First, verify that a "tracked-item" value was returned }
if tracked-item has a current value then
begin
{ Second, perform this operation only if the "tracked-item"
still exists. }
if tracked-item exists then
case ( the class of tracked-item ) of
pull-down-menu-choice :
{ Perform this operation only if the "tracked-item"
still exists. }
if tracked-item exists
call select-choice-on-pull-down-menu
(tracked-item) ;
otherwise :
{ If mouse-up event occurs over other than a
pull-down-menu-choice ... }
call unselect-the-selected-pull-down-menu ( ) ;
end { case of }
end { begin }
ABORT-TRACKING :
{ This procedure does not support responding to aborts
(the Control + a keypress) during mouse-tracking. }
begin
end
end { case of }
end { begin }
STOP-TRACKING: case must discriminate between items of applicable and non-applicable classes.
START-TRACKING event but before the ENTER, LEAVE, or STOP-TRACKING events. In this case, G2 passes no value for the trigger-item argument.
false for all subsequent mouse-tracking events. ENTER and LEAVE events, the tracked-item argument has the value false for the LEAVE event. transfer ... to the mouse action after mouse-tracking processing has begun; after the user executes mouse-down to drop the item, the mouse-tracking processing resumes.