Button
Previous topic  First topic  Next topic





Define and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE BUTTON cName | (cVarName) | &(cExpression) 
      [ ; OF cWindow | (cVarName) | &(cExpression) ]
Parent.Name
  
A reference to the Parent Window
      [ ROW nRow ]
0
  
Row position on container window in pixels coordinates
      [ COL nCol ]
0
  
Col position on container window in pixels coordinates
      [ WIDTH nWidth ]
?
  
The desired width size of the Control in pixels
      [ HEIGHT nHeight ]
?
  
The desired height size of the Control in pixels
      [ ROWBOTTOM nRow ]
n/a
  
Bottom Row position on container window in pixels coordinates. This property adjust the HEIGHT property according the ROW property.
      [ COLRIGHT nCol ]
n/a
  
Right Col position on container window in pixels coordinates. This property adjust the WIDTH property according the COL property.
      [ ENABLED .T. | .F. ]
.T.
  
Enable or Disable control
      [ CAPTION cCaption ]
NIL
  
A text expressions for the control
      [ AUTOSIZE .T. | .F. ]
.F.
  
Auto adjust control size to text
      [ FONTNAME "cFontName" ]
Parent.Fontname
  
Font family for control text
      [ FONTSIZE nPoints ]
Parent.FontSize
  
Font size for control text
      [ FONTBOLD .T. | .F. ]
.F.
  
Set Bold attribute to control text
      [ FONTITALIC .T. | .F. ]
.F.
  
Set Italic attribute to control text
      [ FONTUNDERLINE .T. | .F. ]
.F.
  
Set Underline attribute to control text
      [ FONTSTRIKEOUT .T. | .F. ]
.F.
  
Set Strikeout attribute to control text
      [ FONTBLINK .T. | .F. ]
.F.
  
Set Blink attribute to control text
      [ BORDER .T. | .F. ]
.F.
  ?
      [ FLAT .T. | .F. ]
.F.
  
Set Flat attibute for control. The control don't will have 3D aspect.
      [ PICTURE "cPictureName" ]
NIL
  
Picture name for display into control
      [ CLIENTEDGE .T. | .F. ]
.F.
  ?
      [ HSCROLL .T. | .F. ]
.F.
  ?
      [ VSCROLL .T. | .F. ]
.F.
  ?
      [ TRANSPARENT .T. | .F. ]
.T.
  Don't fill background control, set Transparent attibute
      [ NOTRANSPARENT .T. | .F. ]
.F.
  Property for control with bitmap picture (default: false)
      [ NOXPSTYLE .T. | .F. ]
