Browse
Previous topic  First topic  Next topic






Define and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE BROWSE 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.
      [ WORKAREA cAlias ]
NIL
  
Set workarea for Browse. By default, BROWSE don't use any workarea (alias), You can change it by set WORKAREA with mg_Set() function dynamically.
      [ ENABLED .T. | .F. ]
.T.
  
Enable or Disable 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
      [ FONTATTRDYNAMIC cFontAttrDynamic | {BFontAttrDynamic} ]
All Global Font Atributes
  
Set font attributes cell dynamically by returning an ARRAY of font attributes (or NIL) from a CodeBlock. The CodeBlock receives two parameters: nRow and nCol. Warning, this property can cause performance problems if you codeblock is not efficient.
ARRAY returned will be { "fontName" , "fontSize" , "fontBold" , "fontItalic" , "fontUnderline" , "fontStrikeOut" }
If a attribute is NIL, global value is used.
      [ FONTCOLOR {aFontColor} | aVarFontColor ]
OS.FontColor
  
Set foreground color (text color)
      [ BACKCOLOR {aBackColor} | aVarBackColor ]
OS.BackColor
  
Set background color
      [ FONTCOLORHEADER {aFontColor} | aVarFontColor ]
Appl.FontColor
  
Set foreground color (text color) for columns header of control
      [ BACKCOLORHEADER {aBackColor} | aVarBackColor ]
Appl.BackColor
  
Set background color for columns header of control
      [ FONTCOLORDYNAMIC cFontColorDynamic | {BFontColorDynamic} ]
FontColor
  
Set fontcolor cell dynamically by returning an STRING of RGB values (or NIL) from a CodeBlock. The CodeBlock receives two parameters: nRow and nCol. Warning, this property can cause performance problems if you codeblock is not efficient.
      [ BACKCOLORDYNAMIC cBackColorDynamic | {BBackColorDynamic} ]
BackColor
  
Set backcolor cell dynamically by returning an STRING of RGB values (or NIL) from a CodeBlock. The CodeBlock receives two parameters: nRow and nCol. Warning, this property can cause performance problems if you codeblock is not efficient.
      [ SELECTIONFONTCOLOR {aFontColor} | aVarFontColor ]   
Set font color for selected cell(s)
      [ SELECTIONBACKCOLOR {aBackColor} | aVarBackColor ]   
Set background color for selected cell(s)
      [ SELECTIONFONTCOLORDYNAMIC cFontColorDynamic | {BFontColorDynamic} ]   
Set fontcolor of selection cell dynamically by returning an STRING of RGB values (or NIL) from a CodeBlock. The CodeBlock receives two parameters: nRow and nCol. Warning, this property can cause performance problems if you codeblock is not efficient.
      [ SELECTIONBACKCOLORDYNAMIC cBackColorDynamic | {BBackColorDynamic} ]   
Set backcolor of selection cell dynamically by returning an STRING of RGB values (or NIL) from a CodeBlock. The CodeBlock receives two parameters: nRow and nCol. Warning, this property can cause performance problems if you codeblock is not efficient.
      [ ALTERNATINGROWCOLOR .T. | .F. ]
.F.
  
This property holds whether to draw the background using alternating colors.
      [ FONTNAMEHEADER "cFontName" ]
Appl.Fontname
  
Font family for text of columns header of control
      [ FONTSIZEHEADER nPoints ]
Appl.FontSize
  
Font size for text of columns header of control
      [ FONTBOLDHEADER .T. | .F. ]
.F.
  
Set Bold attribute to text of columns header of control. Note, if NAVIGATEBY is set to "ROW", all columns are selected, so, depending on the desktop style, all header text will be set BOLD always
      [ FONTITALICHEADER .T. | .F. ]
.F.
  
Set Italic attribute to text of columns header of control
      [ FONTUNDERLINEHEADER .T. | .F. ]
.F.
  
Set Underline attribute to text of columns header of control
      [ FONTSTRIKEOUTHEADER .T. | .F. ]
.F.
  
Set Strikeout attribute to text of columns header of control
      [ ITEMCOUNT ]   
Only for mg_Get() function. It returns the total amount of rows in control
      [ COLUMNHIDDEN nCol [ , .T. | .F. ] ]
.T. | .F.
  
Only for mg_set() and mg_get(). That property HIDE or SHOW a column. At mg_set() mode, that property returns the previous value.
      [ COLUMNHEADER ]
NIL
   
      [ COLUMNHEADERALL ]
NIL
  
 
      [ COLUMNFIELD nColumn , cField ]
NIL
  
A field to display at column nColumn. Only for mg_Set and mg_Get functions
      [ COLUMNFIELDALL {aColumnFieldAll} ]
NIL
  
An array with list of fields to display in the browse
      [ COLUMNALIGNALL {aDataAligns} ]
fieldTypeAlign
  
An array with aligns for each column in the browse
      [ COLUMNALIGNHEADERALL {aHeadersAligns} ]
fieldTypeAlign
  
An array with aligns for each header of column in the browse
      [ COLUMNWIDTHALL {aWidths} ]
NIL
  
An array with widths for each column in the browse. Used at mg_get() function, this property returns an array with columns widths.
      [ COLUMNCOUNT ]   
Only for mg_Get() function. It returns the total amount of columns in control
      [ ROWHEIGHTALL nHeight ]
18
  
Set/Get the height value for all rows.
      [ ROWHIDDEN nRow [ , .T. | .F. ] ]
.T. | .F.
  
Only for mg_set() and mg_get(). That property HIDE or SHOW a row. At mg_set() mode, that property returns the previous value.
      [ EASYSKIP .T. | .F. ]
.F.
  
Allow user to navigate in the control by pressing a key (like an index). Look topic Browse and Grid Key Trap. Pressing
      [ NAVIGATEBY "ROW" | "COL" | "CELL" ]
"ROW"
  
Select navigate mode
      [ DISABLEUPDATE .T. | .F. ]
NIL
  
This property set ON/OFF the display update of control. If you set DISABLEUPDATE to .T., changes into control will not be shown until you set DISABLEUPDATE with .F. parameter
      [ DISABLEEVENTS .T. | .F. ]
NIL
  
This property set ON/OFF the internal triggers of control. If you set DISABLEEVENTS to .T., ONNAVIGATECELL, ONENTER and others events into control will not be executed until you set DISABLEEVENTS with .F. parameter
      [ DISABLESYNC .T. | .F. ]
NIL
  
By default, when you change the record pointer in the table, SYNC process move row value to syncronizate record with row. If you set .T. (ON) this disable property, yo can move record pointer and the row pointer will don't change.
      [ TOOLTIP cToolTip ]
NIL
  
Text for display into tooltip
      [ VISIBLE .T. | .F. ]
.T.
  
Show or hide control (like methods SHOW and HIDE)
      [ 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.
      [ EDITINPLACEALL aColumnAllowEdit ]
NIL
  
Allow user to edit the cell content for only same specific columns by pressing mouse double click. Look topic Browse and Grid Edit Inplace. Pressing
      [ EDITINPLACEDISPLAYERROR .T. | .F. ]
.T.
  
Allow marinas-gui to display an error message when the new value was not saved to the cell. Look topic Browse and Grid Edit Inplace. Pressing
      [ EDITINPLACEDYNAMIC {bCellEvaluateBlock} ]
NIL
  
Allow user to edit the cell content for an specific cell by checking the bCellEvaluateBlock to allow or not edit. Look topic Browse and Grid Edit Inplace. Pressing
      [ EDITINPLACEGLOBAL .T. | .F. ]
.F.
  
Allow user to edit the cell content by pressing mouse double click. Look topic Browse and Grid Edit Inplace. Pressing
      [ EDITINPLACETRIGGERS enum QAbstractItemView::EditTrigger ]
QAbstractItemView_DoubleClicked + QAbstractItemView_EditKeyPressed
  
This property holds which actions will initiate item editing.
Values:
QAbstractItemView_NoEditTriggers (No editing possible.)
QAbstractItemView_CurrentChanged (Editing start whenever current item changes.)
QAbstractItemView_DoubleClicked (Editing starts when an item is double clicked.)
QAbstractItemView_SelectedClicked (Editing starts when clicking on an already selected item)
QAbstractItemView_EditKeyPressed (Editing starts when the platform edit key has been pressed over an item.)
QAbstractItemView_AnyKeyPressed (Editing starts when any key is pressed over an item.)
QAbstractItemView_AllEditTriggers (Editing starts for all above actions.)
      [ EDITINPLACEVALIDALL aColumnCheckNewValue ]
NIL
  
Allow user to evaluate the new cell content for only same specific columns to allow or not the new value. Look topic Browse and Grid Edit Inplace. Pressing
      [ EDITINPLACEVALIDDYNAMIC {bCellEvaluateNewValue} ]
NIL
  
Allow user to evaluate the new cell content for an specific cell by checking the bCellEvaluateBlock to allow or not the new value. Look topic Browse and Grid Edit Inplace. Pressing
      [ ONEDITINPLACESAVE {bOnEditInplaceSaveBlock} ]
NIL
  
Allow user to execute a BLOCK when user save the new value for a cell. Look topic Browse and Grid Edit Inplace. Pressing
      [ VALUE nValue ]
NIL
  
Set or Get row position
      [ VALUECOL nValue ]
NIL
  
Set or Get column position
      [ CELL nRow , nCol [ , xValue ] [ , bOff ] [ , @cMsgError ] ]   
Only for mg_Get() and mg_Set() functions. Get or Put a value into a cell of control (and table in workarea). For mg_Get(), it only need nRow and nCol and return the cell content. For mg_Put(), it need xValue and return .T. for successful or .F. for failed. When failed, marinas-gui display an error message and return the message text in the cMsgError var passed by reference. If you don't like the message error, you can coded the bOff parameter to .T. to supress it
      [ RECNO ]   
Only for mg_Get() function. This property returns the real DBF recno() associated with Browse row. You need pass Browse Row as parameter. For example, to get the real DBF record for row 6: mg_Get( "myWindow" , "myBrowse" , "recno" , 6 ). Note: for current Browse ROW you can see the "VALUE" property. Warning: this property can be bad performance when you use Filtered DBF and/or SET DELETED OFF (default).
      [ 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.
      [ 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.
      [ ONDBLCLICK cOnDblClick | {BOnDblClick} ]
NIL
  
An action to be performed when user press double mouse click
      [ ONENTER cOnEnter | {BOnEnter} ]
NIL
  
An action to be performed when user press ENTER or RETURN keys. You can interrupt the ENTER key propagate to the control returning the __MG_KEY_NO_PROPAGATE constant, e.g. to disable ENTERTAB behavior.
      [ ONHEADERCLICK nHeader , bOnHeaderClick ]
NIL
 
 An action to be performed when user press CLICK over the header of column nHeader. Only for mg_Set and mg_Get functions
      [ ONHEADERCLICKALL abOnHeaderClickAll | { {BOnHeaderClickAll} [ , {BOnHeaderClickAll} ... ] ]
NIL
  
An action to be performed when user press CLICK over headers. Each array elemnet is a block corresponding with column position.
      [ ONNAVIGATECELL cOnNavigateCell | {BOnNavigateCell} ]
NIL
  
An action to be performed when user move the cell position by arrows or mouse
      [ 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
      [ CONTEXTMENUSUPRESSED .T. | .F. ]
.F.
  
Disable the display of the Context Menu of control.
      [ CREATE CONTEXT MENU [ cName ] ]   
CONTEXT MENU for control
            [ ......... ]   
You can see properties for this menu in CONTEXT MENU topic
      [ END MENU ]   
 
END BROWSE 

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
    HIDECOLUMN nCol
NIL
  
That method HIDE a column.
    HIDEROW nRow
NIL
  
That method HIDE a row.
    SHOWCOLUMN nCol
NIL
  
That method SHOW a column.
    SHOWROW nRow
NIL
  
That method SHOW a row.
    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.
    REFRESH
n/a
  
This method is used to refresh the control content. Recomended when user added, deleted o modified records.
    SETFOCUS
n/a
  
This method put the program focus into control
    SKIP nStep
n/a
  
This method skip nStep rows
    GETEDITINPLACEMEMOEDITBOXNAME
n/a
  
Return the control name for EDITBOX in memo edit inplace to allow user to modify same properties
    ONNAVIGATECELL
n/a
  
Execute ONNAVIGATECELL block coded in CREATE or seted by mg_Set
    ONDBLCLICK
n/a
  
Execute ONDBLCLICK block coded in CREATE or seted by mg_Set
    ONENTER
n/a
  
Execute ONENTER block coded in CREATE or seted by mg_Set
    ONHEADERCLICK nHeader
n/a
  
Execute the block defined for column nHeader by ONHEADERCLICKALL property
    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



Note: read the following topic: Browse and Grid Performance
Nota: lea el siguiente tópico: Browse and Grid Performance

Note2: read the following topic: Browse and Grid Key Trap
Nota2: lea el siguiente tópico: Browse and Grid Key Trap


Example:

File: d_browse.prg


#include "marinas-gui.ch"

Function main()

   SET APPLSTYLE TO "MarinasLooks"

   Request DBFCDX , DBFFPT
   Rddsetdefault( "DBFCDX" )

   CreateDataBaseBrowse()
   UseDataBaseBrowse()

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

      d_browse_def()

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

   CloseDataBaseBrowse()
   EraseDataBaseBrowse()

Return .T.


File: d_browse_def.prg

#include "marinas-gui.ch"

MEMVAR bMyBrowseProgressStop

Function d_browse_def()

   SET DELETED ON

   DbSelectArea( "d_browse" )

   CREATE FRAMEBOX myBrowseFrameBox0
      ROW    5
      COL    10
      WIDTH  150
      HEIGHT 45
      CAPTION "Navigate By"
   END FRAMEBOX

   CREATE RADIOGROUP myBrowseRadioGroupNavigate
      ROW    20
      COL    15
      WIDTH  140
      HEIGHT 26
      ITEMS { "Row" , "Col" , "Cell" }
      VALUE 1
      HORIZONTAL .T.
      ONCHANGE {|| mg_Set( "d_window" , "myBrowse" , "navigateby" , mg_Get( "d_window" , "myBrowseRadioGroupNavigate" , "item" , mg_Get( "d_window" , "myBrowseRadioGroupNavigate" , "value" ) ) ) , mg_Do( "d_window" , "myBrowse" , "setfocus" ) }
      TOOLTIP "Change the navigation orientation"
   END RADIOGROUP

   CREATE SPINNER myBrowseSpinner
      ROW    20
      COL    180
      WIDTH  80
      HEIGHT 30
      RANGEMIN 1
      RANGEMAX 10000000
      VALUE 5000
      INCREMENT 50000
   END SPINNER

   CREATE BUTTON myBrowseButtonAdd
      ROW    20
      COL    270
      WIDTH  50
      HEIGHT 30
      CAPTION "<- Add"
      TOOLTIP "Add Records to Database"
      ONCLICK {|| myBrowseAddRecordsPrev() }
   END BUTTON

   CREATE PROGRESSBAR myBrowseProgressBar
      ROW    20
      COL    240
      WIDTH  80
      HEIGHT 30
      RANGEMIN 0
      RANGEMAX 10000000
      VALUE 0
      VISIBLE .F.
      CHUNKCOLOR {128,128,255}
   END PROGRESSBAR

   CREATE BUTTON myBrowseButtonStop
      ROW    20
      COL    180   // 270
      WIDTH  50
      HEIGHT 30
      CAPTION "Stop"
      ONCLICK {|| M->bMyBrowseProgressStop := .T. }
      BACKCOLOR {255,0,0}
      FONTCOLOR {255,255,255}
      FONTBOLD .T.
   END BUTTON

   mg_Do( "d_window" , "myBrowseProgressBar" , "hide" )
   mg_Do( "d_window" , "myBrowseButtonStop" , "hide" )

   CREATE FRAMEBOX myBrowseFrameBox1
      ROW    5
      COL    340
      WIDTH  120
      HEIGHT 45
      CAPTION "Cell( row , col )"
   END FRAMEBOX

   CREATE LABEL myBrowseLabelCell
      ROW    20
      COL    344
      WIDTH  96
      HEIGHT 26
      VALUE "x,y"
      ALIGN Qt_AlignCenter
   END LABEL

   CREATE FRAMEBOX myBrowseFrameBox2
      ROW    5
      COL    470
      WIDTH  120
      HEIGHT 45
      CAPTION "Available Records"
   END FRAMEBOX

   CREATE LABEL myBrowseAvailableRecords
      ROW    20
      COL    474
      WIDTH  96
      HEIGHT 26
      ALIGN Qt_AlignCenter
      VALUE "0"
   END LABEL

   CREATE FRAMEBOX myBrowseFrameSearch
      ROW    5
      COL    600
      WIDTH  130
      HEIGHT 45
      CAPTION "Progressive Search"
      TOOLTIP "Progressive Search when records are sorted by name"
   END FRAMEBOX

   CREATE TEXTBOX myBrowseTextBoxSearch
      ROW    20
      COL    608
      WIDTH  114
      HEIGHT 26
      VALUE  ""
      TOOLTIP "Progressive Search when records are sorted by name"
      ENABLED .F.
      BACKCOLOR {226,226,226}
      ONCHANGE ProgressiveSearch( mg_Get( "d_window" , "myBrowseTextBoxSearch" , "value" ) )
   END TEXTBOX

   CREATE IMAGE myBrowseImageFocus
      ROW       9
      if mg_IsControlCreated( "d_window" , "maindemo_tab" )
         COL       mg_Get( "d_window" , "maindemo_tab" , "width" ) - 42
      else
         COL       mg_Get( "d_window" , "width" ) - 42
      endif
      WIDTH     32
      HEIGHT    32
      PICTURE   "../resource/d_focus_off.png"
      TOOLTIP   "Browse Focus"
   END IMAGE

   CREATE EDITBOX myBrowseMemo
      ROW    380
      COL    10
      TOOLTIP "Memo Field"
      VALUE "Memo Filed Initial"
      WIDTH  130
      HEIGHT 65
      READONLY .T.
      BACKCOLOR {0,0,0}
      FONTCOLOR {0,255,0}
      FONTNAME "mg_monospace"
   END EDITBOX

   CREATE BUTTON myBrowseButtonDelete
      ROW    450
      COL    10
      WIDTH  130
      HEIGHT 20
      CAPTION "Delete Record"
      ONCLICK {|| myBrowseDeleteRow() , mg_Do( "d_window" , "myBrowse" , "setfocus" ) }
   END BUTTON

   CREATE FRAMEBOX myBrowseFrameBox8
      ROW    380
      COL    150
      WIDTH  520
      HEIGHT 90
      BACKCOLOR {128,128,255}
   END FRAMEBOX

   CREATE LABEL myBrowseLabelName
      ROW    385
      COL    170
      WIDTH  480
      HEIGHT 30
      VALUE "Initial"
      FONTSIZE 16
      ALIGN Qt_AlignCenter
      FONTCOLOR {255,255,255}
      BACKCOLOR {128,128,255}
   END LABEL

   CREATE LABEL myBrowseLabelAddress
      ROW    415
      COL    170
      WIDTH  480
      HEIGHT 20
      VALUE "Initial"
      FONTSIZE 12
      FONTITALIC .T.
      ALIGN    Qt_AlignCenter
      FONTCOLOR {57,134,101}
      FONTBOLD .T.
      BACKCOLOR {128,128,255}
   END LABEL

   CREATE LABEL myBrowseLabelCity
      ROW    435
      COL    170
      WIDTH  480
      HEIGHT 30
      VALUE "Initial"
      FONTSIZE 13
      FONTUNDERLINE .T.
      ALIGN   Qt_AlignCenter
      FONTCOLOR {0,0,255}
      FONTBOLD .T.
      BACKCOLOR {128,128,255}
   END LABEL

   CREATE IMAGE myBrowseImageHome
      ROW    380
      COL    680
      TOOLTIP "Home Picture"
      PICTURE   "../resource/maindemo_browse_00.png"
      WIDTH  130
      HEIGHT 90
      ONCLICK myDemoShowImage( mg_get( "d_window" , "myBrowseImageHome" , "picture" ) )
   // ONCLICK mg_log( mg_get( "d_window" , "mybrowse" , "valuecol" ) )
   END IMAGE

   CREATE BROWSE myBrowse
      ROW 60
      COL 10
      WIDTH     800
      HEIGHT    285
      FONTCOLOR {57,134,101}
      BACKCOLOR {237,236,173}
      FONTCOLORHEADER {255,255,255}
      BACKCOLORHEADER {0,0,255}
      BACKCOLORDYNAMIC {|nRow| if( mod( nRow , 5 ) == 0 , {174,171,241} , NIL ) }
   // BACKCOLORDYNAMIC {|nRow,nCol| if( mod( nRow , 5 ) == 0 , {174,171,241} , NIL ) }
      SELECTIONFONTCOLOR  { 237,236,173 }
      SELECTIONBACKCOLOR  {57,134,101}
      SELECTIONBACKCOLORDYNAMIC {|nRow| if( mod( nRow , 5 ) == 0 , {174,171,241} , NIL ) }
      FONTATTRDYNAMIC {|nRow,nCol| myFontAttrDynamic( nRow , nCol ) }
   // ALTERNATINGROWCOLOR .T.
      FONTBOLD .T.
      FONTSIZE 10
      FONTSIZEHEADER 14
      FONTITALICHEADER .T.
      WORKAREA "d_browse"
      COLUMNFIELDALL { "d_browse->mycode" , "d_browse->myname" , "d_browse->myphone" , "d_browse->myaddress" , "d_browse->mycity" , "d_browse->mymemo" , "d_browse->mydate" }
      COLUMNHEADERALL { "Code (S)"        , "Name (S)"         , "Phone"             , "Address (S)"         , "City"             , "Memo"             , "Date"             }
      COLUMNWIDTHALL { 100                , 220                , 110                 , 215                   , 90                 , 120                , 80                 }
      COLUMNALIGNALL { Qt_AlignRight      , Qt_AlignLeft       , Qt_AlignHCenter     , NIL                   , Qt_AlignHCenter    ,                    , Qt_AlignHCenter    }
      COLUMNALIGNHEADERALL { Qt_AlignHCenter      , Qt_AlignHCenter    , Qt_AlignLeft        , Qt_AlignLeft          , Qt_AlignHCenter    ,                    , Qt_AlignHCenter    }
      EDITINPLACEALL { .T. , .T. , .T. , .T. , .T. , .T. , .T. }
      ONEDITINPLACESAVE myBrowseOnNavigateCell()
      NAVIGATEBY "ROW"
      TOOLTIP "Browse ToolTip"
      ONNAVIGATECELL myBrowseOnNavigateCell()
      ONHEADERCLICKALL { {|| changeOrder( "code01" ) } , {|| changeOrder( "name01" ) } , NIL , {|| changeOrder( "address01" ) } , {|| mg_MsgInfo( "Header Column 5" ) } }
  //  ONENTER    {|| mg_MsgInfo( "Enter: r: " + alltrim( str( mg_Get( "d_window" , "myBrowse" , "value" ) ) ) + " , c: " + alltrim( str( mg_Get( "d_window" , "myBrowse" , "valuecol" ) ) ) ) }
  //  ONDBLCLICK {|| mg_MsgInfo( "DblClick: r: " + alltrim( str( mg_Get( "d_window" , "myBrowse" , "value" ) ) ) + " , c: " + alltrim( str( mg_Get( "d_window" , "myBrowse" , "valuecol" ) ) ) ) }
      ONGOTFOCUS mg_Set( "d_window" , "myBrowseImageFocus" , "picture" , "../resource/d_focus_on.png" )
      ONLOSTFOCUS mg_Set( "d_window" , "myBrowseImageFocus" , "picture" , "../resource/d_focus_off.png" )
      ROWHEIGHTALL 19

      CREATE CONTEXT MENU
         CREATE ITEM "Item 1 from Browse"
            ONCLICK { || mg_MsgInfo( "Item 1 from Browse" ) }
            ITEMNAME alfa
            PICTURE "../resource/d_test.png"
         END ITEM
         CREATE ITEM "Item 2 from Browse"
            ONCLICK { || mg_MsgInfo( "Item 2 from Browse" ) }
            PICTURE "../resource/d_test.png"
         END ITEM
      END MENU

      VALUE 8
      VALUECOL 3
   END BROWSE

   mg_Set( "d_window" , mg_Do( "d_window" , "myBrowse" , "GetEditInPlaceMemoEditBoxName" ) , "Backcolor" , mg_get( "d_window" , "myBrowse" , "FontColor" ) )
   mg_Set( "d_window" , mg_Do( "d_window" , "myBrowse" , "GetEditInPlaceMemoEditBoxName" ) , "Fontcolor" , mg_get( "d_window" , "myBrowse" , "BackColor" ) )

   CREATE LABEL
      ROW    mg_get( "d_window" , "myBrowse" , "rowBottom" ) + 5
      COL    0
      WIDTH  mg_get( "d_window" , "width" )
      HEIGHT 26
      ALIGN Qt_AlignCenter
      FONTBOLD  .T.
      FONTNAME "mg_monospace"
      VALUE "Press DBLCLICK to EditInplace cells (including MEMO cells)"
   END LABEL

   mg_Set( "d_window" , "myBrowseAvailableRecords" , "value" , alltrim( str( myRecCount() ) ) )

   mg_Do( "d_window" , "myBrowse" , "onnavigatecell" )

   if !mg_IsControlCreated( "d_window" , "MainDemo_Tab" )
      CREATE KEY ALL
         ACTION PutIntoTextBox()
      END KEY
   endif

Return .T.

Function CreateDataBaseBrowse()
   Local nInx
   Local aStruct := { ;
            { "myCode", "N", 10, 0 }, ;
            { "myRecNo", "N", 10, 0 }, ;
            { "myName", "C", 30, 0 }, ;
            { "myPhone", "C", 20, 0 }, ;
            { "myAddress", "C", 30, 0 }, ;
            { "myCity", "C", 30, 0 }, ;
            { "myDate", "D", 8, 0 }, ;
            { "myMemo", "M", 8, 0 }, ;
            { "myHome", "C", 30, 0 } ;
            }
     //     {01,04,"Jorge Ruiz"            ,"0054349678285","Nazca 987"                ,"Buenos Aires"      ,date(),"memo_field","../resource/maindemo_browse_09.png"}, ;
     //     {10,17,"Ernest Bornilongo"     ,"0087999384776","Altolaguirre 11"          ,"Junín"             ,date(),"memo_field","../resource/maindemo_browse_17.png"}, ;
     //     {04,21,"Lucio Demare"          ,"0054099282990","Elizagaray 837"           ,"Munro"             ,date(),"memo_field","../resource/maindemo_browse_21.png"}, ;
   Local aData := { ;
            {03,01,"Roberto Fontana"       ,"003489384988" ,"Via Benneto 456"          ,"Roma"              ,date(),"memo_field","../resource/maindemo_browse_01.png"}, ;
            {05,02,"Andres Calamaro"       ,"008475823423" ,"Fuenteovejuna 213"        ,"Madrid"            ,date(),"memo_field","../resource/maindemo_browse_02.png"}, ;
            {04,03,"Del - Excluded by DELETE--","000000000000" ,"---------------"          ,"--------"          ,date(),"memo_field","../resource/maindemo_browse_21.png"}, ;
            {13,04,"Francesco Nuñez"       ,"004568989899" ,"Via Romana 8989"          ,"Florence"          ,date(),"memo_field","../resource/maindemo_browse_03.png"}, ;
            {01,05,"Excluded by ORDSCOPE--","000000000000" ,"---------------"          ,"--------"          ,date(),"memo_field","../resource/maindemo_browse_04.png"}, ;
            {08,06,"Gabriela Parodi"       ,"003922899844" ,"Arce 2132 P1 A"           ,"Buenos Aires"      ,date(),"memo_field","../resource/maindemo_browse_13.png"}, ;
            {07,07,"Bruno Luciani"         ,"0054349588585","Colon 2323"               ,"Ramallo"           ,date(),"memo_field","../resource/maindemo_browse_06.png"}, ;
            {17,08,"Julio Bresnev"         ,"0054343333452","Saenz Peña 1234"          ,"Azul"              ,date(),"memo_field","../resource/maindemo_browse_07.png"}, ;
            {22,09,"Emilio del Guercio"    ,"0054334568585","Av. San Marin 23"         ,"Mendoza"           ,date(),"memo_field","../resource/maindemo_browse_08.png"}, ;
            {21,10,"Paula Mariana Saturno" ,"0054093849509","Alegría 227"              ,"Baradero"          ,date(),"memo_field","../resource/maindemo_browse_04.png"}, ;
            {20,11,"Charles Upson"         ,"0054342345685","Wertel 1237"              ,"Serville"          ,date(),"memo_field","../resource/maindemo_browse_20.png"}, ;
            {19,12,"Milles Hurlingam"      ,"0054323422585","Alfa 987 dpto 4"          ,"Angrawe"           ,date(),"memo_field","../resource/maindemo_browse_11.png"}, ;
            {18,13,"Elena Sordera"         ,"0054349552344","Zeus 323"                 ,"Athene"            ,date(),"memo_field","../resource/maindemo_browse_12.png"}, ;
            {23,14,"Milos Greco"           ,"0054343322225","Orion 8347"               ,"Jerusalem"         ,date(),"memo_field","../resource/maindemo_browse_05.png"}, ;
            {16,15,"Asia Gonzalez"         ,"0054366634585","Risutti 77"               ,"Varsovia"          ,date(),"memo_field","../resource/maindemo_browse_14.png"}, ;
            {15,16,"Rebeca Cadorna"        ,"0054256787885","Panilla 12"               ,"Panama"            ,date(),"memo_field","../resource/maindemo_browse_15.png"}, ;
            {14,17,"Lucía Pilar"           ,"0054342342125","Lima 198"                 ,"Sidney"            ,date(),"memo_field","../resource/maindemo_browse_16.png"}, ;
            {10,18,"Fil - Excluded by FILTER--","000000000000" ,"---------------"          ,"--------"          ,date(),"memo_field","../resource/maindemo_browse_17.png"}, ;
            {06,19,"Edelmiro Molinari"     ,"009393948722" ,"Scout 1234"               ,"Los Angeles"       ,date(),"memo_field","../resource/maindemo_browse_18.png"}, ;
            {12,20,"Pajarito Zaguri"       ,"0054382390849","Julio Argentino Roca 123" ,"Moron"             ,date(),"memo_field","../resource/maindemo_browse_19.png"}, ;
            {11,21,"Carozo de Quilmes"     ,"0054323392849","Urquiza 321"              ,"Quilmes"           ,date(),"memo_field","../resource/maindemo_browse_10.png"}, ;
            {09,22,"Ernesto Cachirla"      ,"0054383456749","Andres Baranda s/n"       ,"Quilmes"           ,date(),"memo_field","../resource/maindemo_browse_22.png"}, ;
            {02,23,"Carlos Bacco"          ,"0054389382095","Jujuy 1233"               ,"Lisboa"            ,date(),"memo_field","../resource/maindemo_browse_23.png"} ;
            }
// hb_dbDrop(  [, ] [, ] [, ] ) -> 
   hb_dbDrop( "d_browse_" + mg_GetThreadName() )
   dbCreate("d_browse_" + mg_GetThreadName(), aStruct )
   dbUseArea( .T. , , "d_browse_" + mg_GetThreadName() , "d_browse" )
   for nInx:=1 to len( aData )
      d_browse->(dbappend())
      d_browse->myCode:=aData[nInx,1]
      d_browse->myRecNo:=aData[nInx,2]
      d_browse->myName:=aData[nInx,3]
      d_browse->myPhone:=aData[nInx,4]
      d_browse->myAddress:=aData[nInx,5]
      d_browse->myCity:=aData[nInx,6]
      d_browse->myDate:=aData[nInx,7]
      d_browse->myMemo:="Memo Field of" + HB_OsNewLine() + d_browse->myName
      d_browse->myHome:=aData[nInx,9]
      d_browse->(dbcommit())
   next
   close d_browse
return .T.

Function EraseDataBaseBrowse()
   hb_dbDrop( "d_browse_" + mg_GetThreadName() )
Return .T.

Function myBrowseAddRecordsPrev()
   Local bOldEnabled := mg_Get( "d_window" , "myBrowseTextBoxSearch" , "enabled" )
   mg_Set( "d_window" , "myBrowseTextBoxSearch" , "enabled" , .F. )
   mg_Set( "d_window" , "myBrowseTextBoxSearch" , "backcolor" , {226,226,226} )
   mg_Set( "d_window" , "myBrowseButtonAdd" , "enabled" , .F. )
   myBrowseAddRecords()
   mg_Do( "d_window" , "myBrowse" , "setfocus" )
   mg_Set( "d_window" , "myBrowseButtonAdd" , "enabled" , .T. )
   if bOldEnabled
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "enabled" , .T. )
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "backcolor" , {255,255,255} )
   endif
Return .T.

Function myBrowseAddRecords()
   LOCAL nInx , nTotRec := d_browse->( OrdKeyCount() )
   Local cAliasOld := alias()
   DBSelectArea( "d_browse" )
   PRIVATE bMyBrowseProgressStop := .F.
   mg_Set( "d_window" , "myBrowse" , "disableSync" , .T. )
   mg_Set( "d_window" , "myBrowse" , "disableUpdate" , .T. )
   mg_Set( "d_window" , "myBrowse" , "disableEvents" , .T. )
   mg_Set( "d_window" , "myBrowse" , "enabled" , .F. )
   mg_Set( "d_window" , "myBrowseRadioGroupNavigate" , "enabled" , .F. )
   mg_Set( "d_window" , "myBrowseButtonDelete" , "enabled" , .F. )
   mg_Set( "d_window" , "myBrowseProgressBar" , "value" , 0 )
   mg_Set( "d_window" , "myBrowseProgressBar" , "rangemax" , mg_Get( "d_window" , "myBrowseSpinner" , "value" ) )
   mg_Do( "d_window" , "myBrowseSpinner" , "hide" )
   mg_Do( "d_window" , "myBrowseButtonAdd" , "hide" )
   mg_Do( "d_window" , "myBrowseProgressBar" , "show" )
   mg_Do( "d_window" , "myBrowseButtonStop" , "show" )
   DO EVENTS
   for nInx := mg_Get( "d_window" , "myBrowseSpinner" , "value" ) to 1 step -1
      if M->bMyBrowseProgressStop
         exit
      endif
      APPEND BLANK
      REPLACE d_browse->myCode       WITH nInx + nTotRec , ;
              d_browse->myRecNo      WITH d_browse->( recno() ) , ;
              d_browse->myName       WITH "Name " + alltrim( str( nInx + nTotRec ) ) , ;
              d_browse->myPhone      WITH "Telephone " + alltrim( str( nInx + nTotRec ) ) , ;
              d_browse->myAddress    WITH "Address " + alltrim( str( nInx + nTotRec ) ) , ;
              d_browse->myCity       WITH "City " + alltrim( str( nInx + nTotRec ) ) , ;
              d_browse->myDate       WITH date() , ;
              d_browse->myMemo       WITH "Memo Field of" + HB_OsNewLine() + "Name " + alltrim( str( nInx + nTotRec ) ) , ;
              d_browse->myHome       WITH "../resource/maindemo_browse_" + strZero( HB_RandomInt( 1 , 23 ) , 2 ) + ".png"
      mg_Set( "d_window" , "myBrowseProgressBar" , "value" , mg_Get( "d_window" , "myBrowseProgressBar" , "value" ) + 1 )
      mg_Set( "d_window" , "myBrowseAvailableRecords" , "value" , alltrim( str( val( mg_Get( "d_window" , "myBrowseAvailableRecords" , "value" ) ) + 1 ) ) )
      DO EVENTS
   next
   mg_Do( "d_window" , "myBrowseProgressBar" , "hide" )
   mg_Do( "d_window" , "myBrowseButtonStop" , "hide" )
   mg_Do( "d_window" , "myBrowseSpinner" , "show" )
   mg_Do( "d_window" , "myBrowseButtonAdd" , "show" )
   mg_Set( "d_window" , "myBrowseButtonDelete" , "enabled" , .T. )
   mg_Set( "d_window" , "myBrowseRadioGroupNavigate" , "enabled" , .T. )
   mg_Set( "d_window" , "myBrowse" , "enabled" , .T. )
   if !empty( cAliasOld )
      DBSelectArea( cAliasOld )
   endif
   mg_Set( "d_window" , "myBrowse" , "disableEvents" , .F. )
   mg_Set( "d_window" , "myBrowse" , "disableUpdate" , .F. )
   mg_Set( "d_window" , "myBrowse" , "disableSync" , .F. )
   mg_Do( "d_window" , "myBrowse" , "refresh" )
   mg_Set( "d_window" , "myBrowseAvailableRecords" , "value" , alltrim( str( myRecCount() ) ) )
Return .T.

Function myBrowseDeleteRow()
   Local cAliasOld := alias()
   Local nBrowsePos := mg_Get( "d_window" , "myBrowse" , "value" ) , ;
         nLogicalPos := mg_getVisibleOrdKeyNo( "d_browse" ) , ;
         nPhisicalPos := d_browse->( recNo() ) , ;
         cName := d_browse->myName , ;
         nCode := d_browse->myCode
   if mg_MsgYesNo( "Do you want delete the following record?: '" + alltrim( cName ) + "'" + HB_OsNewLine() + ;
                "Code: " + alltrim( str( nCode ) ) + HB_OsNewLine() + ;
                "Browse row: " + alltrim( str( nBrowsePos ) ) + HB_OsNewLine() + ;
                "Logical record: " + alltrim( str( nLogicalPos ) ) + HB_OsNewLine() + ;
                "Phisical record: " + alltrim( str( nPhisicalPos ) ) )
      DBSelectArea( "d_browse" )
      mg_Set( "d_window" , "myBrowse" , "disableSync" , .T. )
      DELETE
      mg_Do( "d_window" , "myBrowse" , "refresh" )
      d_browse->( DBSkip( -1 ) )
      if bof()
         DBGoTop()
      endif
      if !empty( cAliasOld )
         DBSelectArea( cAliasOld )
      endif
      mg_Set( "d_window" , "myBrowse" , "disableSync" , .F. )
      mg_Set( "d_window" , "myBrowseAvailableRecords" , "value" , alltrim( str( myRecCount() ) ) )
      mg_MsgInfo( "'" + alltrim( cName ) + "' deleted!" + HB_OsNewLine() + ;
                   "Code: " + alltrim( str( nCode ) ) + HB_OsNewLine() + ;
                   "Browse row: " + alltrim( str( nBrowsePos ) ) + HB_OsNewLine() + ;
                   "Logical record: " + alltrim( str( nLogicalPos ) ) + HB_OsNewLine() + ;
                   "Phisical record: " + alltrim( str( nPhisicalPos ) ) )
   endif
Return .T.

Function myRecCount()
Return mg_Get( "d_window" , "myBrowse" , "itemcount" )

Function myBrowseOnNavigateCell()
   mg_Set( "d_window" , "myBrowseMemo" , "value" , alltrim( mg_allstr( d_browse->myMemo ) ) )
// mg_Set( "d_window" , "myBrowseLabelNameBack" , "value" , alltrim( d_browse->myName ) )
   mg_Set( "d_window" , "myBrowseLabelName" , "value" , alltrim( d_browse->myName ) )
   mg_Set( "d_window" , "myBrowseLabelAddress" , "value" , alltrim( d_browse->myAddress ) )
   mg_Set( "d_window" , "myBrowseLabelCity" , "value" , alltrim( d_browse->myCity ) )
   mg_Set( "d_window" , "myBrowseImageHome" , "picture" , d_browse->myHome )
   mg_Set( "d_window" , "myBrowseLabelCell" , "value" , "r:" + alltrim( str( mg_Get( "d_window" , "myBrowse" , "value" ) ) ) + " c:" + alltrim( str( mg_Get( "d_window" , "myBrowse" , "valuecol" ) ) ) )
return .T.

Function UseDataBaseBrowse()
   dbUseArea( .T. , , "d_browse_" + mg_GetThreadName() , "d_browse" )
   index on d_browse->myCode          tag "code01"    to ( "d_browse_" + mg_GetThreadName() )
   index on upper( d_browse->myName ) tag "name01"    to ( "d_browse_" + mg_GetThreadName() )
   index on d_browse->myAddress       tag "address01" to ( "d_browse_" + mg_GetThreadName() )
   OrdSetFocus( "code01" )
   OrdScope( 0 , 2 )                // TOPSCOPE
   OrdScope( 1 , NIL )              // BOTTOMSCOPE
   set filter to at( "FILTER" , d_browse->myName ) == 0
   delete for at( "DELETE" , d_browse->myName ) > 0 all
   DBGoTop()
Return .T.

Function CloseDataBaseBrowse()
   close d_browse
Return .T.

Function ChangeOrder( cInxName )
   if cInxName == "name01"
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "value" , "" )
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "enabled" , .T. )
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "backcolor" , {255,255,255} )
   else
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "value" , "" )
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "enabled" , .F. )
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "backcolor" , {226,226,226} )
   endif
   d_browse->( OrdSetFocus( cInxName ) )
   mg_Do( "d_window" , "myBrowse" , "refresh" )
   mg_Set( "d_window" , "myBrowseAvailableRecords" , "value" , alltrim( str( myRecCount() ) ) )
Return .T.

Function ProgressiveSearch( cName )
   LOCAL bSync := mg_Get( "d_window" , "myBrowse" , "disableSync" )
   if len( cName ) > 0
      cName := padr( upper( cName ) , len( d_browse->myName ) , " " )
      mg_Set( "d_window" , "myBrowse" , "disableSync" , .T. )
      d_browse->( dbgotop() )
      d_browse->( dbseek( cName , .T. ) )
      mg_Set( "d_window" , "myBrowse" , "value" , mg_getVisibleOrdKeyNo( "d_browse" ) )
      mg_Set( "d_window" , "myBrowse" , "disableSync" , bSync )
   endif
Return .T.

Function PutIntoTextBox()
   Local cKey := mg_LastKey()
   if mg_Get( "d_window" , "myBrowseTextBoxSearch" , "enabled" )
      if len( cKey ) == 1 .AND. ;
         ( HB_isChar( cKey ) .OR. ;
           hb_isNumeric( cKey ) )
         mg_Set( "d_window" , "myBrowseTextBoxSearch" , "value" , mg_Get( "d_window" , "myBrowseTextBoxSearch" , "value" ) + if( mg_LastKeyMod() == "SHIFT" , upper( mg_LastKey() ) , lower( mg_LastKey() ) ) )
         Return __MG_KEY_NO_PROPAGATE
      else
         if mg_LastKey() == "Backspace"
            mg_Set( "d_window" , "myBrowseTextBoxSearch" , "value" , substr( mg_Get( "d_window" , "myBrowseTextBoxSearch" , "value" ) , 1 , len( alltrim( mg_Get( "d_window" , "myBrowseTextBoxSearch" , "value" ) ) ) - 1 ) )
            Return __MG_KEY_NO_PROPAGATE
         endif
      endif
   endif
Return NIL

FUNCTION myDemoShowImage( cPicture )

   CREATE WINDOW WinFullImage
      ROW 0
      COL 0
      CAPTION "Image"
      MODAL .T.

      CREATE IMAGE FullImage
         ROW 0
         COL 0
         PICTURE cPicture
         WIDTH mg_get( "WinFullImage" , "FullImage" , "realWidth" )
         HEIGHT mg_get( "WinFullImage" , "FullImage" , "realHeight" )
         STRETCH .T.
      END IMAGE

      WIDTH mg_get( "WinFullImage" , "FullImage" , "width" )
      HEIGHT mg_get( "WinFullImage" , "FullImage" , "height" )

   END WINDOW

   mg_do( "WinFullImage" , "center" )
   mg_do( "WinFullImage" , "activate" )
RETURN NIL

FUNCTION myFontAttrDynamic( nRow , nCol )
   LOCAL aAttrResult
   LOCAL nRecOld
   LOCAL lDisableSyncOld := mg_set( "d_window" , "myBrowse" , "disableSync" , .T. )
   HB_SYMBOL_UNUSED( nCol )
   //
   nRecOld := d_browse->( recNo() )
   d_browse->( dbGoTo( mg_get( "d_window" , "myBrowse" , "recNo" , nRow ) ) )
   DO CASE
      CASE at( "E" , d_browse->myName ) == 1   // Names begining with "E"
         aAttrResult := { "mg_roman" , 12 /*size*/ , /*bold*/ , .T. /*italic*/ , /*underline*/ , /*strikeOut*/ }
      OTHERWISE
         aAttrResult := NIL
   ENDCASE
   d_browse->( dbGoTo( nRecOld ) )
   //
   mg_set( "d_window" , "myBrowse" , "disableSync" , lDisableSyncOld )
RETURN aAttrResult



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