Main Menu
Previous topic  First topic  Next topic





Define and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE MAIN MENU cName | (cVarName) | &(cExpression) 
      [ ; OF cWindow ]
Parent.Name
  
A reference to the Parent Window
      [ 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
      [ HEIGHT ]   
Only for mg_Get() function. The desired height size of the Control in pixels
      [ VISIBLE .T. | .F. ]
.T.
  ?
      [ 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 POPUP cName ]   
Name of Popup
            [ CAPTION cCaption ]
NIL
  
A text expressions for the popup subject
            [ POPUPNAME cName ]
NIL
  
Popup name for mg_Set()/mg_Get() properties or mg_Do() Methods
            [ PICTURE cImageName ]
NIL
  
Image for display in Popup Name
            [ 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
            [ CURSOR ]
Qt_ArrowCursor
  
Change the cursor pointer shape for the control. Go to to learn more about it.
             CREATE ITEM cName    
Name of Menu Item
                  [ CAPTION cCaption ]
NIL
  
A text expressions for the item subject
                  [ ITEMNAME cName ]
NIL
  
Item name for mg_Set()/mg_Get() properties or mg_Do() Methods
                  [ PICTURE cImageName ]
NIL
  
Image for display in Item Name
                  [ CHECKMARK cCheckMark ]
NIL
  ?
                  [ 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
                  [ CHECKED .T. | .F. ]
.F.
  
Initialize Item with Check Mark
                  [ ENABLED .T. | .F. ]
.T.
  
Enable or Disable item
                  [ MESSAGE cMessage ]
NIL
  ?
                  [ 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
                  [ CURSOR ]
Qt_ArrowCursor
  
Change the cursor pointer shape for the control. Go to to learn more about it.
            [ END ITEM ]   
 
             .........    
 
             .........    
 
            [ CREATE ITEM ]   
 
            [ END ITEM ]   
 
            [ CREATE POPUP ]   
 
                  [ CREATE ITEM ]   
 
                  [ END ITEM ]   
 
                  [ CREATE ITEM ]   
 
                  [ END ITEM ]   
 
                  [ ......... ]   
 
                  [ CREATE ITEM ]   
 
                  [ END ITEM ]   
 
            [ END POPUP ]   
 
            [ ......... ]   
 
            [ SEPARATOR ]   
 
      [ END POPUP ]   
 
            [ ......... ]   
 
            [ ......... ]   
 
      [ CREATE POPUP ]   
 
            [ CREATE ITEM ]   
 
            [ ......... ]   
 
            [ ......... ]   
 
            [ END ITEM ]   
 
            [ CREATE ITEM ]   
 
            [ ......... ]   
 
            [ END ITEM ]   
 
            [ SEPARATOR ]   
 
      [ END POPUP ]   
 
            [ ......... ]   
 
            [ ......... ]   
 
END MENU 



Methods for Main Menu


Methods
Status
Default
Planned
Started
Ready
Comments
    GETCHILDREN
n/a
  
This method return an array containing a list of controls that have this control as parent
    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
    HIDE
n/a
 
 This method HIDE the control
    SHOW
n/a
  
This method SHOW the control



Methods for Popups


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.
    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 Items


Methods
Status
Default
Planned
Started
Ready
Comments
    ONCLICK
n/a
  
Execute ONCLICK block coded in CREATE or seted by mg_Set
    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



Example:

File: d_mainmenu.prg


#include "marinas-gui.ch"

Function Main

   SET APPLSTYLE TO "MarinasLooks"

   CREATE WINDOW d_window
      ROW 0
      COL 0
      WIDTH 820 ; HEIGHT 130
      CAPTION "Marinas-GUI Menu Demo Control"
      ICON "../resource/d_test.ico"
      MAIN .T.

      d_mainmenu_def()

      CREATE LABEL Label1
         ROW 25
         COL 190
         VALUE "This is only a sample for Menu System"
         FONTSIZE 16
         FONTCOLOR { 0 , 0 , 255 }
         FONTBOLD .T.
         FONTITALIC .F.
         AUTOSIZE .T.
      END LABEL

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

Return Nil


File: d_mainmenu_def.prg

#include "marinas-gui.ch"

Function d_mainmenu_def()

   CREATE MAIN MENU OF d_window
      FONTCOLOR {255,255,255}
      BACKCOLOR {128,128,255}
      FONTBOLD .T.
      FONTSIZE 10

      CREATE POPUP "&Menu 1"
      // FONTCOLOR {255,255,255}
      // BACKCOLOR {  0,  0,255}

         CREATE ITEM "Item 1 (Disabled)"
            ONCLICK mg_MsgInfo( "Click from Item 1" )
            ITEMNAME item1
#if !defined( __PLATFORM__DARWIN )
            FONTNAME "mg_monospace"
#endif
            PICTURE "../resource/d_test.png"
            ENABLED .F.
         END ITEM

         CREATE ITEM "Item 2"
            ONCLICK mg_MsgInfo( "Click from Item 2" )
            ITEMNAME item2
            PICTURE "../resource/d_test.png"
         END ITEM

         SEPARATOR

         CREATE ITEM "Item 3 (Checked)"
            ONCLICK mg_MsgInfo( "Click from Item 3" )
            CHECKED .T.
         END ITEM

         CREATE POPUP "More..."

            CREATE ITEM "SubItem 1"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
            END ITEM

            CREATE ITEM "SubItem 2"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
               PICTURE "../resource/d_test.png"
            END ITEM

            CREATE ITEM "SubItem 3"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
            END ITEM

            CREATE POPUP "More..."

               CREATE ITEM "SubItem of SubItem 4"
                  ONCLICK mg_MsgInfo( "SubItem Clicked" )
                  PICTURE "../resource/d_test.png"
               END ITEM

               CREATE POPUP "More..."

                  CREATE ITEM "SubItem 1"
                     ONCLICK mg_MsgInfo( "SubItem Clicked" )
                  END ITEM

                  CREATE ITEM "SubItem 2"
                     ONCLICK mg_MsgInfo( "SubItem Clicked" )
                     PICTURE "../resource/d_test.png"
                  END ITEM

                  CREATE ITEM "SubItem 3"
                     ONCLICK mg_MsgInfo( "SubItem Clicked" )
                  END ITEM

                  CREATE POPUP "More..."

                     CREATE ITEM "SubItem of SubItem 4"
                        ONCLICK mg_MsgInfo( "SubItem Clicked" )
                        PICTURE "../resource/d_test.png"
                     END ITEM

                  END POPUP

                  CREATE ITEM "SubItem 5"
                     ONCLICK mg_MsgInfo( "SubItem Clicked" )
                  END ITEM

                  SEPARATOR

                  CREATE ITEM "SubItem 6"
                     ONCLICK mg_MsgInfo( "SubItem2 Clicked" )
                  END ITEM

               END POPUP

               SEPARATOR

            END POPUP

            CREATE ITEM "SubItem 5"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
            END ITEM

            SEPARATOR

            CREATE ITEM "SubItem 6"
               ONCLICK mg_MsgInfo( "SubItem2 Clicked" )
            END ITEM

         END POPUP

         SEPARATOR

#if !defined( __PLATFORM__DARWIN )
         CREATE ITEM "Item width FontSize"
            PICTURE "../resource/d_test.png"
            FONTSIZE 22
            ONCLICK mg_MsgInfo( "Click from Item 5" )
         END ITEM
#endif

         SEPARATOR

         if mg_IsVarDefined( "mg_MainDemo" )

            CREATE ITEM "Activate Modal Window"
               ONCLICK &( 'MakeSubWindow( "Modal_1" , 1 , 35 )' )
               PICTURE "../resource/d_window_modal.png"
            END ITEM

            SEPARATOR

         endif

         CREATE ITEM "Exit"
            ONCLICK if( mg_msgyesno( "Are you sure?" , "Exit Demo" ) , mg_Do( mg_GetLastActivatedWindowName() , "release" ) , )
            PICTURE "../resource/d_test_stop.png"
         END ITEM

      END POPUP

      CREATE POPUP "M&enu 2"
         FONTSIZE 15
         FONTCOLOR {255,255,255}
         BACKCOLOR {255,  0,  0}

         CREATE ITEM "Item 1"
            ONCLICK mg_MsgInfo( "Click from Item 1" )
            PICTURE "../resource/d_test.png"
         END ITEM

         CREATE ITEM "Item 2"
            ONCLICK mg_MsgInfo( "Click from Item 2" )
         END ITEM

      // CREATE ITEM "Item 3 (CheckMark)"
         CREATE ITEM "Item 3"
            ONCLICK mg_MsgInfo( "Click from Item 3" )
         // CHECKMARK "../resource/d_test.png"
         END ITEM

         CREATE POPUP "More..."

            CREATE ITEM "SubItem 1"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
            END ITEM

            CREATE ITEM "SubItem 2"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
               PICTURE "../resource/d_test.png"
            END ITEM

            CREATE ITEM "SubItem 3"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
            END ITEM

            CREATE POPUP "More..."

               CREATE ITEM "SubItem of SubItem 4"
                  ONCLICK mg_MsgInfo( "SubItem Clicked" )
                  PICTURE "../resource/d_test.png"
               END ITEM

            END POPUP

            CREATE ITEM "SubItem 5"
               ONCLICK mg_MsgInfo( "SubItem Clicked" )
            END ITEM

            SEPARATOR

            CREATE POPUP "More2..."

               CREATE ITEM "SubItem of SubItem 4"
                  ONCLICK mg_MsgInfo( "SubItem Clicked" )
                  PICTURE "../resource/d_test.png"
               END ITEM

            END POPUP

            CREATE ITEM "SubItem 6"
               ONCLICK mg_MsgInfo( "SubItem2 Clicked" )
            END ITEM

         END POPUP

         SEPARATOR

         CREATE ITEM "Item 5"
            ONCLICK mg_MsgInfo( "Click from Item 5" )
            PICTURE "../resource/d_test.png"
         END ITEM

      END POPUP

      CREATE POPUP "&InputDialog"
         CREATE ITEM "Get &String Value"
            ONCLICK {|| mg_MsgInfo( mg_allStr( mg_InputDialog( "InputBox Sample" , "Enter Value:" , "Initial Value" ) ) ) }
         END ITEM
         SEPARATOR
         CREATE ITEM "Get &Password"
            ONCLICK {|| mg_MsgInfo( mg_allStr( mg_InputDialog( "InputBox Sample" , "Enter Value:" , "" , .T. ) ) ) }       // 4th parameter in .T. is for password type
         END ITEM
         SEPARATOR
         CREATE ITEM "Get &Numeric Value"
            ONCLICK {|| mg_MsgInfo( mg_allStr( mg_InputDialog( "InputBox Sample" , "Enter Value:" , 0 ) ) ) }
         END ITEM
         CREATE ITEM "Get Numeric Value with &Decimals"
            ONCLICK {|| mg_MsgInfo( mg_allStr( mg_InputDialog( "InputBox Sample" , "Enter Value:" , 0.000 ) ) ) }
         END ITEM
      END POPUP

      CREATE POPUP "&Info"
         CREATE ITEM "Show System Information"
            ONCLICK {|| mg_Log( mg_SysInfo() ) }
         END ITEM
         SEPARATOR
         CREATE ITEM "Show Desktop Information"
            ONCLICK {|| mg_Log( HB_OsNewLine() + mg_DesktopInfo() ) }
         END ITEM
         SEPARATOR
         CREATE ITEM "Show Internal Information"
            ONCLICK {|| mg_Log( mg_GetInternalInfo() ) }
         END ITEM
      END POPUP

      if mg_IsVarDefined( "mg_MainDemo" )

         CREATE POPUP "&Other"
            CREATE ITEM "TextBox with ENTERTAB"
               ONCLICK &( 'TextBox_SampleENTERTAB()' )
            END ITEM
            SEPARATOR
            CREATE ITEM "Clipboard Sample"
               ONCLICK &( 'd_clipboard_def()' )
            END ITEM
            SEPARATOR
            CREATE ITEM "Generate stand alone BARCODE file"
               ONCLICK &( 'Barcode_SampleSaveToFile()' )
            END ITEM
         END POPUP

      endif

      CREATE POPUP "&Help"
      // PICTURE "../resource/d_test.png"

         CREATE ITEM "About"
            ONCLICK { || 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() ) }
            PICTURE "../resource/d_test.png"
         END ITEM

      END POPUP

   END MENU

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