FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Two bugs on TCBrowse
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Two bugs on TCBrowse
Posted: Fri Jan 20, 2006 04:11 PM
The following sample shows two little bugs:

1. How to get rid of the ugly black background on the not focused cells?

2. Why the dialog can't be closed using ESC?

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


FUNCTION MAIN()

    LOCAL oDlg, oBrw, oCol

    USE TEST

    DEFINE DIALOG oDlg SIZE 300, 300

    @ 0, 0 BROWSE oBrw

    ADD COLUMN TO oBrw;
               DATA TEST -> last;
               HEADER "LAST";
               COLOR CLR_RED, CLR_GREEN

    ADD COLUMN TO oBrw;
               DATA TEST -> first;
               HEADER "FIRST";
               COLOR CLR_RED, CLR_GREEN

    oBrw:lCellStyle = .T.

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

    CLOSE

    RETURN NIL


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Two bugs on TCBrowse
Posted: Fri Jan 20, 2006 10:02 PM
This is the fix for point 1 (part of TCBrowse:DrawSelect() method):

        else
          if ! ::lCellStyle .or. ::nColAct == nJ
             nClrFore := nClrForeFocus
          else
             if (bClrFore := oColumn:bClrFore) == nil // backgnd nClrBackFocus
                nClrFore = ::nClrText
             else
                nClrFore = bClrFore
             endif

             if ValType( nClrFore ) == "B" //EMG
                nClrFore = Eval( nClrFore, nRowPos, nJ ) //EMG
             endif //EMG
          endif
          if ! ::lCellStyle .or. ::nColAct == nJ
             nClrBack := nClrBackFocus
          else
             if (bClrBack := oColumn:bClrBack) == nil // backgnd nClrBackFocus
                nClrBack = ::nClrPane
             else
                nClrBack = bClrBack
             endif

             if ValType( nClrBack ) == "B" //EMG
                nClrBack = Eval( nClrBack, nRowPos, nJ ) //EMG
             endif //EMG
          endif
        endif


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Two bugs on TCBrowse
Posted: Fri Jan 20, 2006 10:28 PM

Enrico,

Thanks for the fix! :)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Two bugs on TCBrowse
Posted: Fri Jan 20, 2006 10:42 PM

Enrico,

For the ESC bug, make these changes in source\classes\control:

METHOD KeyDown( nKey, nFlags ) CLASS TControl

if nKey == VK_ESCAPE
::oWnd:KeyChar( nKey, nFlags )
return 0
endif

...

and remove that portion of code from KeyChar(...) CLASS TControl.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion