Announcement

Collapse
No announcement yet.

Control Add Frame

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Control Add Frame

    Please add your comments and suggestions as a Reply to this thread.





    PB/WIN - CONTROL ADD FRAME statement

    Purpose
    Add a frame to a dialog. This is also known as a "group" control, and is typically drawn around controls to indicate a visual association between such controls. A frame control is often used around related Option controls.
    Syntax
    CONTROL ADD FRAME, hDlg, id&, txt$, x, y, xx, yy [, [style&] [, [exstyle&]]]
    hDlg
    Handle of the dialog in which the frame will be created. The dialog will become the parent of the control.
    id&
    Unique identifier for the control in the range 1 to 65535, frequently specified with numeric equates for clarity of the code. For example, the equate %RelatedItems is more informative than a literal value such as 497. If you will not be changing the text in a frame control after it is created, you may use -1 for the id&; however, best practice suggests identifiers should start at 100 to avoid conflict with any of the standard predefined identifiers.
    txt$
    Text to be displayed in the frame. An ampersand (&) may be included in txt$ to specify a hot-key. See the Remarks section below.
    x, y
    Integral expressions, variables, or numeric literal values, specifying the location of the control inside the dialog client area. x is the horizontal position, and y is the vertical position. 0,0 refers to the upper left corner of the dialog box client area. Coordinates are specified in the same terms (pixels or dialog units) as the parent dialog.
    xx
    Integral expression, variable, or numeric literal value, specifying the width of the control. The width is given in the same terms (pixels or dialog units) as the parent dialog. The most common value used in the Microsoft Dialog Editor and Visual Studio is 40 dialog units.
    yy
    Integral expression, variable, or numeric literal value, specifying the height of the control. The height is given in the same terms (pixels or dialog units) as the parent dialog. The most common value used in the Microsoft Dialog Editor and Visual Studio is 14 dialog units.
    style&
    Primary style of the frame control. The default frame style comprises %BS_LEFT, and %BS_TOP. The default style is used only if both the primary and extended parameters are omitted from the statement. For example:

    Code:
    CONTROL ADD FRAME, hDlg, id&, txt$, 100, 100, 40, 14, , ' Use default styles
    Custom style values replace the default values. That is, they are not additional to the default style values - your code must specify all necessary primary and extended style parameters.

    The primary frame style value can be a combination of any values below, combined together with the OR operator to form a bitmask:
    %BS_CENTER
    Center the text horizontally in the frame.
    %BS_LEFT
    Place the text on the left side of the frame. (default)
    %BS_GROUPBOX
    Display a frame in which other controls can be positioned to infer a "visual association" or relationship between those controls. (persistent)
    %BS_MULTILINE
    Wrap the caption text across multiple lines if the text string is too long to fit on a single line. Wrapping is not automatic, but the line wrap position can be specified by inserting a $CR (or $CRLF) character at the desired wrap position in the caption text.
    %BS_RIGHT
    Place the text on the right side of the frame.
    %BS_TOP
    Place the text at the top of the frame. (persistent) Note: the %BS_TOP style is persistent - the frame control does not support %BS_BOTTOM alignment.
    %WS_GROUP
    Define the start of a group of controls. The first control in each group should also use %WS_TABSTOP style. The next %WS_GROUP control in the tab order defines the end of this group and the start of a new group. Groups configured this way permit the arrow keys to shift focus between the controls within the group, and focus can jump from group to group with the usual TAB and SHIFT+TAB keys. Both tab stops and groups are permitted to wrap from the end of the tab order back to the start.
    %WS_DISABLED
    Create a control that is initially disabled. A disabled frame control is displayed with grayed text.
    exstyle&
    Extended style of the frame control. The default extended frame style comprises %WS_EX_LEFT. The default extended style is used if both the primary and extended parameters are omitted from the CONTROL ADD FRAME statement, in the same manner as style& above.

    The extended combo box style value can be a combination of any values below, combined together with the OR operator to form a bitmask:
    %WS_EX_CLIENTEDGE
    Apply a sunken edge border to the control.
    %WS_EX_LEFT
    The control has generic "left-aligned" properties. (default)
    %WS_EX_RIGHT
    The control has generic "right-aligned" properties. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading order alignment; otherwise, the style is ignored.
    %WS_EX_STATICEDGE
    Apply a three-dimensional border style to the control (intended to be used for items that do not accept user input).
    %WS_EX_TRANSPARENT
    Controls/windows beneath the control are drawn before the control is drawn. The control is deemed transparent because elements behind the control have already been painted - the control itself is not drawn differently. True transparency is achieved by using Regions - see MSDN for more information.
    %WS_EX_WINDOWEDGE
    Apply a raised edge border to the control.
    Remarks
    A frame control does not send messages to its parent dialog and does not require or support a Callback.
    See AlsoReferences
    Last edited by Gary Beene; 28 Oct 2014, 06:59 PM.

  • #2
    Add to remarks:

    The FRAME control is not a "parent" ,"owner" or "container" for other controls.

    It is basically the same as a LABEL control consisting of ONLY the outlining borders.

    Other controls placed within the dimensions of the "box" created by a FRAME control operate ndependent of the FRAME control; e.g., moving a FRAME control with CONTROL SET LOC will not cause any controls located within that box to move.

    The FRAME control is called a "Group Box" by Windows, but the that control is also not a suitable "parent", "owner" or "container."
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment

    Working...
    X