View Issue Details

IDProjectCategoryView StatusLast Update
0004398JEDI VCL00 JVCL Componentspublic2009-05-03 10:50
ReporterZENsanAssigned ToAHUser 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.37 
Summary0004398: TJvCpationButton does not work correctly in Windows Vista
DescriptionTJvCpationButton does not work correctly in Windows Vista.
TagsNo tags attached.

Relationships

has duplicate 0004323 resolvedobones TJvCaptionButton positioning fails in Windows Vista 

Activities

2008-07-09 01:55

 

Untitled.png (3,798 bytes)
Untitled.png (3,798 bytes)

obones

2008-07-15 00:59

administrator   ~0014377

Please provide the zipped sources of a sample application showing this.

2008-07-15 23:35

 

Project1.rar (747 bytes)

bartmichael

2009-04-16 18:00

reporter   ~0015423

I have found, that in UpdateButtonRect before:

{ Click rect is a bit bigger }

we should decrease by about 50 pixels:

FButtonRect.Left := FButtonRect.Left - 50;
FButtonRect.Right := FButtonRect.Right - 50;

Then when run application and RESIZE main window, caption button WILL BE VISIBLE, but window's caption bar will not be semi-transparent (in Vista Aero theme).

bartmichael

2009-05-01 19:10

reporter   ~0015507

I have found a method to get it working on Vista with themes.

The button was not visible because in HandleNCPaintBefore:

if RectInRegion(FSaveRgn, LButtonRect) then
...

ALWAYS was false, before we do not resize the form.

So I added:
uses
  ... JclSysInfo;
  
  TJvCaptionButton = class(TJvComponent)
  private
    { Properties }
    FForceRedraw: Boolean; //NEW
    

constructor TJvCaptionButton.Create(AOwner: TComponent);
...
  if (GetWindowsVersion >= wvWinVista) and IsThemed then //NEW
    FForceRedraw := true;


procedure TJvCaptionButton.HandleNCPaintBefore(Wnd: THandle; var Msg: TWMNCPaint);
...
  if RectInRegion(FSaveRgn, LButtonRect) or FForceRedraw {NEW} then
  begin
    FForceRedraw := False;//NEW


Also button size was not calculated correctly. We have to change
procedure TJvCaptionButton.CalcDefaultButtonRect(Wnd: THandle);
...
{ 3. Calc FDefaultButtonWidth }
  {$IFDEF JVCLThemesEnabled}
  if IsThemed then
  begin
    if (GetWindowsVersion >= wvWinVista) then // NEW
      FDefaultButtonWidth := GetSystemMetrics(SM_CXSIZE) - 4
      //I'm not sure but I haven't found any better metrics
      //WM_GETTITLEBARINFOEX probably would be better
    else
      FDefaultButtonWidth := FDefaultButtonHeight;
  end
  
 Now the button IS WORKING. At the beginning (when we show the form) it flickers once, but the rest is OK. If anybody could fix it that would be nice :-)

AHUser

2009-05-03 10:43

developer   ~0015509

Last edited: 2009-05-03 10:43

WM_GETTITLEBARINFOEX does't work because the window is switch back to the "Basic" style but WM_GETTITLEBARINFOEX will return the "Glass" style coordinates.

AHUser

2009-05-03 10:50

developer   ~0015510

Fixed in SVN.

Issue History

Date Modified Username Field Change
2008-07-09 01:55 ZENsan New Issue
2008-07-09 01:55 ZENsan File Added: Untitled.png
2008-07-15 00:59 obones Note Added: 0014377
2008-07-15 00:59 obones Status new => feedback
2008-07-15 23:35 ZENsan File Added: Project1.rar
2008-07-21 00:24 obones Status feedback => acknowledged
2008-07-23 07:20 obones Relationship added has duplicate 0004323
2009-04-16 18:00 bartmichael Note Added: 0015423
2009-05-01 19:10 bartmichael Note Added: 0015507
2009-05-03 10:43 AHUser Note Added: 0015509
2009-05-03 10:43 AHUser Note Edited: 0015509
2009-05-03 10:50 AHUser Note Added: 0015510
2009-05-03 10:50 AHUser Status acknowledged => resolved
2009-05-03 10:50 AHUser Fixed in Version => Daily / SVN
2009-05-03 10:50 AHUser Resolution open => fixed
2009-05-03 10:50 AHUser Assigned To => AHUser