Two bugs on TCBrowse

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Two bugs on TCBrowse

Post by Enrico Maria Giordano »

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?

Code: Select all

#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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Two bugs on TCBrowse

Post by Enrico Maria Giordano »

This is the fix for point 1 (part of TCBrowse:DrawSelect() method):

Code: Select all

        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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

Thanks for the fix! :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
Post Reply