Tabs::Grow

 

This method is to change the number of tabs in the Tabs tool.

 

 

Syntax

 

int  Grow(

          int size,

          int flag=0

) ;

 

 

Parameters

 

size

          Number of tabs in the tool.

 

flag

          Flag for the all the new tabs.  If this value is omitted the tool's flag is used.

 

 

Return value

 

This method returns 0 is an allocation error occurred, 1 if no error occurred.

 

 

Remarks

 

Tabs.Grow can be used to grow or shrink the number of elements in the tool.

 

 

Requirements

 

Header:

          TomoVision_Util.hpp

          TomoVision_Tools.hpp

 

Library:

          TomoVision_Util.lib

          TomoVision_Tools.lib

 

 

Example

 

static          Tabs          tab ;

static          char          *list_tab[] = { "Tab 1", "Tab 2", "Tab 3" } ;

 

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

{

short          i, p_x, p_y, d_x, d_y ;

 

          ...

 

          p_x = box_box.Pos_X + Space_Dim ;

          p_y = box_box.Pos_Y + box_box.Dim_Y - 2*Title_Dim_Big ;

          d_x = box_box.Dim_X - 2*Space_Dim ;

          d_y = Title_Dim_Big ;

 

              tab.Flag  = NULL ;

              tab.Pos_X = p_x ;

              tab.Pos_Y = p_y ;

              tab.Dim_X = d_x ;

              tab.Dim_Y = d_y ;

 

              // --- vertical size of the pages (including tabs) ---

              tab.Page_Y = box_box.Dim_Y - Title_Dim_Big - Space_Dim ;

 

              // --- initialize the tabs the first time only ---

              if ( ! tab.Item ) {

 

                    int nb_item = (sizeof list_tab) / sizeof(char *) ;

 

                    tab.Grow( nb_item ) ;

 

                    for ( int i=0; i < nb_item; i++ ) {

                        tab.Item[i]->Flag = NULL ;

                        tab.Item[i]->Set_Name( list_tab[i] ) ;

                    }

 

                    ...

              }

 

              tab.Init( wnd ) ;

 

              // --- call resize for the content of this tab page ---

              Page_Pos_X = box_box.Pos_X + 3*Space_Dim ;

              Page_Pos_Y = box_box.Pos_Y + 3*Space_Dim ;

              Page_Dim_X = box_box.Dim_X - 6*Space_Dim ;

              Page_Dim_Y = box_box.Dim_Y - 2*Title_Dim_Big - 6*Space_Dim ;

 

              (*(Func_Resize[tab.Cur_Value]))( wnd,

                                                       Page_Pos_X, Page_Pos_Y, Page_Dim_X, Page_Dim_Y,

                                                       tab.Item[tab.Cur_Value]->color ) ;

 

          return( 1 ) ;

}

 

See also