FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To change color of a tree object
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
To change color of a tree object
Posted: Sun Sep 24, 2006 08:46 PM

Enrico,

Excellent :-) I also tried it but my code had a mistake so I thought that the implementation was going to be more complex.

Very good!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
To change color of a tree object
Posted: Sun Sep 24, 2006 09:01 PM
Enrico,

These new methods in Class TTreeView makes it automatic and FiveWin compatible:
   METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::SetColor( ::nClrText, ::nClrPane )

   METHOD SetColor( nClrText, nClrPane ) INLINE ;
      Super:SetColor( nClrText, nClrPane ), TVSetColor( ::hWnd, nClrText, nClrPane )

This code in method New():
   if ! Empty( oWnd:hWnd )
      ::Create( CTRL_NAME )
      oWnd:AddControl( Self )
      ::SetColor( nClrFore, nClrBack ) // New !

and finally just one C function call:
CLIPPER TVSETCOLOR( PARAMS ) // hWnd, nClrFore, nClrBack
{
   TreeView_SetBkColor( ( HWND ) _parnl( 1 ), _parnl( 3 ) );
   TreeView_SetTextColor( ( HWND ) _parnl( 1 ), _parnl( 2 ) );   	
}

Now the sample code is just as:
    @ 0, 0 TREEVIEW oTree COLOR CLR_WHITE, CLR_GREEN

No extra calls required :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
To change color of a tree object
Posted: Mon Sep 25, 2006 06:30 AM

Great!

EMG

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
To change color of a tree object
Posted: Sun Oct 01, 2006 09:38 AM
Hello Mr.Antonio



CLIPPER TVSETCOLOR( PARAMS ) // hWnd, nClrFore, nClrBack
{
TreeView_SetBkColor( ( HWND ) _parnl( 1 ), _parnl( 3 ) );
TreeView_SetTextColor( ( HWND ) _parnl( 1 ), _parnl( 2 ) );
}


should be included where?

Regards

-Ramesh Babu P
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
To change color of a tree object
Posted: Sun Oct 01, 2006 11:09 AM

Ramesh,

Into source\winapi\treeview.c

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
To change color of a tree object
Posted: Sun Oct 01, 2006 02:20 PM
Hello Mr. Antonio

Thank you for your suggestion.

I have inserted the following code at the bottom of treeview.c in
winapi directory and tried to compile it. It is giving the following
errors:


Warning W8019 treeview.c 234: Code has no effect in function TVSETCOLOR

Warning W8019 treeview.c 235: Code has no effect in function TVSETCOLOR


I don't have knowledge in C.

Please advise me what to do. Or else please provide me the correct
treeview.c link to compile without any warnings.

- Ramesh Babu P
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
To change color of a tree object
Posted: Sun Oct 01, 2006 06:20 PM

Ramesh,

You can ignore those warnings.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion