Color of DCTreeItem and DCSubMenu

This forum is for eXpress++ general support.
Message
Author
Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Color of DCTreeItem and DCSubMenu

#1 Post by Wolfgang Ciriack »

Hi Roger,

is it possible to set the text color of DCTreeitem and DCSubmenu with OWNERDRAW ?
I can set the background color but not the item color.
Or does the color comes from windows system colors ?
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Color of DCTreeItem and DCSubMenu

#2 Post by rdonnay »

Sorry, but XbpTreeview and XbpTreeviewItem do not support owner drawing.

DCSUBMENU does support owner drawing.
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Color of DCTreeItem and DCSubMenu

#3 Post by Wolfgang Ciriack »

Hello Roger,
i mean your command DCSUBMENU...OWNERDRAW...
I have initialisied this with

Code: Select all

	DC_XbpMenuConfig({M->oGDL:Color_Background, ;	     //  1 - Sub Menu Background Color
					  GRA_CLR_BLACK, ;		      	     //  2 - Sub Menu Vertical Bar Foreground Color
					  GRA_CLR_HIGHLIGHT, ;		     //  3 - Sub Menu Vertical Bar Background Color
					  GRA_CLR_BLACK, ;			     //  4 - Sub Menu Outline Color
					  '11.Arial Fett', ;			     //  5 - Sub Menu Vertical Bar Font
					  .F., ;
					  '10.Marlett', ;				     //  6 - Sub Menu Check Character Font
					  'b', ;					     //  7 - Sub Menu Check Character
					  M->oGDL:Color_Foreground, ;	     //  8 - Menu Bar Foreground Color
					  M->oGDL:Color_Background, ;	     //  9 - Menu Bar Background Color
					  GRA_CLR_BLACK, ;			    // 10 - Sub Menu Foreground Color
					  '8.Arial'})				    // 11 - Menu Bar Font
But the Submenu Foreground Color does not change when i try to set it to GRA_CLR_WHITE (on GRA_CLR_BLACK), so i have black on black :( .
The DCMENUBAR does it in white on black.
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Color of DCTreeItem and DCSubMenu

#4 Post by rdonnay »

The problem appears to be that the foreground color never changes from BLACK.
I am working on this.

I was just getting ready to release build 268, and now this.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Color of DCTreeItem and DCSubMenu

#5 Post by rdonnay »

I have a fix for you.

In the file _DCCLASS.PRG, look for the following line of code (approx. line 5803) :

Code: Select all

        aDAttrs[GRA_AS_COLOR] := GraMakeRGBColor(IIF(lEnabled,{0,0,0},{180,180,180}))
Replace it with the following:

Code: Select all

        nColor := ::fgColor 
        IF Valtype(nColor) == 'A'
          nColor := GraMakeRGBColor(nColor)
        ENDIF
        aDAttrs[GRA_AS_COLOR] := nColor
        nColor := ::bgColor
        IF Valtype(nColor) == 'A'
          nColor := GraMakeRGBColor(nColor)
        ENDIF
        aDAttrs[GRA_AS_BACKCOLOR] := ::nColor
Rebuild dclipx.dll by running build20.bat

This fix will be in build 268.
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Color of DCTreeItem and DCSubMenu

#6 Post by Wolfgang Ciriack »

Hello Roger,
thanks for this solution, works perfect for DCSUBMENU.
Is this possible to change this for DCTreeitem, too (is also Black on Black) ?
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Color of DCTreeItem and DCSubMenu

#7 Post by rdonnay »

I still don't understand about DCTREEITEM.

Can you give me a sample program?
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Color of DCTreeItem and DCSubMenu

#8 Post by Wolfgang Ciriack »

Hello Roger,
its simple, try to make a Treeview with white text on black background.
_______________________
Best Regards
Wolfgang

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Color of DCTreeItem and DCSubMenu

#9 Post by Auge_Ohr »

hi Wolfgang,
Wolfgang Ciriack wrote: Sun Dec 05, 2021 12:52 am its simple, try to make a Treeview with white text on black background.
you can try this

Code: Select all

#define TV_FIRST          	0x1100
#define TVM_SETBKCOLOR          (TV_FIRST + 29)
#define TVM_SETTEXTCOLOR        (TV_FIRST + 30)

INLINE METHOD APISetBkColor(clrBk)
LOCAL hRet  := 0
   hRet := @USER32:SendMessageA(hTreeView,TVM_SETBKCOLOR, 0, clrBk )
RETURN hRet

INLINE METHOD APISetTextColor(clrText)
LOCAL hRet  := 0
   hRet := @USER32:SendMessageA(hTreeView,TVM_SETTEXTCOLOR, 0, clrText )
RETURN hRet
https://docs.microsoft.com/de-de/window ... setbkcolor
https://docs.microsoft.com/de-de/window ... ttextcolor

remember to switch OFF "visual Style"
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Color of DCTreeItem and DCSubMenu

#10 Post by rdonnay »

It appears that this is a bug in XbpTreeView.

The :setColorFG() method will not allow any foreground color other than black.
I am surprised that nobody has reported this before now.
The eXpress train is coming - and it has more cars.

Post Reply