Hi Folks,
in TMS AdvMenu (Version 2.6.5.) the glyphs for submenu etc are always drawn in black. This is fine for a light menu background, but makes the glyphs nearly invisible on a dark background.
I tried to replace the glyphs at runtime and at design time, but neither of them worked.
How can I swap the glyphs at run time? I want my application to be able to switch between dark/light designs and to use the menu font color also for the glyphs.
Cheers
L?bbe
Do you use .BMP glyphs with the transparency color set as bottom-left pixel in the BMP?
Thanks for the hint. I thought so. I tried Images
- generated from SVG at run time and loaded from an imagelist via Imagelist.GetBitmap()
- the original glyphs re-colored using paint.net and loaded at design time
I'll check for the transparency.
- Step 1
Delete *all* three glyphs from the AdvMenuStyler assigned to the menu at design time.
After this, at run time, the checkmark glyph properly uses the font color of the menu, but the submenu triangle stays black.
- Step 2
find the place in where the submenu is drawn in AdvMenus.pas. (procedure DrawSubmenuTriangle;)
- Step 3
Replace the line:
ACanvas.Font.Color := TriangleColor; with
Canvas.Font.Color := clBtnText; as it is done in procedure DrawCheckMark just above. The Todo comment in DrawCheckmark indicates that the person who wrote this code didn't know why this was necessary.
- Step 4
Delete the definition of TriangleColor = clBlack in AdvMenus.pas
Thanks for this extra information.
This is helpful to understand and address the issue.
We have now improved the code to detect the use of VCL styles and when this is the case, the triangle is drawn in color clBtnText; This improvement will be included in the next update.
LStyle := StyleServices;
if LStyle.Enabled and (LStyle.Name <> 'Windows') then
ACanvas.Font.Color := TriangleColor
else
ACanvas.Font.Color := clBtnText;
{$ELSE}
ACanvas.Font.Color := TriangleColor;
{$ENDIF}
LStyle := StyleServices;
if LStyle.Enabled and (LStyle.Name = 'Windows') then
ACanvas.Font.Color := TriangleColor
else
ACanvas.Font.Color := clBtnText;
{$ELSE}
ACanvas.Font.Color := TriangleColor;
{$ENDIF}
You're correct about this oversight.
We'll have this fixed for the next scheduled update.
ACanvas.Font.Color := clBtnText;
{$ELSE}
ACanvas.Font.Color := TriangleColor;
{$ENDIF}
We'll check if there aren't any corner cases requiring this and when not, simplify.
LStyle: TCustomStyleServices;
{$ENDIF}
We can confirm this was already cleaned up internally.