Tool_DB_Class::Height

 

Return the vertical dimension (in pixels) of the tool. 

 

 

Syntax

 

int  Height(

          unsigned short nb=10

) ;

 

 

Parameters

 

nb

the number of rows of text visible in the tool.  If there are more information available than what can be displayed, then a vertical slider will be enabled to scroll the list.  If no argument is provided, the tool will display 10 rows of information.

 

 

Return value

 

The vertical dimension of the tool (in pixels).

 

 

Remarks

 

This method is usually called in Ctrl_Register() to reserve the space for the tool and then again in Ctrl_Resize() to position the tool.

 

 

Requirements

 

Header:

          TomoVision_Util.hpp

          TomoVision_Tools.hpp

          Tool_work.hpp

 

Library:

          TomoVision_Util.lib

          TomoVision_Tools.lib

          SliceO_Tools.lib

 

 

Example

 

 

// --- Interface tools ---

static          Boxs          box_box ;

 

// --- for DB_Class list Tool ---

static          Boxs          box_db ;

static          Tool_DB_Class          tool_db ;

 

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

//

//          Function:          Ctrl_Register

//

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

extern "C" __declspec(dllexport) int          Ctrl_Register( unsigned short *mode )

{

          ...

 

          short          Title_Dim =           (short) Fct_Variable_Value( "$INTERFACE_TITLE_DIM_BIG" ) ;

          short          Space_Dim =           (short) Fct_Variable_Value( "$INTERFACE_SPACE_DIM" ) ;

 

          // --- compute the height of the interface ---

          short height = Title_Dim                    // title at top of tool

                         + tool_db.Height(10)          // DB_Class tool

                         + Space_Dim ;                    // space at the bottom

 

          return( height ) ;

}

 

...

 

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

//

//          Function:          Ctrl_Resize

//

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

extern "C" __declspec(dllexport) int          Ctrl_Resize( HWND wnd, int width, int height )

{

short          p_x, p_y, d_x, d_y ;

 

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

// In the "Config" menu, the user can change the interface's size.

// This action change a number of variables that are used to compute

// the size of the tool in the intearface.  We now load a few of these

// variables and use them to compute the dimension of our interface tools.

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

char   *          Tools_Font_Name =   (char *) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_NAME" ) ;

char   *          Tools_Font_Weigth = (char *) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_WEIGHT" ) ;

short          Tools_Font_Scale =  (short)  Fct_Variable_Value( "$INTERFACE_TOOL_FONT_SCALE" ) ;

 

short          Space_Dim =              (short)  Fct_Variable_Value( "$INTERFACE_SPACE_DIM" ) ;

short          Border_Dim =              (short)  Fct_Variable_Value( "$INTERFACE_BORDER_DIM" ) ;

 

          ...

 

          // ===========================================================================

          // --- DB Class Tool

          // ===========================================================================

          p_x = box_box.Pos_X + Space_Dim ;

          p_y = box_box.Pos_Y + Space_Dim ;

          d_x = box_box.Dim_X - 2*Space_Dim ;

          d_y = tool_db.Height(10) ;

 

          // --- The tool will be inside this box ---

          box_db.Flag = OUTIL_EMPTY ;

          box_db.Pos_X = p_x ;

          box_db.Pos_Y = p_y ;

          box_db.Dim_X = d_x ;

          box_db.Dim_Y = d_y ;

          box_db.color = box_box.color ;

          box_db.border    = Border_Dim;

          box_db.Font_Name   = Tools_Font_Name ;

          box_db.Font_Weight = Tools_Font_Weigth ;

          box_db.Font_Scale  = Tools_Font_Scale ; // + 1 ;

          box_db.Init( wnd ) ;

 

          // --- now prepare the tool itself ---

          tool_db.Resize( &box_db ) ;

 

          return( 1 ) ;

}

 

See also