TAB Control

 

Creates a TAB Control within a Window

 

 

Description:

 

The TAB Control acts as a "container" for one or more other specific controls

 

The image below demonstrates a MAIN Window which is acting as a host for a TAB Control. This has a number of "pages" which are displayed below the MAIN Window TITLEBAR

 

TABBED Window

 

Syntax:

 

    DEFINE TAB

        [ PARENT         <nRow> ]

        ROW              <nRow>

        CO  L            <nCol>

        WIDTH            <nWidth>

        HEIGHT           <nHeight>

        [ VALUE          <nVirtualWidth> ]

        [ FONTNAME       <cFontName> ]

        [ FONTSIZE       <nFontSize> ]

        [ FONTBOLD       <lValue> ]

        [ FONTITALIC     <lValue> ]

        [ FONTUNDERLINE  <lValue> ]

        [ FONTSTRIKEOUT  <lValue> ]

        [ TOOLTIP        <cToolTipTxt> ]

        [ BUTTONS        <lValue> ]

        [ FLAT           <lValue> ]

        [ HOTTRACK       <lValue> ]

        [ VERTICAL       <lValue> ]

        [ ON CHANGE      <ProcName | bBlock> ]

        [ TABSTOP        <lValue> ]

        [ MULTILINE      <lValue> ]

        [ TRANSPARENT    <lValue> ]

 

        DEFINE PAGE      <cPageCaption>

            [ IMAGE      <cImageName> ]

 

            [ ... PAGE Controls (eg. LABEL, BUTTON, EDITBOX, TREE, BROWSE etc) ... ]

 

        END PAGE

 

        [ ... Other PAGE and PAGE CONTROL Definitions ... ]

 

    END TAB

 

Valid For Use With:

 

This Control is assumed to be available for use with all Window types

 

Notes:

  1. During testing it was found that if the PARENT Property is used, the program failes to compile returning - syntax error at 'TAB'

  2. During testing a problem was noted when using the CAPTION Property. When this is used to set a new name for a Page, a number of Controls disappeared from view on the Page where the code to make the change runs from. They became visible again if a different Page was selected, then when the original Page was re-selected. A more user friendly solution was to hide the TAB Control, change the Caption, then show the TAB Control again. Refer to line 89 in the sample code file (below) to see how this was done

  3. During testing it was noted that if a PANEL Window was included within any Page, the Page with the last defined PANEL Window was always displayed on launch regardless of the VALUE property setting. This is most likely due to the way a PANEL Window is defined! To workaround this if a specific Page has to be displayed on launch, the ONINIT property of the host Window can be used. Refer to line 28 in the sample code file (below) to see how this was done

  4. Care should be exercised if using the DELETEPAGE Method to ensure the right page is deleted! However, testing did confirm that there are no errors or failures if you attempt to delete a non-existant Page

  5. As a TAB Control acts as a container for other Controls they are referenced as "child" controls of the container. Eg. Win_Main.Tab1.CAPTION(4) := "Page Z"

  6. The original version of the help file for this item can be viewed here

Control Properties:

 

The following Properties are available to use when defining the TAB Control

 

Name Data Type Control Description
PARENT Character D Defines the Controls Parent Window. Note: In testing, the program fails to compile returning a syntax error at 'TAB'
ROW Numeric D, R, W Sets the row number on the screen to place the top edge of Window
COL Numeric D, R, W Sets the column number on the screen to place the left edge of Window
WIDTH Numeric D, R, W Sets the width of the Window
HEIGHT Numeric D, R, W Sets the height of the Window
VALUE Numeric D, R, W Sets the Page to display on launch and can be used to change to a different Page
FONTNAME Character D, R, W Sets the default font to use on any Window elements and any controls that don't have their own specific FONTNAME defined
FONTSIZE Numeric D, R, W Sets the default font size to use on any Window elements and any controls that don't have their own specific FONTSIZE defined
FONTBOLD Logical D, R, W Sets the Page Caption to bold text. Note: In testing, any Logical value used is ignored and .T. is assumed
FONTITALIC Logical D, R, W Sets the Page Caption to italicized text. Note: In testing, any Logical value used is ignored and .T. is assumed
FONTUNDERLINE Logical D, R, W Sets the Page Caption text to be underlined. Note: In testing, any Logical value used is ignored and .T. is assumed
FONTSTRIKEOUT Logical D, R, W Sets the Page Caption text to be struck out. Note: In testing, any Logical value used is ignored and .T. is assumed
TOOLTIP Character D, R, W Sets the text to display in a "tooltip bubble" if the mouse is hovered over the TAB Control Pages
BUTTONS Logical D Specifies if a BUTTON style should be use to represent Pages in a TAB Control. Note: In testing, any Logical value used is ignored and .T. is assumed
FLAT Logical D Specifies a flat appearance when a BUTTON style is used to represent Pages in a TAB Control. Note: In testing, any Logical value used is ignored and .T. is assumed
HOTTRACK Logical D Enables / disables 'Hot Tracking' of TAB Pages. Note: In testing, any Logical value used is ignored and .T. is assumed
VERTICAL Logical D Enables / disables vertical arrangement of Pages with the default being horizontal. Note 1: During testing, vertical arrangement of the Pages was only successful if the BUTTONS Property was also used. Note 2: In testing, any Logical value used is ignored and .T. is assumed
TABSTOP Logical D Specifies if the keyboard tab key can be used to change focus from one Control to another within a Window. Note: In testing, any Logical value used is ignored and .T. is assumed
MULTILINE Logical D Specifies how Pages are shown when there are too many to fit within the TAB Controls' width. Note: In testing, any Logical value used is ignored and .T. is assumed
TRANSPARENT Logical D Specifies if the text and any image used on the Page should be transparent. Note: In testing, any Logical value used is ignored and .T. is assumed
IMAGE Character D For PAGE definitions only: Specifies the file name of an image to place to the left of any text on a Page

 

Each of the following Properties are available after the TAB Control has been defined

 

Name Data Type Control Description
NAME Character R Returns the name defined for the Control
CAPTION Character R, W Gets or sets the Caption text that appears on the specified Page

 

D - Properties of this type can be used when defining a Window

R - Properties of this type can only be accessed (read) after the Window has been defined

W - Properties of this type can be changed (write) after the Window has been defined

 

See GETPROPERTY and SETPROPERTY functions for further infomation on accessing or changing properties or use semi-OOP syntax

 

Control Event Properties:

 

Each of the following Event Properties are available to use when defining the TAB Control. When used, they contain the name of a procedure to run or a code block to evaluate if that event occurs;

 

Event Description
ON CHANGE Specifies a Function to run or a Code Block to evaluate. This runs each time a different Page is selected

 

Control Methods:

 

Each of the following Methods can be used to perform an action that accesses, changes or modifies the Window;

 

Method Description
ADDCONTROL Add a new Control to a specified Page. Refer to code from line 350 in the sample code file (link below) to see how this can be done
ADDPAGE Add a new Page to a Tab. Refer to code from line 218 in the sample code file (link below) to see how this can be done
DELETEPAGE Delete a new Page from a Tab. Refer to code from line 236 in the sample code file (link below) to see how this can be done
HIDE Hides a Control. Refer to code from line 305 in the sample code file (link below) to see how this can be done
RELEASE Releases a Control from memory. Refer to code from line 360 in the sample code file (link below) for an example of how this can be done
SETFOCUS Sets focus onto a Control
SHOW Makes the Control visible if it has been hidden. Refer to code from line 305 in the sample code file (link below) to see how this can be done

 

Sample Code:

 

Sample code to test this Property can be found here