Two bugs on TCBrowse

Two bugs on TCBrowse

Postby Enrico Maria Giordano » Fri Jan 20, 2006 4: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?

Code: Select all  Expand view  RUN
#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: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Two bugs on TCBrowse

Postby Enrico Maria Giordano » Fri Jan 20, 2006 10:02 pm

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

Code: Select all  Expand view  RUN
        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
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Fri Jan 20, 2006 10:28 pm

Enrico,

Thanks for the fix! :)
regards, saludos

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

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

Postby Enrico Maria Giordano » Fri Jan 20, 2006 10:44 pm

Thank you!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests