Page 1 of 1

Best current xBrowse doc/sample

Posted: Wed May 13, 2009 3:52 pm
by TimStone
Considering all of the enhancements made to xBrowse, what is the best documentation available for the current class ? What are the best sample files to review ?

I've been using TSBrowse ( older version ) but am considering using xBrowse.

Tim

Re: Best current xBrowse doc/sample

Posted: Wed May 13, 2009 4:32 pm
by ukoenig
Hello Tim,

did You have a look at the xBrowseTools ?
With the Tools, You can test all settings with Preview.
As well there is a source-generator included.
It is a very good help, if You want to change to xBrowse.
Also You can find different test-prg's in the subdirectory /samples of FWH.

Because I updated to FWH 9.04, there will be a Update in a short time.
For the moment, I'm still busy with my new ButtonTools.

Regards
Uwe :lol:

Re: Best current xBrowse doc/sample

Posted: Wed May 13, 2009 8:10 pm
by nageswaragunupudi
Unfortunately all the documentation on xbrowse is not available at one place. I can suggest the following three ways in that order.

1) Study samples in samples folder ( all programs containing 'xbrowse' ). In particular testxbrw3.prg contains more samples.

2) Study commands in xbrowse.ch along with source code of xbrowse.prg. Commands are simple and are compatible with WBrowse and TCBrowse. In most cases simple @ r, c LISTBOX compatible commands of xbrowse can achieve a lot more than we normally expect.

3) Xbrowse documentation in the fivewin help files ( \fwh\manual\*.chm ) along with the announcements in the whatsnew.txt

Re: Best current xBrowse doc/sample

Posted: Thu May 14, 2009 11:18 am
by PeterHarmes
ukoenig wrote:did You have a look at the xBrowseTools ?
With the Tools, You can test all settings with Preview.
As well there is a source-generator included.
It is a very good help, if You want to change to xBrowse.


Hi Uwe

Where can i get xBrowse Tools? I'd be interested in looking at that

Thanks

Pete

Re: Best current xBrowse doc/sample

Posted: Thu May 14, 2009 12:10 pm
by ukoenig
Hello Peter,

You can Download from here.
http://www.pflegeplus.com/fw_downloads/brwtools5.zip

Read something about the Update :
viewtopic.php?f=3&t=13831&p=71403#p71403

Regards
Uwe :lol:

Re: Best current xBrowse doc/sample

Posted: Thu May 14, 2009 1:29 pm
by PeterHarmes
Thanks Uwe,

That looks really helpfull - I started to write a generic xBrowse function where it gets the contents of the fields to display from a dbf file, allowing the users to configure their own browses, but due to problems with xHarbour enterprise i havent been able to finish this. Hopefully, i can finish this function and use your program to enhance it further :)

Best regards,

Pete

Re: Best current xBrowse doc/sample

Posted: Fri May 15, 2009 10:04 am
by ukoenig
Hello Peter,

With the Tools, You can save Your Settings to a Project-Database.
Inside Your Application, You can call the Record for Your xbrowse, to load the Var's
for Your Browser like Colors, Bmp's...

Image

Best Regards
Uwe :lol:

Re: Best current xBrowse doc/sample

Posted: Fri May 15, 2009 1:43 pm
by TimStone
Thank you for the input.

Re: Best current xBrowse doc/sample

Posted: Fri May 15, 2009 3:07 pm
by ukoenig
Hello Tim,

If anybody wants to include the Tools and Database to a Software-package, there is no problem.
The Database includes var's for the Dialogs ( + Buttonbar ), where the xbrowse is shown, as well.

DLG_COLOR1 = 1. Color
DLG_COLOR2 = 2. Color for Gradient
DLG_STYLE1 = Dialog-Color-Style ( Mono or Gradient )
LOGO3 = Background-Image
BARWIDTH = Width of Buttonbar
BARHIGHT = Hight of Buttonbar

Image

It is possible for the next Update to include some more Dialog-vars
like Styles : BRICKS, BORLAND and TILED
( will be included in Browser : Dialog-Background-Style Pos. 7, 8 and 9 )

Maybe to delete the Bar-settings ( Width and Hight ) ?
I think, it doesn't make sense, because the user doesn't know the Dialog-Size ( it is up to the programmer )
The free space in this Folder, could be used for other extensions.