.F.
  Preserve standard control look even on styled Windows XP (Only Windows OS)
      [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
      [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background color
      [ TOOLTIP cToolTip ]
NIL
  
Text for display into tooltip
      [ DEFAULT .T. | .F. ]
.F.
  ?
      [ VISIBLE .T. | .F. ]
.T.
  
Show or hide control (like methods SHOW and HIDE)
      [ VERTICAL .T. | .F. ]
.F.
  Clause is used to set Picture/Text aspect on control (default: false)
      [ NOTABSTOP .T. | .F. ]
.F.
  
This property force that TAB key doesn't stop in this control
      [ PARENT cControlParent ]   
Get or Set the control name of parent widget
      [ PARENTTYPE n/a ]   
Only for mg_get() function, this property returns the PARENT control type or "" if the parent was not set.
      [ DISABLEENTER .T. | .F. ]
.F.
  
By default, event ONCLICK also start by pressing the ENTER (or RETURN) key. Setting DISABLEENTER to .T. disable this behavior
      [ PERMANENT .T. | .F. ]
.F.
  
Only for controls defined into STATUSBAR. This property force this control as permanent statusbar message. Control will be placed at right corner of statusbar and it is never hidden. Used for important mode indications, for example, some applications put a Caps Lock indicator in the status bar.
      [ HASFOCUS ]
NIL
  
Only for mg_Get() function. This property returns .T. if control has the application focus
      [ CURSOR ]
Qt_ArrowCursor
  
Change the cursor pointer shape for the control. Go to to learn more about it.
      [ FORCEACTION .T. | .F. ]
.F.
  
It force the execution of the actions defined by methods like ACTION, ONENTER, ONCLICK, ONDBLCLICK, etc. when NOTABSTOP property was set '.T.'. This property is useful when application focus is over a control when a VALID clause and it doesn't permit lostfocus.
      [ ONCLICK cOnClick | {BOnClick} ]
NIL
  
An action to be performed when control is clicking
      [ ONGOTFOCUS cOnGotFocus | {BOnGotFocus} ]
NIL
  
An action to be performed when control is focused
      [ ONLOSTFOCUS cOnLostFocus | {BOnLostFocus} ]
NIL
  
An action to be performed when control is lost focused
      [ CREATE CONTEXT MENU [ cName ] ]   
CONTEXT MENU for control
            [ ......... ]   
You can see properties for this menu in CONTEXT MENU topic
      [ END MENU ]   
 
END BUTTON 

Jump to Context Menu topic



Methods


Methods
Status
Default
Planned
Started
Ready
Comments
    HIDE
n/a
  
This method HIDE the control
    SHOW
n/a
  
This method SHOW the control
    UNSETCURSOR
n/a
  
Reset the cursor pointer shape for the control to default (Qt_ArrowCursor). Go to to learn more about it.
    RELEASE
n/a
  
This method is used to destroy the control.
    SETFOCUS
n/a
  
This method put the program focus into control
    ONCLICK
n/a
  
Execute ONCLICK block coded in CREATE or seted by mg_Set
    ONGOTFOCUS
n/a
  
Execute ONGOTFOCUS block coded in CREATE or seted by mg_Set
    ONLOSTFOCUS
n/a
  
Execute ONLOSTFOCUS block coded in CREATE or seted by mg_Set



Example:

File: d_button.prg


#include "marinas-gui.ch"

MEMVAR cButtonName
MEMVAR nNumber

Function main()

   PRIVATE cButtonName := "d_Button"
   PRIVATE nNumber     := 33

   SET APPLSTYLE TO "MarinasLooks"

   CREATE WINDOW d_window
      ROW 0
      COL 0
      WIDTH 820
      HEIGHT 480
      CAPTION "Marinas-GUI Sample for Button Control"
      ICON "../resource/d_test.ico"
      BACKCOLOR {223,242,253}
      MAIN .T.

      d_button_def()

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

Return .T.


File: d_button_def.prg

#include "marinas-gui.ch"

Function d_button_def()

   CREATE BUTTON Button_0
      ROW   40
      COL   110
      CAPTION "Demo Button"
      ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "Button_0" , "caption" ))
      WIDTH 100
      HEIGHT 50
      TOOLTIP "Demo Button"

      CREATE CONTEXT MENU

         CREATE ITEM "Item 1 from Button"
            ONCLICK { || mg_MsgInfo( "Item 1 from Button" ) }
            PICTURE "../resource/d_test.png"
         END ITEM

         CREATE ITEM "Item 2 from Button"
            ONCLICK { || mg_MsgInfo( "Item 2 from Button" ) }
            PICTURE "../resource/d_test.png"
         END ITEM

      END MENU

   END BUTTON

  CREATE BUTTON demo_button_22
     ROW   40
     COL   240
     CAPTION "FontColor"
     FONTBOLD .T.
     FONTCOLOR  {255,0,0}
     ONCLICK {|| mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_22" , "caption" )) }
     WIDTH 100
     HEIGHT 50
     TOOLTIP "Demo Button with FontColor and FontBold"
   END BUTTON

   CREATE BUTTON demo_button_1
     ROW   40
     COL   360
     CAPTION "Bold+Italic"
     BACKCOLOR  {0,255,0}
     FONTBOLD .T.
     FONTITALIC .T.
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_1" , "caption" ))
     WIDTH 100
     HEIGHT 50
     TOOLTIP "Demo Bold+Italic"
   END BUTTON

   CREATE BUTTON demo_button_2
     ROW   40
     COL   480
     CAPTION "With DisableEnter"
     FONTBOLD .T.
     FONTITALIC .T.
     FONTUNDERLINE .T.
     DISABLEENTER .T.
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_2" , "caption" ))
     WIDTH 150
     HEIGHT 50
     TOOLTIP "Demo using UNDERLINE"
   END BUTTON

   CREATE BUTTON demo_button_3
     ROW   140
     COL   110
     CAPTION "FONTSIZE"
     BACKCOLOR  {255,0,0}
     FONTBOLD .T.
     FONTITALIC .T.
     FONTSIZE  15
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_3" , "caption" ))
     WIDTH 150
     HEIGHT 50
     TOOLTIP "Demo using FONTSIZE"
   END BUTTON

   CREATE BUTTON demo_button_4
     ROW   140
     COL   290
     CAPTION "FontStrikeout"
     FONTBOLD .T.
     FONTITALIC .T.
     FONTSIZE  15
     FONTSTRIKEOUT .T.
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_4" , "caption" ))
     WIDTH 200
     HEIGHT 50
     TOOLTIP "Demo using FontStrikeout"
   END BUTTON

   CREATE BUTTON demo_button_5
     ROW   140
     COL   520
     CAPTION "Flat"
     PICTURE "../resource/d_test.png"
     FONTBOLD .T.
     FONTSIZE  15
     FLAT .T.
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_5" , "caption" ))
     WIDTH 100
     HEIGHT 50
     TOOLTIP "Demo FLAT"
   END BUTTON

  CREATE BUTTON demo_button_23
     ROW   240
     COL   110
     CAPTION "DEMO BUTTON"
     PICTURE "../resource/d_test.png"
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , "demo_button_23" , "caption" ))
     WIDTH 150
     HEIGHT 50
     TOOLTIP "Demo using IMAGE"
  END BUTTON


  CREATE BUTTON demo_button_24
     ROW   240
     COL   315
     CAPTION "Blinking Caption"
     ONCLICK mg_set( "d_window" , "demo_button_24" , "fontBlink" , !mg_get( "d_window" , "demo_button_24" , "fontBlink" ) )
     WIDTH 110
     FONTBLINK .T.
     HEIGHT 50
     TRANSPARENT .T.
     TOOLTIP "Demo FontBlink Caption"
   END BUTTON

   CREATE BUTTON demo_button_6
     ROW   340
     COL   110
     CAPTION "Without Focus"
     FONTBOLD .T.
     FONTSIZE  13
     FONTCOLOR {255,0,0}
     ONGOTFOCUS mg_Set( "d_window" , "demo_button_6" , "caption" , "Focused !!!" )
     ONLOSTFOCUS mg_Set( "d_window" , "demo_button_6" , "caption" , "Without Focus" )
     WIDTH 150
     HEIGHT 50
     TOOLTIP "Button with OnGotFocus and OnLostFocus properties"
   END BUTTON

   CREATE BUTTON &( M->cButtonName + "__" + alltrim( str( M->nNumber ) ) )
     ROW   340
     COL   290
     CAPTION "Demo Button AutoSize, Variable Name and BackColor"
     BACKCOLOR  {0,0,255}
     FONTCOLOR  {255,255,255}
     ONCLICK mg_MsgInfo("Click from Button " + mg_Get( "d_window" , M->cButtonName + "__" + alltrim( str( M->nNumber ) ) , "caption" ))
     AUTOSIZE .T.
     TOOLTIP "Demo Button with OnClick property"
   END BUTTON

   CREATE BUTTON demo_button_Exit
     ROW   240
     COL   480
     CAPTION "Exit Demo"
     FONTBOLD .T.
     FONTSIZE  15
     PICTURE "../resource/d_test_stop.png"
     ONCLICK if( mg_msgyesno( "Are you sure?" , "Exit Demo" ) , mg_Do( "d_window" , "release" ) , )
     WIDTH 150
     HEIGHT 50
     TOOLTIP "Exit Demo"
   END BUTTON

Return .T.



Marinas-GUI Version 03.06 and
Marinas-IDE Version 05.06 and
LEX Files Version 02.06


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
last update: March 09
2017
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




A Harbour/QT framework to make multiplatform programs

(©) Copyright 2009-2017 by Fernando Santolin (aka CarozoDeQuilmes)
CarozoDeQuilmes@gmail.com

2009-2017 Beta tester and full English translator: Bruno Luciani
Bruno.Luciani@gmail.com

2014-2015 Final English corrector: David Worboys
DavidWorboys@hotmail.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Jump to Donation Topic


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

www.marinas-gui.org


www.marinas-gui.org  

Previous topic  First topic  Next topic