ToolBar
Previous topic  First topic  Next topic





Define and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE TOOLBAR cName | (cVarName) | &(cExpression) 
      [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background color
      [ FIXED .T. | .F. ]
.F.
  
Set ToolBar not movable
      [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
      [ 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
      [ HEIGHT ]   
Only for mg_Get() function. The desired height size of the Control in pixels
      [ ITEMCOUNT ]   
Only for mg_Get() function. It returns the total amount of items in control (ToolButtons, Widgets, etc.)
      [ TOOLTIP cToolTip ]
NIL
  
Text for display into tooltip
      [ VISIBLE .T. | .F. ]
.T.
  Show or hide control (like methods SHOW and HIDE)
      [ BUTTONHEIGHT nButtonHeight ]   
Set ToolButtons Heights. By default, ToolButtton size is managed by application style. If you add an ICON with height less than ButtonHeight, the ICON will not be enlarged, but, if the ICON height is greater than ButtonHeight, the ICON will be reduced.
      [ BUTTONWIDTH nButtonWidth ]   
Set ToolButtons Widths. By default, ToolButtton size is managed by application style. If you add an ICON with width less than ButtonWidth, the ICON will not be enlarged, but, if the ICON width is greater than ButtonWidth, the ICON will be reduced.
      [ BUTTONSTYLE nButtonStyle ]
Qt_ToolButtonTextUnderIcon
  
Button Style. Accepted values are:
Qt_ToolButtonIconOnly = Only display the icon.
Qt_ToolButtonTextOnly = Only display the text.
Qt_ToolButtonTextBesideIcon = The text appears beside the icon.
Qt_ToolButtonTextUnderIcon = The text appears under the icon.
      [ HASFOCUS ]   
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.
      [ NOTABSTOP .T. | .F. ]
.F.
  
This property force that TAB key doesn't stop in this control
      [ CONTEXTMENUSUPRESSED .T. | .F. ]
.F.
  
Disable the display of the Context Menu of control.
      [ CREATE TOOLBUTTON cName ]   
Name of ToolButton
            [ CAPTION cCaption ]
NIL
  
A text expressions for the popup subject
            [ PICTURE cImageName ]
NIL
  
Image for display in Popup Name
            [ CHECKABLE .T. | .F. ]
.F.
  
Allow user to check button
            [ CHECKED .T. | .F. ]
.F.
  
Check button (if button is CHECKEABLE)
            [ 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
            [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
            [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background color
            [ ENABLED .T. | .F. ]
.T.
  
Enable or Disable popup
            [ TOOLTIP cToolTip ]
NIL
  
Text for display into tooltip
            [ BUTTONHEIGHT nButtonHeight ]
ToolBar.ButtonHeight
  
This property overrides ToolBar BUTTONHEIGHT for this button only. By default, ToolButtton size is managed by application style. If you add an ICON with height less than ButtonHeight, the ICON will not be enlarged, but, if the ICON height is greater than ButtonHeight, the ICON will be reduced.
            [ BUTTONWIDTH nButtonWidth ]
ToolBar.ButtonWidth
  
This property overrides ToolBar BUTTONWIDTH for this button only. By default, ToolButtton size is managed by application style. If you add an ICON with width less than ButtonWidth, the ICON will not be enlarged, but, if the ICON width is greater than ButtonWidth, the ICON will be reduced.
            [ BUTTONSTYLE nButtonStyle ]
ToolBar.ButtonStyle
  
This property overrides ToolBar BUTTONSTYLE for this button only. Accepted values are:
Qt_ToolButtonIconOnly = Only display the icon.
Qt_ToolButtonTextOnly = Only display the text.
Qt_ToolButtonTextBesideIcon = The text appears beside the icon.
Qt_ToolButtonTextUnderIcon = The text appears under the icon.
            [ RIGHTTEXT .T. | .F. ]
.F.
  
OBSOLET. This property has been replaced by BUTTONSTYLE
            [ HASFOCUS ]   
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.
            [ NOTABSTOP .T. | .F. ]
.F.
  
This property force that TAB key doesn't stop in this control
            [ 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} ]   
An action to be performed when control is clicking
            [ CREATE DROPDOWN MENU BUTTON cButtonName [ cName ] ]   
DROPDOWN MENU for Button cButtonName
                  [ 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
                  [ 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
      [ CURSOR ]
Qt_ArrowCursor
  
Change the cursor pointer shape for the control. Go to to learn more about it.
                  [ CREATE ITEM cName ]   
You can see description for this menu in MAIN MENU control.
                        [ ......... ]   
 
                        [ ......... ]   
 
                  [ END ITEM ]   
 
                  [ CREATE ITEM ]   
 
                        [ ......... ]   
 
                        [ ......... ]   
 
                  [ END ITEM ]   
 
                  [ CREATE POPUP ]   
 
                        [ ......... ]   
 
                        [ ......... ]   
 
                        [ CREATE ITEM ]   
 
                              [ ......... ]   
 
                              [ ......... ]   
 
                        [ END ITEM ]   
 
                        [ CREATE ITEM ]   
 
                              [ ......... ]   
 
                              [ ......... ]   
 
                        [ END ITEM ]   
 
                  [ END POPUP ]   
 
            [ END MENU ]   
 
            [ ......... ]   
 
            [ ......... ]   
 
      [ END TOOLBUTTON ]   
 
      [ CREATE CONTEXT MENU [ cName ] ]   
CONTEXT MENU for control
            [ ......... ]   
You can see properties for this menu in CONTEXT MENU topic
      [ END MENU ]   
 
END TOOLBAR 

Jump to Main Menu Topic
Jump to Context Menu topic



Methods for ToolBar


Methods
Status
Default
Planned
Started
Ready
Comments
    HIDE
n/a
  
This method HIDE the control
    SHOW
n/a
  
This method SHOW the control
    RELEASE
n/a
  
This method is used to destroy the control.
    GETCHILDREN
n/a
  
This method return an array containing a list of controls that have this control as parent
    GETCONTROLS
n/a
  
This method return an array containing a list of controls that have this control as parent, except those that are not shown on screen (e.g. TIMER or CONTEXTMENU)
    UNSETCURSOR
n/a
  
Reset the cursor pointer shape for the control to default (Qt_ArrowCursor). Go to to learn more about it.
    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



Methods for ToolButton


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



Methods for DropDownMenu


Methods
Status
Default
Planned
Started
Ready
Comments
    UNSETCURSOR
n/a
  
Reset the cursor pointer shape for the control to default (Qt_ArrowCursor). Go to to learn more about it.
    GETCHILDREN
n/a
  
This method return an array containing a list of controls that have this control as parent

Jump to Main Menu Topic



Methods for DropDownMenu Items


Methods
Status
Default
Planned
Started
Ready
Comments
    .........
n/a
  
You can see methods for ITEMs in MAIN MENU Control

Jump to Main Menu Topic



Methods for DropDownMenu Popups


Methods
Status
Default
Planned
Started
Ready
Comments
    .........
n/a
  
You can see methods for POPUPs in MAIN MENU Control

Jump to Main Menu Topic



Example:

File: d_toolbar.prg


#include "marinas-gui.ch"

Function Main

   SET APPLSTYLE TO "MarinasLooks"

   CREATE WINDOW d_window
      ROW 0
      COL 0
      WIDTH 820 ; HEIGHT 430
      CAPTION "Marinas-GUI Demo ToolBar Control"
      ICON "../resource/d_test.ico"
      MAIN .T.
 //   ONINIT {|| mg_SaveScreen( "d_window" , "../doc/d_toolbar.png" ) }

      d_toolbar_def()

      CREATE LABEL Label9383
         ROW 120
         COL 190
         VALUE "This is only a sample for ToolBar control"
         FONTSIZE 16
         FONTCOLOR { 255 , 0 , 0 }
         FONTBOLD .T.
         FONTITALIC .F.
         AUTOSIZE .T.
      END LABEL

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

Return Nil


File: d_toolbar_def.prg

#include "marinas-gui.ch"

Function d_toolbar_def()

   CREATE TOOLBAR myToolBar
      TOOLTIP "ToolBar ToolTip"

      CREATE CONTEXT MENU

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

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

      END MENU

      CREATE TOOLBUTTON ToolBar_Button_1
         CAPTION "Exit Demo"
         TOOLTIP "Button Exit Tooltip"
         ONCLICK if( mg_msgyesno( "Are you sure?" , "Exit Demo" ) , mg_Do( "d_window" , "release" ) , )
         PICTURE "../resource/d_test_stop.png"
         BUTTONSTYLE Qt_ToolButtonTextBesideIcon

         CREATE CONTEXT MENU

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

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

         END MENU

      END TOOLBUTTON

      if mg_IsVarDefined( "mg_MainDemo" )

         TOOLBARSEPARATOR

         CREATE TOOLBUTTON ToolBar_Button_2
            CAPTION "Start a Modal Window"
            TOOLTIP "Start Modal Window Tooltip"
            ONCLICK &( 'MakeSubWindow( "Modal_1" , 1 , 35 )' )
            PICTURE "../resource/d_window_modal.png"
         END TOOLBUTTON

      endif

      TOOLBARSEPARATOR

      CREATE TOOLBUTTON ToolBar_Button_4
         CAPTION "About"
         TOOLTIP "Button About Tooltip"
         ONCLICK ToolBarAbout()
         PICTURE "../resource/d_test.png"

                  CREATE DROPDOWN MENU BUTTON ToolBar_Button_4

                         CREATE ITEM 'About'
                            ONCLICK { || ToolBarAbout() }
                            PICTURE "../resource/d_test.png"
                            ITEMNAME about
                         END ITEM

                         SEPARATOR

                         CREATE ITEM 'Test'
                            ONCLICK mg_MsgInfo( "Test" )
                         END ITEM

                         CREATE ITEM 'Test2'
                            ONCLICK mg_MsgInfo( "Test2" )
                         END ITEM

                         CREATE ITEM 'Test3'
                            ONCLICK mg_MsgInfo( "Test3" )
                         END ITEM

                         CREATE ITEM 'Test4'
                            ONCLICK mg_MsgInfo( "Test4" )
                         END ITEM

                         CREATE POPUP 'my Popup'
                            PICTURE "../resource/d_test.png"

                            CREATE ITEM 'TestA'
                               ONCLICK mg_MsgInfo( "TestA" )
                            END ITEM

                            CREATE ITEM 'TestB'
                               ONCLICK mg_MsgInfo( "TestB" )
                               PICTURE "../resource/d_test.png"
                            END ITEM

                         END POPUP

                         CREATE ITEM 'Test5'
                            ONCLICK mg_MsgInfo( "Test5" )
                            PICTURE "../resource/d_test.png"
                         END ITEM

                  END MENU

      END TOOLBUTTON

      TOOLBARSEPARATOR

   END TOOLBAR

Return .T.

Function ToolBarAbout()
   mg_MsgInfo( "Marinas-GUI version: " + mg_Version() + Hb_OsNewLine() + "Building with Qt " + mg_QtBuildVersion() + " in " + mg_GetLinkQtMode() + " mode." + HB_OsNewLine() + "Running with " + mg_GetLinkQtMode() + " Qt libraries version " + mg_QtRunVersion() + Hb_OsNewLine() + ;
                "CodePage: " + hb_cdpInfo() + Hb_OsNewLine() + hb_langName() + hb_eol() + hb_eol() + mg_sysInfo() )
Return .T.



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


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
last update: April 27
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

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

www.marinas-gui.org


www.marinas-gui.org  

Previous topic  First topic  Next topic