With the new IMPORT-Button inside the Template-Manager, You can open the Project-Dialog and save a
Template to a selected Browser inside Your Software.
1. Open the Project-manager from the Toolbar with SELECT
2. Select the Template You want to use for a Browser
3. Select the Browser, You want to import the Template
4. Save the Values to the Browser with the Button < IMPORT >
Inside Your Software, You jump to the Record of the Project-Database to use the Values for the Browser.

There is a new Fieldname-overview, how to use the Var's for the Browsers inside Your Software.

Image

I think with these changes, it comes close to the solution, Peter wants to do : Creating a user-definded xBrowse.

A Test-Dialog with Browser, works complete with Var's from the Database :

Code: Select all | Expand


//-----------  xBrowse - Test, using Var's from the Project-DBF -----------------//

STATIC FUNCTION Test_Browse5()
Local oDlg5, oLbx30, oBrush5, oBmp5
Local cAlias := cGetNewAlias( "CUST" )
LOCAL oBmp1, nBMPheight
LOCAL oHeadFont, oBrwFont, oFootFont

nFOR := 1

IF aFONT1_3  = .T. .and. aFONT1_4  = .T.
    DEFINE FONT oHeadFont NAME aFONT1_1  SIZE 0, aFONT1_2  BOLD ITALIC
ENDIF
IF aFONT1_3  = .F. .and. aFONT1_4  = .F.
    DEFINE FONT oHeadFont NAME aFONT1_1  SIZE 0, aFONT1_2  
ENDIF
IF aFONT1_3  = .T. .and. aFONT1_4  = .F.
    DEFINE FONT oHeadFont NAME aFONT1_1  SIZE 0, aFONT1_2  BOLD
ENDIF
IF aFONT1_3  = .F. .and. aFONT1_4  = .T.
    DEFINE FONT oHeadFont NAME aFONT1_1  SIZE 0, aFONT1_2  ITALIC
ENDIF

IF aFONT2_3  = .T. .and. aFONT2_4  = .T.
    DEFINE FONT oBrwFont NAME aFONT2_1  SIZE 0, aFONT2_2  BOLD ITALIC
ENDIF
IF aFONT2_3  = .F. .and. aFONT2_4  = .F.
    DEFINE FONT oBrwFont NAME aFONT2_1  SIZE 0, aFONT2_2  
ENDIF
IF aFONT2_3  = .T. .and. aFONT2_4  = .F.
    DEFINE FONT oBrwFont NAME aFONT2_1  SIZE 0, aFONT2_2  BOLD
ENDIF
IF aFONT2_3  = .F. .and. aFONT2_4  = .T.
    DEFINE FONT oBrwFont NAME aFONT2_1  SIZE 0, aFONT2_2  ITALIC
ENDIF

IF aFONT3_3  = .T. .and. aFONT3_4  = .T.
    DEFINE FONT oFootFont NAME aFONT3_1  SIZE 0, aFONT3_2  BOLD ITALIC
ENDIF
IF aFONT3_3  = .F. .and. aFONT3_4  = .F.
    DEFINE FONT oFootFont NAME aFONT3_1  SIZE 0, aFONT3_2  
ENDIF
IF aFONT3_3  = .T. .and. aFONT3_4  = .F.
    DEFINE FONT oFootFont NAME aFONT3_1  SIZE 0, aFONT3_2  BOLD
ENDIF
IF aFONT3_3  = .F. .and. aFONT3_4  = .T.
    DEFINE FONT oFootFont NAME aFONT3_1  SIZE 0, aFONT3_2  ITALIC
ENDIF

REQUEST DBFCDX
DBSELECTAREA(3)
USE CUSTOMER NEW ALIAS (cAlias) SHARED VIA "DBFCDX"
GO TOP

DEFINE DIALOG oDlg5 RESOURCE "TESTSOURCE"

oLbx30 := TXBrowse():New( oDlg5 )
nBMPheight := oLbx30:nRowHeight

