Tools::Select

 

This method update the tools graphics and return the value 1 if the mouse pointer is over the tool.

 

 

Syntax

 

int  Select(

          int click

) ;

 

 

Parameters

 

click

          You must provide an integer that gives the value of the mouse buttons.  For the "Ctrl_Click" and "Ctrl_Motion" DLL functions, this is the variable "up_down".  For the "Ctrl_Scroll" function, since we have no mouse action as such, we will use the macro KEY_QUERY as "click" parameter.

 

 

Return value

 

This method returns 1 if the cursor is over the tool, 0 if not.

 

 

Remarks

 

This method has 2 functions: it tells you if the cursor is over the tool, and it refresh the graphics to mirror the mouse actions.  When the mouse is over the tool, the tool graphics change to reflect this. When the mouse is over the tool, its graphic bitmap will be given by the pointer Graph_Select, when not over the tool it will be Graph_Normal.

 

Also some tools are composed of more tools, these are updated with the "select" call.  For example, a list may have a slider to scroll its buttons, this slider and the button scrolling are done during the "select" call.

 

This method must be called for each tool each time there is a mouse action (click, scroll or motion).

 

 

Requirements

 

Header:

          TomoVision_Util.hpp

          TomoVision_Tools.hpp

 

Library:

          TomoVision_Util.lib

          TomoVision_Tools.lib

 

 

Example

 

extern "C" __declspec(dllexport) int          Ctrl_Click( HWND wnd, int up_down, short x, short y )

{

          // --- We only refresh the image when we release the button ---

          if ( ! up_down ) {

              return( 0 ) ;

          }

 

          // ------------------------------------------------

          // We received a mouse click, now we try to find in

          // which tool the click was.  For this we use the

          // "select" method.  It will tell us if the mouse

          // is inside the tool

          // ------------------------------------------------

          if ( demo.Select( up_down ) ) {

              // --- change the state of the button ---

              demo.Cur_Value = ! demo.Cur_Value ;

              // update the graphic for the new state ---

              demo.Adjust() ;

              return( 1 ) ;

          }

          return( 0 ) ;

}

 

extern "C" __declspec(dllexport) int          Ctrl_Motion( HWND wnd, int up_down, short x, short y )

{

          // ------------------------------------------------

          // The mouse has moved.  By calling "select" we

          // insure that the tool will get the "select" color

          // if the cursor is over it.

          // ------------------------------------------------

          demo.Select( up_down ) ;

 

          return( 0 ) ;

}

 

extern "C" __declspec(dllexport) int          Ctrl_Scroll( HWND wnd, int count, short x, short y )

{

          if ( demo.Select( KEY_QUERY ) ) {

              demo.Cur_Value = demo.Scroll(count) ;

              demo.Adjust() ;

              return( 1 ) ;

          }

          return( 0 ) ;

}

 

 

See also