Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004398 [JEDI VCL] 00 JVCL Components tweak always 2008-07-09 01:55 2009-05-03 10:50
Reporter ZENsan View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0004398: TJvCpationButton does not work correctly in Windows Vista
Description TJvCpationButton does not work correctly in Windows Vista.
Additional Information
Tags No tags attached.
Attached Files png file icon Untitled.png [^] (3,798 bytes) 2008-07-09 01:55
rar file icon Project1.rar [^] (747 bytes) 2008-07-15 23:35

- Relationships
has duplicate 0004323resolvedobones TJvCaptionButton positioning fails in Windows Vista 

-  Notes
(0014377)
obones (administrator)
2008-07-15 00:59

Please provide the zipped sources of a sample application showing this.
(0015423)
bartmichael (reporter)
2009-04-16 18:00

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).
(0015507)
bartmichael (reporter)
2009-05-01 19:10

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 :-)
(0015509)
AHUser (developer)
2009-05-03 10:43
edited on: 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.

(0015510)
AHUser (developer)
2009-05-03 10:50

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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker