ProgressBar
Previous topic  First topic  Next topic





Define and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE PROGRESSBAR 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.
      [ ALIGN nAlign ]
Qt_AlignLeft
  
Align text, most common value are Qt_AlignLeft , Qt_AlignCenter and Qt_AlignRight
      [ ENABLED .T. | .F. ]
.T.
  
Enable or Disable control
      [ RANGEMIN nValue ]
0
  
Minimum chunk value
      [ RANGEMAX nValue ]
?
  
Maximum chunk value
      [ VALUE nValue ]
0
  
Chunk initial position
      [ 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
      [ CHUNKCOLOR {aChunkColor} | aVarChunkColor ]
{118,166,106} (Green)
  
Set color for Chunk of ProgressBar
      [ BLOCKS .T. | .F. ]
.F.
  
Chunk will be blocks (Not SOLID). BLOCKS and SOLID are mutually exclusive.
      [ SOLID .T. | .F. ]
.F.
  
Chunk will be solid (Not BLOCKS). SOLID and BLOCKS are mutually exclusive.
      [ TOOLTIP cToolTip ]
NIL
  
Text for display into tooltip
      [ VERTICAL .T. | .F. ]
.F.
 
 Display control in Vertical mode (not horizontaly)
      [ VISIBLE .T. | .F. ]
.T.
  
Show or hide control (like methods SHOW and HIDE)
      [ 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.
      [ 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.
      [ 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.
      [ ONCHANGE cOnChange | {BOnChange} ]
NIL
  
An action to be performed when control value is changed
      [ 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 PROGRESSBAR 

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
    ONCHANGE
n/a
  
Execute ONCHANGE 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_progressbar.prg


#include "marinas-gui.ch"

MEMVAR PUB_bOnExitDemo

Function main()

   PUBLIC PUB_bOnExitDemo := .F.

   SET APPLSTYLE TO "MarinasLooks"

   CREATE WINDOW d_window
      ROW 0 ; COL 0
      WIDTH 820 ; HEIGHT 480
      CAPTION "Marinas-GUI Sample for ProgressBar Control"
      ICON "../resource/d_test.ico"
      BACKCOLOR {216,237,236}
      ONRELEASE M->PUB_bOnExitDemo := .T.
      MAIN .T.

      d_ProgressBar_def()

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

Return .T.


File: d_progressbar_def.prg

#include "marinas-gui.ch"

MEMVAR __PB_temp_var_nInx
MEMVAR __PB_temp_var_nInx2

Function d_progressbar_def()
     Public __PB_temp_var_nInx := 0
     Public __PB_temp_var_nInx2 := 0

     CREATE IMAGE PB_Focus_1Image
        ROW       30
        COL       130
        WIDTH     32
        HEIGHT    32
        PICTURE   "../resource/d_null.png"
        TOOLTIP   "ProgressBar Focus"
     END IMAGE

     CREATE PROGRESSBAR ProgressBar_1
            ROW    70
            COL    130
            WIDTH  32
            HEIGHT 300
            RANGEMIN 0
            RANGEMAX 100
            VALUE 20
            VERTICAL .T.
            SOLID .T.
            CHUNKCOLOR {254,216,211}
            TOOLTIP "ProgressBar with CHUNKCOLOR and SOLID Properties"
            ONCHANGE __PB_Run( "+" )
            ONGOTFOCUS mg_Set( "d_window" , "PB_Focus_1Image" , "picture" , "../resource/d_focus_on.png" )
            ONLOSTFOCUS mg_Set( "d_window" , "PB_Focus_1Image" , "picture" , "../resource/d_null.png" )

            CREATE CONTEXT MENU

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

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

            END MENU

     END PROGRESSBAR

    CREATE BUTTON PB_Button_1
           ROW    380
           COL    130
           WIDTH  32
           HEIGHT 32
           CAPTION "Go!"
           ONCLICK GoProgressBar( "d_window" , "ProgressBar_1" , "+" )
           TOOLTIP "Start ProgressBar"
     END BUTTON

     CREATE IMAGE PB_Focus_2Image
        ROW       30
        COL       550
        WIDTH     32
        HEIGHT    32
        PICTURE   "../resource/d_null.png"
        TOOLTIP   "ProgressBar Focus"
     END IMAGE

     CREATE PROGRESSBAR ProgressBar_2
            ROW    30
            COL    280
            WIDTH  265
            HEIGHT 32
            RANGEMIN 0
            RANGEMAX 100
            VALUE 80
            FONTSIZE 14
            BLOCKS .T.
            CHUNKCOLOR {204,199,254}
            TOOLTIP "ProgressBar with FONTSIZE"
            ONCHANGE __PB_Run()
            ONGOTFOCUS mg_Set( "d_window" , "PB_Focus_2Image" , "picture" , "../resource/d_focus_on.png" )
            ONLOSTFOCUS mg_Set( "d_window" , "PB_Focus_2Image" , "picture" , "../resource/d_null.png" )
     END PROGRESSBAR

    CREATE BUTTON PB_Button_2
           ROW    30
           COL    230
           WIDTH  32
           HEIGHT 32
           CAPTION "Go!"
           ONCLICK GoProgressBar( "d_window" , "ProgressBar_2" , "-" )
           TOOLTIP "Start ProgressBar"
     END BUTTON

     CREATE IMAGE PB_Focus_3Image
        ROW       30
        COL       650
        WIDTH     32
        HEIGHT    32
        PICTURE   "../resource/d_null.png"
        TOOLTIP   "ProgressBar Focus"
     END IMAGE

     CREATE PROGRESSBAR ProgressBar_3
            ROW    70
            COL    650
            WIDTH  32
            HEIGHT 300
            RANGEMIN 0
            RANGEMAX 100
            VALUE 60
            VERTICAL .T.
            BACKCOLOR {252,254,180}
            CHUNKCOLOR {255,000,000}
            TOOLTIP "ProgressBar with BLOCS Property (Default)"
            ONCHANGE __PB_Run()
            ONGOTFOCUS mg_Set( "d_window" , "PB_Focus_3Image" , "picture" , "../resource/d_focus_on.png" )
            ONLOSTFOCUS mg_Set( "d_window" , "PB_Focus_3Image" , "picture" , "../resource/d_null.png" )
     END PROGRESSBAR

    CREATE BUTTON PB_Button_3
           ROW    380
           COL    650
           WIDTH  32
           HEIGHT 32
           CAPTION "Go!"
           ONCLICK GoProgressBar( "d_window" , "ProgressBar_3" , "-" )
           TOOLTIP "Start ProgressBar"
     END BUTTON

     CREATE IMAGE PB_Image1
            ROW    120
            COL    510
            WIDTH  32
            HEIGHT 32
            PICTURE "../resource/d_wheel_0.png"
            TOOLTIP "The event OnChange of ProgressBar move the wheel"
     END IMAGE

     CREATE IMAGE PB_Focus_4Image
        ROW       120
        COL       410
        WIDTH     32
        HEIGHT    32
        PICTURE   "../resource/d_null.png"
        TOOLTIP   "ProgressBar Focus"
     END IMAGE

     CREATE PROGRESSBAR ProgressBar_4
            ROW    120
            COL    230
            WIDTH  120
            HEIGHT 32
            RANGEMIN 0
            TOOLTIP "Standard ProgressBar"
            RANGEMAX 100
            VALUE 30
            ONCHANGE __PB_Run()
            ONGOTFOCUS mg_Set( "d_window" , "PB_Focus_4Image" , "picture" , "../resource/d_focus_on.png" )
            ONLOSTFOCUS mg_Set( "d_window" , "PB_Focus_4Image" , "picture" , "../resource/d_null.png" )
     END PROGRESSBAR

    CREATE BUTTON PB_Button_4
           ROW    120
           COL    370
           WIDTH  32
           HEIGHT 32
           CAPTION "Go!"
           ONCLICK GoProgressBar( "d_window" , "ProgressBar_4" , "+" )
           TOOLTIP "Start ProgressBar"
     END BUTTON

     CREATE IMAGE PB_Image2
            ROW    220
            COL    270
            WIDTH  32
            HEIGHT 32
            PICTURE "../resource/d_wheel_3.png"
            TOOLTIP "The event OnChange of ProgressBar move the wheel"
     END IMAGE

     CREATE IMAGE PB_Focus_5Image
        ROW       220
        COL       380
        WIDTH     32
        HEIGHT    32
        PICTURE   "../resource/d_null.png"
        TOOLTIP   "ProgressBar Focus"
     END IMAGE

     CREATE PROGRESSBAR ProgressBar_5
            ROW    220
            COL    470
            WIDTH  120
            HEIGHT 32
            RANGEMIN 0
            VALUE 25
            BLOCKS .T.
            FONTCOLOR {255,0,0}
            BACKCOLOR {0,255,0}
            RANGEMAX 100
            TOOLTIP "ProgressBar with Backcolor and Fontcolor"
            ONCHANGE __PB_Run()
            ONGOTFOCUS mg_Set( "d_window" , "PB_Focus_5Image" , "picture" , "../resource/d_focus_on.png" )
            ONLOSTFOCUS mg_Set( "d_window" , "PB_Focus_5Image" , "picture" , "../resource/d_null.png" )
     END PROGRESSBAR

    CREATE BUTTON PB_Button_5
           ROW    220
           COL    420
           WIDTH  32
           HEIGHT 32
           CAPTION "Go!"
           ONCLICK GoProgressBar( "d_window" , "ProgressBar_5" , "+" )
           TOOLTIP "Start ProgressBar"
     END BUTTON

     CREATE IMAGE PB_Focus_6Image
        ROW       300
        COL       230
        WIDTH     32
        HEIGHT    32
        PICTURE   "../resource/d_null.png"
        TOOLTIP   "ProgressBar Focus"
     END IMAGE

     CREATE PROGRESSBAR ProgressBar_6
            ROW    300
            COL    270
            TOOLTIP "ProgressBar with CHUNKCOLOR, FONTCOLOR and FONTUNDERLINE"
            WIDTH  250
            VALUE 77
            HEIGHT 32
            SOLID .T.
            ALIGN Qt_AlignLeft + Qt_AlignVCenter
            FONTCOLOR {0,0,255}
            FONTUNDERLINE .T.
            RANGEMIN 0
            RANGEMAX 100
            CHUNKCOLOR {208,253,198}
            ONCHANGE __PB_Run()
            ONGOTFOCUS mg_Set( "d_window" , "PB_Focus_6Image" , "picture" , "../resource/d_focus_on.png" )
            ONLOSTFOCUS mg_Set( "d_window" , "PB_Focus_6Image" , "picture" , "../resource/d_null.png" )
     END PROGRESSBAR

    CREATE BUTTON PB_Button_6
           ROW    300
           COL    540
           WIDTH  32
           HEIGHT 32
           CAPTION "Go!"
           ONCLICK GoProgressBar( "d_window" , "ProgressBar_6" , "+" )
           TOOLTIP "Start ProgressBar"
     END BUTTON

    CREATE BUTTON Button_GO_ALL
           ROW    380
           COL    310
           WIDTH  188
           HEIGHT 35
           CAPTION "Go ALL"
           ONCLICK GoProgressBarAll()
           TOOLTIP "Start ALL ProgressBar"
     END BUTTON

Return .T.

Function GoProgressBarAll()
   mg_Set( "d_window" , "Button_GO_ALL" , "enabled" , .F. )
   GoProgressBar( "d_window" , "ProgressBar_1" , "+" )
   IF M->PUB_bOnExitDemo
      RETURN .F.
   ENDIF
   GoProgressBar( "d_window" , "ProgressBar_2" , "-" )
   IF M->PUB_bOnExitDemo
      RETURN .F.
   ENDIF
   GoProgressBar( "d_window" , "ProgressBar_3" , "-" )
   IF M->PUB_bOnExitDemo
      RETURN .F.
   ENDIF
   GoProgressBar( "d_window" , "ProgressBar_4" , "+" )
   IF M->PUB_bOnExitDemo
      RETURN .F.
   ENDIF
   GoProgressBar( "d_window" , "ProgressBar_5" , "+" )
   IF M->PUB_bOnExitDemo
      RETURN .F.
   ENDIF
   GoProgressBar( "d_window" , "ProgressBar_6" , "+" )
   IF M->PUB_bOnExitDemo
      RETURN .F.
   ENDIF
   mg_Set( "d_window" , "Button_GO_ALL" , "enabled" , .T. )
Return .T.

Function GoProgressBar( cWin , cControl , cMode , nSpeed )
   Local nInx , nRangeMin , nRangeMax , nOldValue := mg_Get( cWin , cControl , "value" )
   mg_Do( cWin , cControl , "setfocus" )     // Requested only for Lamp
   DEFAULT cMode TO "+"
   DEFAULT nSpeed TO 0.05
   nRangeMin := mg_Get( cWin , cControl , "rangemin" )
   nRangeMax := mg_Get( cWin , cControl , "rangemax" )
   if cMode == "+"
      for nInx := nOldValue to nRangeMax
         IF M->PUB_bOnExitDemo
            RETURN .F.
         ENDIF
         mg_Set( cWin , cControl , "value" , nInx )
         DO EVENTS
         hb_idleSleep( nSpeed )
      next
   else
      for nInx := nOldValue to nRangeMin Step -1
         IF M->PUB_bOnExitDemo
            RETURN .F.
         ENDIF
         mg_Set( cWin , cControl , "value" , nInx )
         DO EVENTS
         hb_idleSleep( nSpeed )
      next
   endif
   mg_Set( cWin , cControl , "value" , nOldValue )
Return .T.

Function __PB_Run()
   M->__PB_temp_var_nInx++
   M->__PB_temp_var_nInx2--
   mg_Set( "d_window" , "PB_Image1" , "picture" , "../resource/d_wheel_" + alltrim( str( int( mod( M->__PB_temp_var_nInx , 8 ) ) ) ) + ".png" )
   mg_Set( "d_window" , "PB_Image2" , "picture" , "../resource/d_wheel_" + alltrim( str( int( mod( M->__PB_temp_var_nInx2 , 8 ) ) ) ) + ".png" )
Return .T.

FUNCTION ProgressBarStop()
RETURN NIL



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