To change color of a tree object
- MarcoBoschi
- Posts: 925
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
To change color of a tree object
If I try to color a Tree the background of items remain always white.
I have to obtain a tree of the same color of all others objects in a dialog.
Any trick?
I have to obtain a tree of the same color of all others objects in a dialog.
Any trick?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- MarcoBoschi
- Posts: 925
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Marco,
Please check that you have these lines in Class TTreeView:
Please check that you have these lines in Class TTreeView:
Code: Select all
METHOD ReDefine( nId, oWnd, nClrFore, nClrBack, lDesign, cMsg ) CLASS TTreeView
DEFAULT oWnd := GetWndDefault(),;
nClrFore := oWnd:nClrText,;
nClrBack := oWnd:nClrPane,; // GetSysColor( COLOR_WINDOW ),;
lDesign := .f.
...
- MarcoBoschi
- Posts: 925
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Here it is:
As you can see, the colors of the subitems are still black on white.
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oTree
DEFINE DIALOG oDlg;
SIZE 400, 400
@ 0, 0 TREEVIEW oTree COLOR CLR_GREEN, CLR_RED
ACTIVATE DIALOG oDlg;
ON INIT FILLTREE( oTree );
CENTER
RETURN NIL
STATIC FUNCTION FILLTREE( oTree )
LOCAL oItem
oItem = oTree:Add( "Test" )
oItem:Add( "Test1" )
oItem:Add( "Test2" )
oItem:Add( "Test3" )
oTree:Expand()
RETURN NIL
EMG
- MarcoBoschi
- Posts: 925
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- MarcoBoschi
- Posts: 925
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Solved!
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oTree
DEFINE DIALOG oDlg;
SIZE 400, 400
@ 0, 0 TREEVIEW oTree COLOR CLR_GREEN, CLR_RED
ACTIVATE DIALOG oDlg;
ON INIT FILLTREE( oTree );
CENTER
RETURN NIL
STATIC FUNCTION FILLTREE( oTree )
LOCAL oItem
oItem = oTree:Add( "Test" )
oItem:Add( "Test1" )
oItem:Add( "Test2" )
oItem:Add( "Test3" )
oTree:Expand()
TVSETTEXTCOLOR( oTree:hWnd, CLR_GREEN )
TVSETBKCOLOR( oTree:hWnd, CLR_RED )
RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "commctrl.h"
#include "hbapi.h"
HB_FUNC( TVSETTEXTCOLOR )
{
hb_retnl( ( LONG ) TreeView_SetTextColor( ( HWND ) hb_parnl( 1 ), hb_parnl( 2 ) ) );
}
HB_FUNC( TVSETBKCOLOR )
{
hb_retnl( ( LONG ) TreeView_SetBkColor( ( HWND ) hb_parnl( 1 ), hb_parnl( 2 ) ) );
}
#pragma ENDDUMP
- MarcoBoschi
- Posts: 925
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact: