@...BUTTONEX
DEFINE BUTTONEX
Creates a ButtonEx control.
  

A ButtonEx control can be used as replacement for standard buttons. The ButtonEx control called OwnerDrawButtons implementation with support for XP Style.


SYNTAX

Standard Window:

@ <nRow>,<nCol> BUTTONEX <ButtonName>
[ OF | PARENT <
ParentWindowName> ]
[ CAPTION <
cCaption> ]
[ WIDTH <
nWidth> HEIGHT <nHeight> ]
[ PICTURE <
cBitmapName> ]  |  [ ICON <cIconName> ]
[ IMAGESIZE <
nImageWIdth>, <nImageHeight>]
   |  [ IMAGEWIDTH <
nImakeWidth> IMAGEHEIGHT <nImageHeught> ]
[ ACTION | ONCLICK | ON CLICK <
OnActionProcedure> | <bBlock> ]
[ FONT <
cFontName> ]
[ SIZE <
nFontSize> ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ FONTCOLOR <
anFontColor> ]
[ BACKCOLOR <
anBackColor> ]
[ VERTICAL ]
[ LEFTTEXT ]
[ UPPERTEXT ]
[ ADJUST ]
[ TOOLTIP <
cToolTipText> ]
[ NOHOTLIGHT ]
[ FLAT ]
[ GRADIENTFILL <
aGradInfo> [  HORIZONTAL ] ]
[ NOTRANSPARENT ]
[ NOXPSTYLE ]
[ ON GOTFOCUS | ON MOUSEHOVER <
OnGotFocusProcedure> | bBlock> ]
[ ON LOSTFOCUS | ON MOUSELEAVE <
OnLostFocusProcedure> | bBlock> ]
[ HANDCURSOR ]
[ NOTABSTOP ]
[ HELPID <
nHelpId> ]
[ INVISIBLE ]
[ DEFAULT ]

[ ON INIT <
bInit> ]

Alternate Syntax:

DEFINE BUTTONEX <ButtonName>

[ ID <nId> ]
[ PARENT <
ParentWindowName> ]
COL <
nCol>
ROW <
nRow>
WIDTH <
nWidth>
HEIGHT <
nHeight>
[ CAPTION <
cCaption>]
[ ACTION <
OnActionProcedure> | <bBlock> ]
[ IMAGESIZE <
nImageWIdth>, <nImageHeight>]
   |  [ IMAGEWIDTH <
nImakeWidth> IMAGEHEIGHT <nImageHeight> ]
[ FONTNAME <
cFontName> ]
[ FONTSIZE <
nFontSize> ]
[ FONTBOLD < .T. | .F.> ]
[ FONTITALIC < .T. | .F.> ]
[ FONTUNDERLINE < .T. | .F.> ]
[ FONTSTRIKEOUT < .T. | .F.> ]
[ FONTCOLOR <
anFontColor> ]
[ VERTICAL < .T. | .F.> ]
[ LEFTTEXT < .T. | .F.> ]
[ UPPERTEXT < .T. | .F.> ]
[ ADJUST < .T. | .F.> ]
[ TOOLTIP <
cToolTipText>]
[ BACKCOLOR <
anBackColor> ]
[ NOHOTLIGHT < .T. | .F.> ]
[ FLAT < .T. | .F.> ]
[ GRADIENTFILL <
aGradInfo> [  HORIZONTAL < .T. | .F.> ] ]
[ NOTRANSPARENT < .T. | .F.> ]
[ NOXPSTYLE < .T. | .F.> ]
[ ONGOTFOCUS <
OnGotfocusProcedure> | bBlock> ]
[ ONLOSTFOCUS
OnLostFocusProcedure> | bBlock> ]
[ HANDCURSOR  < .T. | .F.> ]
[ NOTABSTOP < .T. | .F.> ]
[ HELPID <
nHelpId>]
[ INVISIBLE < .T. | .F.> ]
[ DEFAULT < .T. | .F.> ]

[ ONINIT <
bInit> ]

END BUTTONEX 


DESCRIPTION:

nRow, nCol
Position in the area of ??the window in pixels.
nWidth, nHeight
The desired size of the ButtonEx Control in pixels.
nId
The ID identifier this Control in Dialog Window
ButtonName
A reference to the ButtonEx Control
ParentWindowName
A reference to the Parent Window.
Caption
A text expressions for the ButtonEx.
nImageWIdth
Image width (for non bitmap)
nImageHeight
Image width (for non bitmap)
cFontName, nFontSize
A reference to the Font name and size .
OnActionProcecure
Action to be performed when ButtonEX is Clicked
OnGotFocusProcedure
Action to be performed when ButtonEx is Focused.
OnLostFocusProcedure
Action to be performed when ButtonEx is Lost Focused.
anBackColor
A reference to the Control Background color
anFontColor
A reference to the Control Font color
cToolTipText
Specifies the Text for the ToolTip
 
 
NOTRANSPARENT
Property for picture ButtonEx with bitmap (default - set to false)
VERTICAL
Clause is used to set Picture/Text aspect on button (default - set false)
LEFTTEXT
Clause is for horizontal aspect only (text is placed on the left side of picture) (default - set to false)
UPPERTEXT
For vertical aspect only (text is placed over picture) (default - set to false)
NOHOTLIGHT
Button with mouse over is not "hot-tracked" (default - set to false)
NOXPSTYLE
Preserve standard button look even on styled Windows XP
PICTURE / ICON
Clause can not be used together. Once created , image button must use .Picture (bitmaps) or .Icon (icons) property regarding to his definition.
(Bitmap Mask used for display on disabled button is created 'in-fly' by button draw procedure)
DEFAULT
?
INVISIBLE
The visibility property specifies whether or not a control is visible
ADJUST
?
NOTABSTOP
Stop the control to receive focus and participate in the tabbing sequence


PROPERTIES:

·   Enabled
Set / Gets enabled state of a button control
·   Visible          
Set / Gets visible a button control.
·   Row
Set / Gets row position of a button control.
·   Col   
Set / Gets column position of a button control.
·   Width
Set / Gets width of a button control.
·   Height
Set / Gets height of a button control.
·   Caption
Set / Gets caption of a button control.
·   Action
Set / Gets action of a button control..
·   FontName
Set / Gets button control's font name.
·   FontSize
Set / Gets button control's font size.
·   FontBold
Set / Gets button control's font bold property
·   FontItalic
Set / Gets button control's font italic property
Set / Gets button control's font underline property
Set / Gets button control's font strikeout property
·   FontColor
Set / Gets the foreground color for text within the button
·   BackColor
Set / Gets the background color for text within the button
·   ToolTip
Set / Gets button control's Tooltip text.
·   Picture
Set / Gets image name of a button control.
·   Icon
Set / Gets icon name of a button control.
Set / Gets image height of a button control.
·   ImageWidth
Set / Gets image width of a button control.
·   Cargo
Set / Gets user property 'Cargo' for button control
·   Name (R)
Retrieves the name of a button control.
·   Parent(D)
Set the name as character identifier of the parent window.
·   HelpId (D)
Set / Gets the numeric help topic identifier of the control.
·   Lefttext (D)
 
·   Uppertext(D)
 
·   Flat(D)
Set 'Flat' Style For Button control
·   NoTabStop(D)
Sets whether an element behavior can't receive focus and participate in the tabbing sequence
·   Transparent(D)
Specifies whether the background of a Button object should be transparent

D: Available at control definition only
R: Read-Only

EVENTS:

·   OnGotFocus
Action to be performed when getting the focus
Action to be performed when losing the focus.
·   OnClick
Action to be performed when generic clicking of the control

METHODS:

·   Show
Shows a button control
·   Hide
Hides a button control
·   Redraw
Redraw a Control
·   SetFocus
Gives the focus to a button control
·   Release
Releases a button control from memory
·   SaveAs
Save a button control as BitMap file.

Notes:
NOTRANSPARENT is property for picture ButtonEx with bitmap (default NOTRANSPARENT is set to false)

VERTICAL clause is used to set Picture/Text aspect on button (default VERTICAL is set false)

LEFTTEXT clause is for horizontal aspect only (text is placed on the left side of picture) (default LEFTTEXT is set to false)

UPPERTEXT is for vertical aspect only (text is placed over picture) (default UPPERTEXT is set to false)

NOHOTLIGHT - button with mouse over is not "hot-tracked" (default NOHOTLIGHT is set to false)

NOXPSTYLE - preserve standard button look even on styled Windows XP

PICTURE and ICON clause cannot be used together. Once created , image button must use .Picture (bitmaps) or .Icon (icons) property regarding to his definition.

(Bitmap Mask used for display on disabled button is created 'in-fly' by button draw procedure)

The ButtonEx control supports JPG, GIF, TIF and PNG images now.
You can set/get this property at runtime:
            
Form.ButtonEx.Picture := 'ok.png'
            
cImage := GetProperty( Form, Control, 'Picture' )

Added a new optional clause IMAGESIZE <
w>, <h> to the ButtonEx control.
This property is available at control's definition for NOT Bitmap only.
The alternative syntax is IMAGEWIDTH <
w> and IMAGEHEIGHT <h>.

GRADIENTFILL <
aGradient> clause where aGradient can contain any number of gradients and should be specified in the following way:
   { {
nPart, nClrStart, nClrEnd }, { nPart, nClrStart, nClrEnd }, ... }
nPart is to be specified as 0.25, 0.5, etc. and should aggregate to 1.
The gradient may be specified as Horizontal or Vertical (default value).
Note:The colored ButtonEx control supports also a simplest form of the GRADIENTFILL <
aGradient> clause, and should be specified in the following way:
  { {
nClrStart, nClrEnd }, { nClrStart, nClrEnd } }


EXAMPLE:

See demos in :
\Samples\Basic\ButtonEx