Board index » delphi » ActionBands (XP Style) + XPManifest on Windows XP

ActionBands (XP Style) + XPManifest on Windows XP

Has anyone got this to work properly?  I've posted the full details for
this in the borland.public.delphi.vcl.components.using newsgroup because
it is more appropriate there.
 

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Kevin wrote:
> Has anyone got this to work properly?

        AFAICS, hey work fine so long as you don't put them on any component
with a gradient fill (TTabSheet, TCoolBar, for example).  I've reported
this to Steve.

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Craig Stuntz [TeamB] wrote:
>    AFAICS, hey work fine so long as you don't put them on any component
> with a gradient fill (TTabSheet, TCoolBar, for example).  I've reported
> this to Steve.

Thanks for the response Craig.  Although I'm not sure that I'm running
into your problem.  So far you're the only person to respond.  Nobody
has replied in borland.public.delphi.vcl.using yet...   So, I've decided
to post my full message here in the hopes that someone will at least
confirm this problem for me (note that the "Style"->"XP Style" issue is
most important to me).  If someone can confirm this then I will post it
to QC:

<quote>
I've run into a problem with TActionManager, TActionManagerMenuBar and
TToolActionBar that essentially makes them unusable for my application.
  I really like the functionality in these components but their apparent
incompatibility with Windows XP is a serious problem.

To see the problem I'm experiencing open up the ActionBands WordPad demo
project in Delphi 7 running under Windows XP.
["C:\program files\borland\delphi7\demos\actionbands\wordpad.dpr"]

Then drop the XPManifest component on the form and run the application.

A number of bad things happen:
* Clicking on "File" menu item causes menu to initially appear with a
black background (ouch!).  Moving the mouse to the right so that "Edit"
is selected and then returning to "File" menu causes menu to paint
correctly.
* Then select "Style"->"XP Style", now the previous problem goes away...
but... now we have a problem  with the toolbar buttons.  For example,
make sure that "Bold" is not pressed down (toggle it if necessary), then
move the mouse cursor over this toolbar button, the shadow looks really
bad (it appears as a large block beneath the button images instead of a
shadow of the button image itself).  This occurs with any of the toolbar
buttons.

It appears that the TActionManager, TActionManagerMenuBar and
TToolActionBar components cannot be used with the XP manifest.  Does
anyone know of a workaround or a VCL code change to temporarily fix this
before Borland releases a patch for Delphi 7?

Maybe I'm doing something wrong or I've got the wrong version of system
components or something...  however I doubt it because I have tried it
on two separate systems with different configurations (one XP Home
laptop, one XP Professional desktop system).
</quote>

Re:ActionBands (XP Style) + XPManifest on Windows XP


I have now submitted this to QualityCentral.  Please vote for this if
you consider it to be a problem that should be fixed.

QC Entry #4132

http://qc.borland.com/wc/wc.exe/details?ReportID=4132

Thanks,
Kevin

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Kevin wrote:
> To see the problem I'm experiencing open up the ActionBands WordPad
> demo project in Delphi 7 running under Windows XP.  ["C:\program
> files\borland\delphi7\demos\actionbands\wordpad.dpr"]

> Then drop the XPManifest component on the form and run the
> application.

> A number of bad things happen:
> * Clicking on "File" menu item causes menu to initially appear with a
> black background (ouch!).  

        I cannot reproduce this.  Note, however, that I'm not using "stock"
ActionBands but rather the bug-fixed version from Steve Trefethen's
http://www.geocities.com/delphihelp (Steve is the Borland engineer who
developed the ActionBands).  I don't know if this makes a difference,
but you might try getting the update, as it has a lot of good fixes.

Quote
> * Then select "Style"->"XP Style", now the previous
> problem goes away... but... now we have a problem  with the toolbar
> buttons.  For example, make sure that "Bold" is not pressed down
> (toggle it if necessary), then move the mouse cursor over this
> toolbar button, the shadow looks really bad (it appears as a large
> block beneath the button images instead of a shadow of the button
> image itself).  This occurs with any of the toolbar buttons.

        I see what you're saying, but I don't think it looks bad, myself.
Looks fine to me.

Quote
> It appears that the TActionManager, TActionManagerMenuBar and
> TToolActionBar components cannot be used with the XP manifest.  

        I disagree.  With the exception of placing them on components with a
gradient fill (if you want to see ugly painting try that) they work
correctly for me.

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Craig Stuntz [TeamB] wrote:
>>* Then select "Style"->"XP Style", now the previous
>>problem goes away... but... now we have a problem  with the toolbar
>>buttons.  For example, make sure that "Bold" is not pressed down
>>(toggle it if necessary), then move the mouse cursor over this
>>toolbar button, the shadow looks really bad (it appears as a large
>>block beneath the button images instead of a shadow of the button
>>image itself).  This occurs with any of the toolbar buttons.

>    I see what you're saying, but I don't think it looks bad, myself.
> Looks fine to me.

OK, I concede that this might just be personal preference.  However, I
would believe that most people would like it not to have "block
shadows".  In any case, this is different from the behaviour before
including the XP manifest.  And I do not believe that it is
intentionally like this - why would one huge block under the image be
more "professional" than a shadow that has the same shape as the image?

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Kevin wrote:
> OK, I concede that this might just be personal preference.  However,
> I would believe that most people would like it not to have "block
> shadows".  In any case, this is different from the behaviour before
> including the XP manifest.  And I do not believe that it is
> intentionally like this - why would one huge block under the image be
> more "professional" than a shadow that has the same shape as the
> image?

        It appears to me to be the ImageList which is doing this.  I'm not an
expert on the internals of the ActionManager, but that's what tracing
through the source is leading me to believe.

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer

Re:ActionBands (XP Style) + XPManifest on Windows XP


Interesting...  However, TCoolbar & TToolbar work with the ImageList.
Could there be some kind of workaround in these components to work with
the ImageList?

Thanks,
Kevin.

Quote
Craig Stuntz [TeamB] wrote:
>    It appears to me to be the ImageList which is doing this.  I'm not an
> expert on the internals of the ActionManager, but that's what tracing
> through the source is leading me to believe.

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Kevin wrote:
> Interesting...  However, TCoolbar & TToolbar work with the ImageList.
> Could there be some kind of workaround in these components to work
> with the ImageList?

        I don't know.  To reiterate, this is the impression I get after
spending a few minutes tracing through the code.  I'm not an expert on
the internals.

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Craig Stuntz [TeamB] wrote:
>    I cannot reproduce this.  Note, however, that I'm not using "stock"
> ActionBands but rather the bug-fixed version from Steve Trefethen's
> http://www.geocities.com/delphihelp (Steve is the Borland engineer who
> developed the ActionBands).  I don't know if this makes a difference,
> but you might try getting the update, as it has a lot of good fixes.

Thanks for the tip!

I've now downloaded this unofficial bug-fixed version and it does appear
to be better.  However, there are even issues with this version under
Windows XP with the XPManifest:

Steve's new version has these problems (using the WordPad.dpr demo app
with the XPManifest and "XP Style"):
* The "File" menu item when highlighted (mouse over) has the right
border edge chopped off.  This doesn't happen with the "Edit" menu in
the WordPad.dpr example, but in my own app I have a "View" menu next to
the "File" menu and it also has the right edge of the border chopped
off.  In fact, if you edit the "Edit" menu name and change it to "View"
in the WordPad.dpr example you see the same behaviour.  This only
happens with the "XP Style", not the "Standard" style.
* The shadows in the menu items have been fixed (i.e. they're not block
shadows any more).  However, the shadows of the Toolbar button images
are still block shadows.

Please Steve, can you fix these issues?  Time for another "unofficial
patch"?  It would be greatly appreciated!

Thanks,
Kevin.

Re:ActionBands (XP Style) + XPManifest on Windows XP


OK, I think I've found the cause of the problem I described below:

Quote
> * The "File" menu item when highlighted (mouse over) has the right
> border edge chopped off.  This doesn't happen with the "Edit" menu in
> the WordPad.dpr example, but in my own app I have a "View" menu next to
> the "File" menu and it also has the right edge of the border chopped
> off.  In fact, if you edit the "Edit" menu name and change it to "View"
> in the WordPad.dpr example you see the same behaviour.  This only
> happens with the "XP Style", not the "Standard" style.

In the VCL source, line 373, "XPActnCtrls.pas" there is the following code:

         Canvas.Brush.Color := Menu.ColorMap.BtnSelectedColor;
         Canvas.Pen.Color := ActionBar.ColorMap.FrameTopLeftOuter;
{        Canvas.Brush.Style := bsClear;     <- taken out by Steve }
         Canvas.Rectangle(0, 0, Width, Height);

If Menu.ColorMap.BtnSelectedColor = clBtnFace then this seems to cause a
problem.  Instead I used my own ColorMap and made BtnSelectedColor =
$00A0A1A0 (just an arbitrary colour that looks pretty close to
clBtnFace).  Does "Rectangle" not use system colours in the same way as
it uses raw RGB colours?  i.e. even if clBtnFace translated to $00A0A1A0
would it paint it differently?  Seems that way...

The way I figured this out was to compare the shipping D7
XPActnCtrls.pas to the new version that Steve produced.  The old version
didn't have this issue I described above, so I figured that this issue
must have been introduced.  As it turns out neither version of the code
works 100% the way it should because the original code displayed white
when it should show clBtnFace.  Although the second version uses the
correct colour the painting is screwed up due to this "Rectangle"
clBtnFace painting issue.

Maybe someone could shed some light on this.

Thanks,
Kevin.

Re:ActionBands (XP Style) + XPManifest on Windows XP


In addition....

on Line #252 in the XPActnCtrls:

         if Assigned(ImageList) and
ImageList.GetBitmap(ActionClient.ImageIndex, SelBmp) then
         begin
           Canvas.Brush.Color :=
GetShadowColor(Menu.ColorMap.SelectedColor);
           SelBmp.Width := ImageList.Width;
           SelBmp.Height := ImageList.Width;
           DrawState(Canvas.Handle, Canvas.Brush.Handle, nil,
SelBmp.Handle, 0,
             NewLocation.X + 3, NewLocation.Y + 2, 0, 0, DST_BITMAP or
DSS_MONO);

was replaced by:

         if Assigned(ImageList) then  { <-- line changed }
         begin
           Canvas.Brush.Color :=
GetShadowColor(Menu.ColorMap.SelectedColor);
           SelBmp.Width := ImageList.Width;
           SelBmp.Height := ImageList.Width;
           ImageList.Draw(SelBmp.Canvas, 0, 0, ActionClient.ImageIndex,
dsNormal, itMask); { <-- line inserted }
           DrawState(Canvas.Handle, Canvas.Brush.Handle, nil,
SelBmp.Handle, 0,
             NewLocation.X + 3, NewLocation.Y + 2, 0, 0, DST_BITMAP or
DSS_MONO);

This is the bit of code that Steve used to sort out the "block shadows"
in the menus, so it must be possible to have code like this in the
toolbar code too... I'll look into it and post more info to the
newsgroups as I find it.

This is what I really like about Delphi...  you get the VCL source code
so that you can patch this stuff yourself if you really need to! :-)
Thanks Borland...

Cheers,
Kevin.

Re:ActionBands (XP Style) + XPManifest on Windows XP


Correction: this should rather be $00E0E1E0, not $00A0A1A0
Quote
Kevin wrote:
> $00A0A1A0 (just an arbitrary colour that looks pretty close to
> clBtnFace).

Re:ActionBands (XP Style) + XPManifest on Windows XP


Final solution to the issue below...

(this must be done only after applying Steve Trefethen's unofficial
patch dated Dec 2nd 2002 from "http://homepages.borland.com/strefethen/")

in XPActnCtrls from line #345:
procedure TXPStyleMenuButton.DrawBackground(var PaintRect: TRect);

in var section add:
   DrawThemedBackground: boolean;

at start of proc:

begin
   // assume we're going to need to draw the background:
   DrawThemedBackground := True;

... a bit further down ...

         InflateRect(PaintRect, -1 , -1);
         // Since we've painted this background already, don't
         // call inherited draw background which will draw the
         // "themed background"
         DrawThemedBackground := False;

... and finally at the end of the proc ...

   if DrawThemedBackground then
   begin
     inherited DrawBackground(PaintRect);
   end;
end;

I'm not sure whether this will work under all circumstances.  I've only
tested it for the cases I'm interested in.

I've also fixed the "block shadow" issue with the toolbar images:

from line #578:

procedure TXPStyleButton.DrawGlyph(const Location: TPoint);

...

change the line that reads:
       if ActionList.Images.GetBitmap(ActionClient.ImageIndex, SelBmp) then
       begin

to:

       if Assigned(ActionList.Images) then
       begin

...

then insert the following line:
         ActionList.Images.Draw(SelBmp.Canvas, 0, 0,
ActionClient.ImageIndex, dsNormal, itMask);  { inserted line }

before this line:
         DrawState(Canvas.Handle, Canvas.Brush.Handle, nil,
SelBmp.Handle, 0,
           NewLocation.X + 1, NewLocation.Y + 1, 0, 0, DST_BITMAP or
DSS_MONO);

Again, this works for the cases I'm interested in and I haven't done
much testing at all - so use it at your own risk!

Hope someone else can benefit from this...

Cheers,
Kevin.

Quote
Kevin wrote:
>> * The "File" menu item when highlighted (mouse over) has the right
>> border edge chopped off.  This doesn't happen with the "Edit" menu in
>> the WordPad.dpr example, but in my own app I have a "View" menu next
>> to the "File" menu and it also has the right edge of the border
>> chopped off.  In fact, if you edit the "Edit" menu name and change it
>> to "View" in the WordPad.dpr example you see the same behaviour.  This
>> only happens with the "XP Style", not the "Standard" style.

Re:ActionBands (XP Style) + XPManifest on Windows XP


Quote
Kevin wrote:
> Hope someone else can benefit from this...

        You should update your QC report with the new information and submit
the code change as a Workaround to that report.  That way it will be
available to anyone who searches QC for ActionBands bugs.

        Thanks,

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer

Other Threads