IF BR_STYLE = 1
    IF BR_LINE = 1
        oLbx30:nColDividerStyle  := LINESTYLE_BLACK
        oLbx30:nRowDividerStyle := LINESTYLE_BLACK
    ENDIF
    IF BR_LINE = 2
        oLbx30:nColDividerStyle  := LINESTYLE_DARKGRAY
        oLbx30:nRowDividerStyle := LINESTYLE_DARKGRAY
    ENDIF
    IF BR_LINE = 3
        oLbx30:nColDividerStyle  := LINESTYLE_FORECOLOR
        oLbx30:nRowDividerStyle := LINESTYLE_FORECOLOR
    ENDIF
    IF BR_LINE = 4
        oLbx30:nColDividerStyle  := LINESTYLE_LIGHTGRAY
        oLbx30:nRowDividerStyle := LINESTYLE_LIGHTGRAY
    ENDIF
    IF BR_LINE = 5
        oLbx30:nColDividerStyle  := LINESTYLE_INSET
        oLbx30:nRowDividerStyle := LINESTYLE_INSET
    ENDIF
    IF BR_LINE = 6
        oLbx30:nColDividerStyle  := LINESTYLE_RAISED
        oLbx30:nRowDividerStyle := LINESTYLE_RAISED
    ENDIF
ENDIF
IF BR_STYLE = 2
    oLbx30:nColDividerStyle  := LINESTYLE_NOLINES      
    IF BR_LINE = 1
        oLbx30:nRowDividerStyle := LINESTYLE_BLACK
    ENDIF
    IF BR_LINE = 2
        oLbx30:nRowDividerStyle := LINESTYLE_DARKGRAY
    ENDIF
    IF BR_LINE = 3
        oLbx30:nRowDividerStyle := LINESTYLE_FORECOLOR
    ENDIF
    IF BR_LINE = 4
        oLbx30:nRowDividerStyle := LINESTYLE_LIGHTGRAY
    ENDIF
    IF BR_LINE = 5
        oLbx30:nRowDividerStyle := LINESTYLE_INSET
    ENDIF
    IF BR_LINE = 6
        oLbx30:nRowDividerStyle := LINESTYLE_RAISED
    ENDIF
ENDIF
IF BR_STYLE = 3
    oLbx30:nRowDividerStyle  := LINESTYLE_NOLINES
    IF BR_LINE = 1
        oLbx30:nColDividerStyle  := LINESTYLE_BLACK
    ENDIF
    IF BR_LINE = 2
        oLbx30:nColDividerStyle  := LINESTYLE_DARKGRAY
    ENDIF
    IF BR_LINE = 3
        oLbx30:nColDividerStyle  := LINESTYLE_FORECOLOR
    ENDIF
    IF BR_LINE = 4
        oLbx30:nColDividerStyle  := LINESTYLE_LIGHTGRAY
    ENDIF
    IF BR_LINE = 5
        oLbx30:nColDividerStyle  := LINESTYLE_INSET
    ENDIF
    IF BR_LINE = 6
        oLbx30:nColDividerStyle  := LINESTYLE_RAISED
    ENDIF
ENDIF
IF BR_STYLE = 4
    oLbx30:nRowDividerStyle := LINESTYLE_NOLINES
    oLbx30:nColDividerStyle  := LINESTYLE_NOLINES      
ENDIF
IF BR_STYLE < 4
    IF BR_CELL  = 1
        oLbx30:nMarqueeStyle :=  MARQSTYLE_NOMARQUEE  
    ENDIF
    IF BR_CELL  = 2
        oLbx30:nMarqueeStyle :=  MARQSTYLE_DOTEDCELL  
    ENDIF
    IF BR_CELL  = 3
        oLbx30:nMarqueeStyle :=  MARQSTYLE_SOLIDCELL
    ENDIF
    IF BR_CELL  = 4
        oLbx30:nMarqueeStyle :=  MARQSTYLE_HIGHLCELL  
    ENDIF
    IF BR_CELL  = 5
        oLbx30:nMarqueeStyle :=  MARQSTYLE_HIGHLROWRC
    ENDIF
    IF BR_CELL  = 6
        oLbx30:nMarqueeStyle :=  MARQSTYLE_HIGHLROW
    ENDIF
    IF BR_CELL  = 7
        oLbx30:nMarqueeStyle :=  MARQSTYLE_HIGHLROWMS
    ENDIF
ENDIF

// HEADER GADIENT ON / OFF
// ---------------------------------------
IF HEADGRAD = 1
    oLbx30:l2007 := .T.
    oLbx30:bClrGrad := { | lInvert | If( ! lInvert, ;
    { { MOVE1, BR_COLOR1, BR_COLOR2 }, ;
         { MOVE1, BR_COLOR2, BR_COLOR1 } }, ;
        { { MOVE2, BR_MCOLOR, BR_COLOR2 }, ;
         { MOVE2, BR_COLOR2, BR_MCOLOR } } ) }
        oLbx30:bClrHeader := { || { BR_THCOLOR, 0 } }
    IF FOOTER = 1
        oLbx30:bClrFooter := { || { BR_TFCOLOR, 0 } }
    ENDIF
ELSE
    oLbx30:bClrGrad := NIL
    oLbx30:l2007 := .F.
ENDIF

// Color-Set
// -------------------------------------------------
oLbx30:bClrSelFocus = { || { SELTCOLOR, SELBCOLOR } }  

IF SELECTOR = 1
    // Color Record-Selector
    // --------------------------------------
    oLbx30:nRecSelColor = SELCOLOR1
ELSE
    oLbx30:lRecordSelector  := .F.
ENDIF

// Lost Focus Color
// ---------------------
oLbx30:bClrSel = { || { SELTCOLOR, SELBCOLOR } }

IF SCROLLH = 1
    oLbx30:lHScroll := .T.
ELSE
    oLbx30:lHScroll := .F.
ENDIF
IF SCROLLV = 1
    oLbx30:lVScroll := .T.
ELSE
    oLbx30:lVScroll := .F.
ENDIF

IF FOOTER = 1
    oLbx30:lFooter := .T.
    oLbx30:nHeaderHeight := BRWHEADER
    oLbx30:nFooterHeight := BRWFOOTER
ELSE
    oLbx30:lFooter := .F.
    oLbx30:nHeaderHeight := BRWHEADER
ENDIF

oCol := oLbx30:AddCol()
oCol:AddResource( "CLIP" )
oCol:AddResource( "star" )
oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | ;
        If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ;
    ::nHeadBmpNo := 2 ), ::oLbx30:Refresh() }
oCol:cHeader       := "CLIP"
oCol:nHeadBmpNo    := 1
oCol:nHeadBmpAlign := AL_RIGHT

oCol := oLbx30:AddCol()
oCol:bStrData  := { || (cAlias)->First}
oCol:cHeader   := "First"
oCol:cFooter  := "First"

oCol := oLbx30:AddCol()
oCol:bStrData := { || (cAlias)->Last}
oCol:cHeader  := "Last"
oCol:cFooter  := "Last"
IF !EMPTY( LOGO2 )
    oCol:AddBmpFile(LOGO2)
    oCol:bBmpData := {|| 1 }
    DEFINE BITMAP oBmp1 FILENAME LOGO2
    nBMPHight := oBmp1:nHeight()
    oBmp1:End()
ENDIF

oCol := oLbx30:AddCol()
oCol:bStrData := { || (cAlias)->City}
oCol:cHeader  := "City"
oCol:cFooter  := "City"

oCol := oLbx30:AddCol()
oCol:bStrData := { || (cAlias)->State}
oCol:cHeader  := "State"
oCol:cFooter  := "State"

oCol := oLbx30:AddCol()
oCol:bStrData := { || IIF((cAlias)->Married, "YES","NO")}
oCol:cHeader  := "Married"
oCol:cFooter  := "Married"

oCol := oLbx30:AddCol()
oCol:bStrData := { || DTOS((cAlias)->HireDate)}
oCol:cHeader  := "HireDate"
oCol:cFooter  := "HireDate"

oCol := oLbx30:AddCol()
oCol:bStrData := { || STR((cAlias)->Age)}
oCol:cHeader  := "Age"
oCol:cFooter  := "Age"

oCol := oLbx30:AddCol()
oCol:bStrData := { || STR((cAlias)->Salary)}
oCol:cHeader  := "Salary"
oCol:cFooter  := "Salary"

oLbx30:oFont := oBrwFont

oLbx30:nRowHeight := BR_ROW

DEFINE BRUSH oBrush5 COLOR SELCOLOR2
oLbx30:hBrushRecSel( oBrush5 )
RELEASE BRUSH oBrush5
IF !EMPTY( BRSELECT2 )
    oBmp5 := ReadBitmap( 0, BRSELECT2 )
    oLbx30:hBmpRecSel( oBmp5 )
