Difference between revisions of "Context Menu modes"

 
Line 7: Line 7:
 
=Setting the default transport mode=
 
=Setting the default transport mode=
  
In the EiffelStudio preferences window, there is a preference for deciding what pebble transport mechanism should be the default.  This is located in General /Pick and Drop mode  where True is for pick and drop mode and False is to use Contextual Menus as the default mode, this preference is subject to change.
+
In the EiffelStudio preferences window, there is a preference for deciding what pebble transport mechanism should be the default.  This is located in General /Pnd mode  where True is for pick and drop mode and False is to use Contextual Menus as the default mode, this preference is subject to change.
  
 
=Activating a pebble transportation=
 
=Activating a pebble transportation=
Line 16: Line 16:
  
 
Even though one mechanism is default, the use of the shift key whilst activating the transport mechanism with a right mouse click can be used to switch from the default mechanism to the other.
 
Even though one mechanism is default, the use of the shift key whilst activating the transport mechanism with a right mouse click can be used to switch from the default mechanism to the other.
 +
 +
=Using the mechanism with EiffelVision 2=
 +
 +
This mechanism is built in to Vision2 and use of the original pick and drop can be updated to use the Context Menu mechanism with the following code (where pebble_source_widget is the source of the pebble)
 +
 +
<code>[eiffel,n]
 +
 +
pebble_source_widget.set_configurable_target_menu_mode;
 +
pebble_source_widget.set_configurable_target_menu_handler (agent target_menu_handler)
 +
 +
 +
target_menu_handler (
 +
    a_menu: EV_MENU;
 +
    a_target_list: ARRAYED_LIST [EV_PND_TARGET_DATA];
 +
    a_source: EV_PICK_AND_DROPABLE;
 +
    a_pebble: ANY
 +
  )
 +
 +
    do
 +
        -- Within this feature you can manipulate `a_menu' to add custom menu items
 +
        -- `a_menu' must be populated by this routine, if `a_menu' is untouched,
 +
        -- a regular pick and drop transport will initiate.
 +
        -- a_target_list is an array of all the potential targets for `a_pebble', the
 +
        -- meta data includes target, menu text and pixmap (if applicable), this can be
 +
        -- customized for each target with {EV_PICK_AND_DROPABLE}.set_target_data_function.
 +
        -- `a_source' is the pebble source widget.
 +
        -- `a_pebble' is the pebble in question.
 +
    end
 +
 +
</code>

Revision as of 12:15, 7 May 2007

Context Menu Mode Switch

Currently, EiffelStudio has two pebble transport mechanism for performing command shortcuts within the IDE, these modes are Pick and Drop and new for EiffelStudio 6.0, Contextual Menus. They are closely related in the sense that they both provide a mechanism for transporting a pebble source to a destination target.

Previous EiffelStudio versions have only included the Pick and Drop pebble transport mechanism but this is not a standard way of performing tasks and can be somewhat alien to new users. The Contextual Menus have been added as a way for EiffelStudio to entice new users by providing a more recognisable approach to accessing the facilities that the IDE provides.

Setting the default transport mode

In the EiffelStudio preferences window, there is a preference for deciding what pebble transport mechanism should be the default. This is located in General /Pnd mode where True is for pick and drop mode and False is to use Contextual Menus as the default mode, this preference is subject to change.

Activating a pebble transportation

EiffelStudio has many potential pebble sources, the most prevalent ones being Class pebbles and Feature pebble. A simple right click on a pebble will activate the transport mechanism and a command to be performed on that pebble can be achieved either by dropping the pebble on to a highlighted source (if in Pick and Drop mode) or selected via a Contextual Menu item.

Switching from one mode to the other

Even though one mechanism is default, the use of the shift key whilst activating the transport mechanism with a right mouse click can be used to switch from the default mechanism to the other.

Using the mechanism with EiffelVision 2

This mechanism is built in to Vision2 and use of the original pick and drop can be updated to use the Context Menu mechanism with the following code (where pebble_source_widget is the source of the pebble)

pebble_source_widget.set_configurable_target_menu_mode;
pebble_source_widget.set_configurable_target_menu_handler (agent target_menu_handler)
 
 
target_menu_handler (
     a_menu: EV_MENU;
     a_target_list: ARRAYED_LIST [EV_PND_TARGET_DATA];
     a_source: EV_PICK_AND_DROPABLE;
     a_pebble: ANY
  )
 
    do
        -- Within this feature you can manipulate `a_menu' to add custom menu items
        -- `a_menu' must be populated by this routine, if `a_menu' is untouched,
        -- a regular pick and drop transport will initiate.
        -- a_target_list is an array of all the potential targets for `a_pebble', the 
        -- meta data includes target, menu text and pixmap (if applicable), this can be
        -- customized for each target with {EV_PICK_AND_DROPABLE}.set_target_data_function.
        -- `a_source' is the pebble source widget.
        -- `a_pebble' is the pebble in question.
    end