Page 1 of 1

Little bug in TCBrowse class

Posted: Sat Dec 15, 2007 10:45 am
by Enrico Maria Giordano
In the following sample press 13 times the right arrow key on the keyboard and then look at the browse headers. You should see a little change on them (the bottom shadow becomes gray and larger).

Code: Select all

#include "Fivewin.ch"
#include "Tcbrowse.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    LOCAL i

    USE TEST

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 0, 0 BROWSE oBrw

    ADD COLUMN TO oBrw;
               DATA "Frozen";
               HEADER "FROZEN"

    oBrw:bLogicLen = { || LastRec() }

    oBrw:lCellStyle = .T.

    oBrw:nFreeze = 1

    FOR i = 1 TO 20
        ADD COLUMN TO oBrw;
                   DATA "Data";
                   HEADER "DATA" + LTRIM( STR( i ) )
    NEXT

    ADD COLUMN TO oBrw

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    CLOSE

    RETURN NIL
EMG

Posted: Sat Dec 15, 2007 10:45 pm
by Antonio Linares
Enrico,

Fixed. It was such a little thing but took me several hours to found it :-)

In Class TCBrowse Method DrawHeaders() change this line:

#define SM_CXVSCROLL 2

local nMaxWidth := ::nWidth() - GetSysMetrics( SM_CXVSCROLL ) - 4

Posted: Sun Dec 16, 2007 10:09 am
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

Fixed. It was such a little thing but took me several hours to found it :-)
I'm very sorry. :-(

Anyway, thank you.

EMG

Posted: Sun Dec 16, 2007 10:25 am
by Enrico Maria Giordano
And while you are looking at it, please see if you can easily implement codeblocks for nClrForeFocus and nClrBackFocus. :-)

Code: Select all

#include "Fivewin.ch"
#include "Tcbrowse.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    USE TEST

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 0, 0 BROWSE oBrw

    oBrw:bLogicLen = { || LastRec() }

    oBrw:lCellStyle = .T.

    oBrw:nClrBackFocus = { || CLR_HGREEN }

    ADD COLUMN TO oBrw;
               DATA "Data" + LTRIM( STR( RECNO() ) ) + "   ";
               HEADER "DATA"

    ADD COLUMN TO oBrw

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    CLOSE

    RETURN NIL
EMG

Posted: Sun Dec 16, 2007 11:02 am
by Antonio Linares
Enrico,

Don't feel sorry at all. I really appreciate your feedback,

Its our job to locate and solve the bugs :-) Thanks!