KwikPeg Manuals
Home
PegMLTextButton
Examples
Examples
Index
Index


Members
Styles
Signals
Overview Derived from class PegButton

The PegMLTextButton class provides a pushbutton object with one or more lines of text on the face of the button. The button appearance can change to indicate when the pushbutton is pressed and released.

Custom fonts and colors can be applied to a PegMLTextButton object. The PegMLTextButton is often used to derive a class with modified border styles or shapes. The PegMLTextButton object is also commonly used to populate PegHorzList and PegVertList objects.

The text strings displayed on the button face are vertically centered within the button client area. The strings may be right, left or center justified horizontally using KwikPeg's text justification styles.

The line breaks for a multiline text button are defined as characters within the text string associated with the button. The default line break character is the vertical bar (| = 0x7C). An alternate line break character can be presented to the PegMLTextButton class constructor.

Blank lines can be inserted into the displayed text by including extra line break characters.



 See Also

PegTextButton

PegBitmapButton

PegRadioButton

PegCheckBox



 Styles

The PegMLTextButton class supports the following style flags:

FF_NONE No frame.
FF_THIN Thin frame.
FF_THICK Thick 3D frame.
FF_RAISED Raised 3D frame.
FF_RECESSED Recessed 3D frame.
AF_ENABLED  This style flag is used to indicate that the object can be selected.
BF_REPEAT  If this style flag is set, a button object will generate periodic PSF_CLICKED signals when the button is held down by the user.
BF_DOWNACTION  If this style flag is set, a button object will generate the PSF_CLICKED signal when the button is pressed. Normally, the signal is generated when the button is released.
BF_FULLBORDER  The button object is to be drawn with a full border, the normal look for most buttons. Without this style, a thin button border will be applied.
TT_COPY  Keep separate copy of text with the object. This flag should be used when the string value used to assign text to an object is located in temporary storage such as a local variable on the stack.
TJ_RIGHT Right justify text.
TJ_LEFT Left justify text.
TJ_CENTER Center text.


 Signals

The PegMLTextButton class generates the following signals:

PSF_CLICKED Sent by any object when it is selected.

Top of page


 Members

Constructors:

PegMLTextButton(PegRect &Rect,
  const PEGCHAR *text,
  PEGCHAR cMarker = DEF_ML_MARKER,
  WORD wId = 0,
  WORD wStyle = TJ_CENTER|AF_ENABLED)

This constructor creates a PegMLTextButton at a specific location within a rectangle of the size specified by parameter Rect. Parameter cMarker can be used to specify the line break character used within the string referenced by parameter text.

PegMLTextButton(SIGNED iLeft, SIGNED iTop,
  SIGNED iWidth, const PEGCHAR *text,
  PEGCHAR cMarker = DEF_ML_MARKER,
  WORD wId = 0,
  WORD wStyle = AF_ENABLED)

This constructor creates a PegMLTextButton of width iWidth with its top left corner located at (iLeft,iTop). Parameter cMarker can be used to specify the line break character used within the string referenced by parameter text.

PegMLTextButton(SIGNED iLeft, SIGNED iTop,
  const PEGCHAR *text,
  PEGCHAR cMarker = DEF_ML_MARKER,
  WORD wId = 0,
  WORD wStyle = AF_ENABLED)

This constructor creates a PegMLTextButton with its top left corner located at (iLeft,iTop). The button will determine its own height and width according to the dimensions of the text string. Parameter cMarker can be used to specify the line break character used within the string referenced by parameter text.

 

Public Functions:

virtual void DataSet(const PEGCHAR *pText)

The PegMLTextButton class overrides the DataSet() function to permit the installation of a new multiline text string. The client area is invalidated and the number of lines to display is recalculated.

virtual void Draw(void)

The PegMLTextButton class overrides the Draw() function to draw the text on the button face.

PegFont *GetFont(void) {return mpFont;}

This function returns a pointer to the font currently being used to draw text on the button.

virtual void SetFont(PegFont *pFont)

The PegMLTextButton class overrides the SetFont() function to invalidate the button client area and recalculate substring positions after assigning the new font referenced by pFont to the button.


Top of page


 Examples

The following example illustrates a default PegMLTextButton object:

The multiline text button shown above was created by the code fragment which follows:

    Add(new PegMLTextButton(
        mClient.wLeft + 10, mClient.wTop + 10,
        "Multi-Line|Text|Button"));


The following example illustrates a PegMLTextButton object with a blank line, modified color and modified font:

The multiline text button shown above was created by the code fragment which follows:

    Rect.Set(0, 0, 90, 72);
    Rect.Shift(mClient.wLeft + 10, mClient.wTop + 10);

    PegMLTextButton *pButton =
        new PegMLTextButton(Rect,
        "This Button|Has A||Blank Line");

    pButton->SetColor(PCI_NORMAL, BLUE);
    pButton->SetColor(PCI_NTEXT, WHITE);
    pButton->SetFont(&SysFont);

    Add(pButton);



Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003