From 8a50c19c2ba02a8ee839d7693e45aadbb93e75ea Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 23 May 2008 02:12:23 +0000 Subject: [PATCH] 2008-05-22 19:00 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/tests/demowvg.prg + CLASS TBrowseWVG FROM TBrowse Subclassed TBrowse to retreive <::aColumnsSep> for WVG browsers to paint column separator lines. Now Wvt*class prompt of main menu works like a charm. /* BTW, new TBrowse is really a wonderful code. Hats off to Przem, once again. */ --- harbour/ChangeLog | 10 ++++ harbour/contrib/gtwvg/tests/demowvg.prg | 72 ++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 55fb255cbb..d8c6f6ba2a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-05-22 19:00 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/tests/demowvg.prg + + CLASS TBrowseWVG FROM TBrowse + Subclassed TBrowse to retreive <::aColumnsSep> for WVG browsers to paint column + separator lines. Now Wvt*class prompt of main menu works like a charm. + + /* BTW, new TBrowse is really a wonderful code. + Hats off to Przem, once again. + */ + 2008-05-22 12:20 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com) * source/common/hbstr.c * fixed typo in prevoius commit diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index f2bdf79403..18a951a80a 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -655,7 +655,8 @@ FUNCTION WvtMyBrowse() Popups( 2 ) - oBrowse := TBrowseNew( nTop + 3, nLeft + 2, nBottom - 1, nRight - 2 ) + //oBrowse := TBrowseNew( nTop + 3, nLeft + 2, nBottom - 1, nRight - 2 ) + oBrowse := TBrowseWVG():New( nTop + 3, nLeft + 2, nBottom - 1, nRight - 2 ) oBrowse:ColSep = ' ' oBrowse:HeadSep = '__' @@ -962,7 +963,8 @@ STATIC FUNCTION CfgMyBrowse( aFields, cUseAlias, aTLBR, cDesc, oParent, cColorSp Select( cUseAlias ) info_:= DbStruct() - oBrowse := TBrowseNew( aTLBR[ 1 ], aTLBR[ 2 ], aTLBR[ 3 ], aTLBR[ 4 ] ) + //oBrowse := TBrowseNew( aTLBR[ 1 ], aTLBR[ 2 ], aTLBR[ 3 ], aTLBR[ 4 ] ) + oBrowse := TBrowseWVG():New( aTLBR[ 1 ], aTLBR[ 2 ], aTLBR[ 3 ], aTLBR[ 4 ] ) oBrowse:ColSep := ' ' oBrowse:HeadSep := '__' @@ -2093,3 +2095,69 @@ FUNCTION DrawSlide( hDlg, nSlide ) Win_ReleaseDC( hDlg,hDC ) Return nil + +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +// +// TBrowseWVG From TBrowse +// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// + +#include "hbclass.ch" + +#define _TBCI_COLOBJECT 1 // column object +#define _TBCI_COLWIDTH 2 // width of the column +#define _TBCI_COLPOS 3 // column position on screen +#define _TBCI_CELLWIDTH 4 // width of the cell +#define _TBCI_CELLPOS 5 // cell position in column +#define _TBCI_COLSEP 6 // column separator +#define _TBCI_SEPWIDTH 7 // width of the separator +#define _TBCI_HEADING 8 // column heading +#define _TBCI_FOOTING 9 // column footing +#define _TBCI_HEADSEP 10 // heading separator +#define _TBCI_FOOTSEP 11 // footing separator +#define _TBCI_DEFCOLOR 12 // default color +#define _TBCI_FROZENSPACE 13 // space after frozen columns +#define _TBCI_LASTSPACE 14 // space after last visible column +#define _TBCI_SIZE 14 // size of array with TBrowse column data + +//-------------------------------------------------------------------// + +CLASS TBrowseWVG FROM TBrowse + + ACCESS aColumnsSep INLINE ::ColumnsSep() + + METHOD ColumnsSep() + + ENDCLASS + +//-------------------------------------------------------------------// + +METHOD ColumnsSep() + Local aSep := {} + Local lFirst, aCol, nColPos + + lFirst := .T. + FOR EACH aCol IN ::aColData + IF aCol[ _TBCI_COLPOS ] != NIL + IF lFirst + lFirst := .F. + + ELSE + nColPos := aCol[ _TBCI_COLPOS ] + + IF aCol[ _TBCI_SEPWIDTH ] > 0 + nColPos += Int( aCol[ _TBCI_SEPWIDTH ]/2 ) + ENDIF + + aadd( aSep, nColPos ) + ENDIF + ENDIF + NEXT + + Return aSep + +//----------------------------------------------------------------------//