ENDIF

oLbx30:SetRDD()

IF STRETCH = 2 .and. !EMPTY ( LOGO4 )
    oLbx30:cBmpAdjBrush := LOGO4
    oLbx30:SetBackGround( LOGO4 )
    aeval( oLbx30:aCols, { |o|o:lColTransparent := .t. } )
ENDIF

oLbx30:CreateFromResource( 110 )

IF !EMPTY( LOGO2 )
    IF oLbx30:nRowHeight < nBMPHight
        oLbx30:nRowHeight := nBMPHight + 4
    ENDIF
ENDIF
IF !EMPTY( LOGO1 )
    DEFINE BRUSH oBrush5 FILENAME LOGO1
    oLbx30:SetBackGround( oBrush5 )
    RELEASE BRUSH oBrush5
    oLbx30:Refresh()
ELSE
    // COLUMN Data MONO / ALTERNATE
    // ------------------------------------------------
    IF VERTHORIZ = 1
        IF ALTERMONO = 1
            aClrCol := { { ROW_TEXT, ROW_COL2 }, { ROW_TEXT, ROW_COL1 } }
        ELSE
            aClrCol := { { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL1 } }
        ENDIF
        oLbx30:bClrStd := { || aClrCol[ oLbx30:KeyNo % 2 + 1 ] }
    ELSE
        // Column-Display
        lSELECT := .T.
        aClrCol := { { ROW_TEXT, COL_COLOR }, { ROW_TEXT, ROW_COL1 } }
        FOR nFOR := 1 TO LEN( oLbx30:aCols )
            IF lSELECT = .T.
                oLbx30:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 1 + 2 ] }
                lSELECT := .F.
            ELSE
                oLbx30:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 2 + 1 ] }
                lSELECT := .T.
            ENDIF
        NEXT   
    ENDIF
ENDIF

i := 1
FOR i := 1 TO LEN( oLbx30:aCols )
    WITH OBJECT oLbx30:aCols[i]
        oLbx30:aCols[i]:oHeaderFont := oHeadFont
        oLbx30:aCols[i]:bClrHeader := { || { BR_THCOLOR, BR_COLOR1 } }
        IF FOOTER = 1
            oLbx30:aCols[i]:oFooterFont := oFootFont
            oLbx30:aCols[i]:bClrFooter := { || { BR_TFCOLOR, BR_COLOR3 } }
        ENDIF      
    END
NEXT

REDEFINE BUTTONBMP oBtn11  ID 10 OF oDlg5 ;
ACTION ( oDlg5:End() ) ;
BITMAP "Quit" PROMPT " Exit" TEXTRIGHT
oBtn11:cToolTip =  { "Close" + CRLF + ;
                                "the Dialog","xBrowse-Preview", 1, CLR_BLACK, 14089979 }

ACTIVATE DIALOG oDlg5 CENTERED  ;
ON PAINT DLG_BACK( oDlg5 ) ;
ON INIT ( oDlg5:Move( 30, 10, oDlg5:nWidth, oDlg5:nHeight, .f. ) )

DBSELECTAREA(3)
NET_CLOSE( 5, 5, .T. )

RELEASE FONT oHeadFont
RELEASE FONT oBrwFont
RELEASE FONT oFootFont

RETURN ( NIL )  

// ---------------------------------------------

FUNCTION DLG_BACK( oDlg5 )
LOCAL oBrush6
LOCAL hDC := oDlg5:GetDC()

IF DLG_STYLE1 < 5
    gradpaint2( hDC, oDlg5 )
ENDIF
IF DLG_STYLE1 = 5
    DEFINE BRUSH oBrush6 COLOR DLG_COLOR1
    FillRect(oDlg5:hDC, GetClientRect( oDlg5:hWnd ), oBrush6:hBrush )
    oBrush6:End()
ENDIF
IF DLG_STYLE1 =  6
    DEFINE BRUSH oBrush6 FILENAME LOGO3
    FillRect(oDlg5:hDC, GetClientRect( oDlg5:hWnd ), oBrush6:hBrush )
    oBrush6:End()
ENDIF

oDlg5:ReleaseDC()

RETURN ( NIL )
 


Best Regards
Uwe :lol: