Dialogs
Previous topic  First topic  Next topic




You can see code at botton this topic

Usted puede ver el codigo en el final de este tópico


FILE and FOLDER Dialog






You can start the dialog by using these functions: mg_GetFile, mg_PutFile, mg_GetFolder or mg_PutFolder

Another way is creating a FILEFOLDER control in your window


Usted puede arrancar este diálogo usando las siguientes funciones: mg_GetFile, mg_PutFile, mg_GetFolder o mg_PutFolder

Otra forma de hacerlo es creando un control de tipo FILEFOLDER en su ventana



FILEFOLDER Create and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE FILEFOLDER 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.
      [ CAPTION cCaption ]
Select file
  
A title expressions for the FILEFOLDER dialog
      [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background 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
      [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
      [ ALLOWMULTISELECT .T. | .F. ]
.F.
  
Allow user to select one file or more in GETFILE MODE
      [ ALLOWNEWFILE .T. | .F. ]
.F.
  
Allow user to specity a new file name or folder name in textbox of FILEFOLDER dialog.
      [ BASEFOLDER cFolderName ]
Current Folder
  
Default folder to open FILEFOLDER dialog
      [ FILTERS aFilters ]
{ { 'All files' , mg_GetMaskAllFiles() } }
  
Default filter to open FILEFOLDER dialog in the format: { { 'All files' , '*.*' } [ , { 'Data Base Files' , "*.dbf" } ] }
      [ LASTSELECTEDFILES ]   
Only for mg_Get() function. This property returns a string with file name selected or, for ALLOWMULTISELECT, it returns an array with selected file names
      [ MODE "GETFILE" | "PUTFILE" | "GETFOLDER" | "PUTFOLDER" ]
"GETFILE"
  
Specify main operation for FILEFOLDER dialog. "GETFILE" allow select files (one or more), "PUTFILE" allow specify only one output file, "GETFOLDER" allow select one folder, "PUTFOLDER" allow specify only one output folder.
      [ 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.
END FILEFOLDER 



FILEFOLDER Methods


Methods
Status
Default
Planned
Started
Ready
Comments
    CENTER
n/a
  
This method set the filefolder dialog centred into desktop
    UNSETCURSOR
n/a
  
Reset the cursor pointer shape for the control to default (Qt_ArrowCursor). Go to to learn more about it.
    EXEC
n/a
  
This method is used to ACTIVATE the FILEFOLDER dialog and return the same that LASTSELECTEDFILES property or Get and Put functions for Files and Folders (mg_GetFile, mg_PutFile, mg_GetFolder, mg_PutFolder)
    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



COLOR Dialog






You can start the dialog by using this function: mg_GetColor

Another way is creating a COLORDIALOG control in your window


Usted puede arrancar este diálogo usando la siguiente funcion: mg_GetColor

Otra forma de hacerlo es creando un control de tipo COLORDIALOG en su ventana



COLORDIALOG Create and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE COLORDIALOG 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.
      [ CAPTION cCaption ]
Select file
  
A title expressions for the COLORDIALOG dialog
      [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background 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
      [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
      [ BASECOLOR aBaseColor ]
{ 192, 192, 192 }
  
Initial folder to open COLORDIALOG dialog
      [ LASTSELECTEDCOLOR ]   
Only for mg_Get() function. This property returns an array with new color selected. If dialog was canceled, this value is an empty array
      [ 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.
END COLORDIALOG 



COLORDIALOG Methods


Methods
Status
Default
Planned
Started
Ready
Comments
    CENTER
n/a
  
This method set the ColorDialog dialog centred into desktop
    UNSETCURSOR
n/a
  
Reset the cursor pointer shape for the control to default (Qt_ArrowCursor). Go to to learn more about it.
    EXEC
n/a
  
This method is used to ACTIVATE the COLORDIALOG dialog and return the same that LASTSELECTEDCOLOR property or mg_GetColor function
    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



FONT Dialog






You can start the dialog by using this function: mg_GetFont

Another way is creating a FONTDIALOG control in your window


Usted puede arrancar este diálogo usando la siguiente funcion: mg_GetFont

Otra forma de hacerlo es creando un control de tipo FONTDIALOG en su ventana



FONTDIALOG Create and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE FONTDIALOG 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.
      [ CAPTION cCaption ]
Select file
  
A title expressions for the FONTDIALOG dialog
      [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background 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
      [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
      [ INITIALFONTNAME "cFontName" ]
Default Fontname
  
Initial FontName (family) for dialog
      [ INITIALFONTSIZE nPoints ]
Default FontSize
  
Initial FontSize for dialog
      [ INITIALFONTBOLD .T. | .F. ]
.F.
  
Initial FontBold for dialog
      [ INITIALFONTITALIC .T. | .F. ]
.F.
  
Initial FontItalic for dialog
      [ INITIALFONTUNDERLINE .T. | .F. ]
.F.
  
Initial FontUnderline for dialog
      [ INITIALFONTSTRIKEOUT .T. | .F. ]
.F.
  
Initial FontStrikeout for dialog
      [ LASTSELECTEDFONT ]   
Only for mg_Get() function. This property returns a HASH with all new attributes selected: "FontName", "FontSize", "FontBold", "FontItalic", "FontUnderline" and "FontStrikeout". For example: Key "FontName" with value "mg_normal"
      [ 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.
END FONTDIALOG 



FONTDIALOG Methods


Methods
Status
Default
Planned
Started
Ready
Comments
    CENTER
n/a
  
This method set the FONTDIALOG dialog centred into desktop
    EXEC
n/a
  
This method is used to ACTIVATE the FONTDIALOG dialog and return the same that LASTSELECTEDFONT property or mg_GetFont function
    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_dialogs.prg


#include "marinas-gui.ch"

Function main()

   SET NATIVE FILE DIALOG TO .T.

   SET APPLSTYLE TO "MarinasLooks"

   CREATE WINDOW d_window
      ROW 0 ; COL 0
      WIDTH 820 ; HEIGHT 480
      CAPTION "Marinas-GUI Sample for Dialog Controls"
      ICON "../resource/d_test.ico"
      BACKCOLOR {216,237,236}
      MAIN .T.

      d_dialogs_def()

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

Return .T.


File: d_dialogs_def.prg

#include "marinas-gui.ch"

Function d_dialogs_def()

     CREATE FRAMEBOX Dial_FrameBox_File
            ROW    50
            COL    140
            WIDTH  530
            HEIGHT 110
            CAPTION "File/Folder Dialog"
     END FRAMEBOX

    CREATE BUTTON Dial_Button_File
           ROW    75
           COL    200
           WIDTH  410
           HEIGHT 28
           CAPTION "Press here to get a new File"
           ONCLICK Dial_GetFile()
     END BUTTON

    CREATE LABEL Dial_Label_File
           ROW    115
           COL    200
           WIDTH  410
           HEIGHT 28
           FONTCOLOR {255,0,0}
           FONTBOLD .T.
           VALUE ExeName()
           ALIGN Qt_AlignCenter
     END LABEL

     CREATE FRAMEBOX Dial_FrameBox_Color
            ROW    180
            COL    140
            WIDTH  530
            HEIGHT 110
            CAPTION "Color Dialog"
            BACKCOLOR {21,190,204}
     END FRAMEBOX

    CREATE BUTTON Dial_Button_Color
           ROW    220
           COL    200
           WIDTH  410
           HEIGHT 28
           CAPTION "Press here to get new backcolor"
           ONCLICK Dial_GetColor()
     END BUTTON

     CREATE FRAMEBOX Dial_FrameBox_Font
            ROW    310
            COL    140
            WIDTH  530
            HEIGHT 110
            CAPTION "Font Dialog"
     END FRAMEBOX

    CREATE BUTTON Dial_Button_Font
           ROW    335
           COL    200
           WIDTH  410
           HEIGHT 28
           CAPTION "Press here to get new Font"
           ONCLICK Dial_GetFont()
     END BUTTON

    CREATE LABEL Dial_Label_Font
           ROW    365
           COL    145
           WIDTH  520
           HEIGHT 50
           FONTCOLOR {0,0,255}
           ALIGN Qt_AlignCenter
           VALUE "FontName: " + mg_Get( "d_window" , "Dial_Label_Font" , "FontName" ) + " with size " + mg_AllStr( mg_Get( "d_window" , "Dial_Label_Font" , "FontSize" ) )
     END LABEL

Return .T.

Function Dial_GetFile()
   Local cFileAux
   cFileAux := mg_getFile( { { "All Files" , mg_GetMaskAllFiles() } } , "Select File" , mg_Get( "d_window" , "Dial_Label_File" , "value" ) )
   if !empty( cFileAux )
      mg_Set( "d_window" , "Dial_Label_File" , "value" , cFileAux )
   endif
Return .T.

Function Dial_GetColor()
   Local aColorAux
   aColorAux := mg_getColor( "Select Color" , mg_Get( "d_window" , "Dial_FrameBox_Color" , "backcolor" ) )
   if !empty( aColorAux )
      mg_Set( "d_window" , "Dial_FrameBox_Color" , "backcolor" , aColorAux )
   endif
Return .T.

Function Dial_GetFont()
   Local HFontAux
   Local nInx
   Local aKeys
   //
   Local HInitialAttributes
   HInitialAttributes := HB_Hash()
   HB_HSetCaseMatch( HInitialAttributes , .F. )
   HInitialAttributes[ "InitialFontName" ] := mg_Get( "d_window" , "Dial_Label_Font" , "fontname" )
   HInitialAttributes[ "InitialFontSize" ] := mg_Get( "d_window" , "Dial_Label_Font" , "fontsize" )
   HInitialAttributes[ "InitialFontBold" ] := mg_Get( "d_window" , "Dial_Label_Font" , "fontbold" )
   HInitialAttributes[ "InitialFontItalic" ] := mg_Get( "d_window" , "Dial_Label_Font" , "fontitalic" )
   HInitialAttributes[ "InitialFontUnderline" ] := mg_Get( "d_window" , "Dial_Label_Font" , "fontunderline" )
   HInitialAttributes[ "InitialFontStrikeOut" ] := mg_Get( "d_window" , "Dial_Label_Font" , "fontstrikeout" )
   //
   HFontAux := mg_getFont( "Select Font" , HInitialAttributes )
   if !empty( HFontAux )
      aKeys := HB_HKeys( HFontAux )
      for nInx := 1 to len( aKeys )
         mg_Set( "d_window" , "Dial_Label_Font" , aKeys[ nInx ] , HFontAux[ aKeys[ nInx ] ] )
      next
      mg_Set( "d_window" , "Dial_Label_Font" , "value" , "FontName: " + HFontAux[ "FontName" ] + " with size " + mg_AllStr( HFontAux[ "FontSize" ] ) )
   endif
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