To change color of a tree object

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

Post by Antonio Linares »

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

Post by Antonio Linares »

Enrico,

These new methods in Class TTreeView makes it automatic and FiveWin compatible:

Code: Select all

   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():

Code: Select all

   if ! Empty( oWnd:hWnd )
      ::Create( CTRL_NAME )
      oWnd:AddControl( Self )
      ::SetColor( nClrFore, nClrBack ) // New !
and finally just one C function call:

Code: Select all

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:

Code: Select all

    @ 0, 0 TREEVIEW oTree COLOR CLR_WHITE, CLR_GREEN 
No extra calls required :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

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

Post by Antonio Linares »

Ramesh,

Into source\winapi\treeview.c
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

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

Post by Antonio Linares »

Ramesh,

You can ignore those warnings.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply