View Issue Details

IDProjectCategoryView StatusLast Update
0004463JEDI VCL00 JVCL Componentspublic2008-10-26 06:15
ReporterasertacAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.35 
Target VersionFixed in Version3.36 
Summary0004463: JvDateEdit's calendar dialog pops in weird places with a form not on the primary monitor.
DescriptionThe function "SelectDate" in "JvPickDate.pas" does not have code to handle multi monitor setups. This causes the JvSelectDateDlg to pop in weird places instead of around JvDateEdit control, if the form containing the control is not on the primary monitor.
Additional InformationHere is a suggested fix;

function SelectDate(Sender: TWinControl; var Date: TDateTime; const DlgCaption: TCaption;
  AStartOfWeek: TDayOfWeekName; AWeekends: TDaysOfWeek;
  AWeekendColor: TColor; BtnHints: TStrings;
  MinDate: TDateTime; MaxDate: TDateTime): Boolean;
var
  D: TJvSelectDateDlg;
  I: Integer;
  P: TPoint; // Polaris
//--> new variables
  MonHandle: HMonitor;
  MonInfo: TMonitorInfo;
  ScrLeft, ScrRight, ScrBottom: Integer;
//--
begin
  Result := False;
  D := CreateDateDialog(DlgCaption, MinDate, MaxDate);
  try
    // Polaris for Popup position
    if Assigned(Sender) then
      with D do
      begin
        Position := poDesigned;
        P := (Sender.ClientOrigin);
//--> new code
        DefaultMonitor := dmDesktop;

        ScrLeft := 0;
        ScrRight := Screen.Width;
        ScrBottom := Screen.Height;
        MonHandle := MonitorFromPoint(P, MONITOR_DEFAULTTONEAREST);
        MonInfo.cbSize := SizeOf(TMonitorInfo);
        if GetMonitorInfo(MonHandle, @MonInfo) then begin
          ScrLeft := MonInfo.rcWork.Left;
          ScrRight := MonInfo.rcWork.Right;
          ScrBottom := MonInfo.rcWork.Bottom;
        end;
//--
        Top := P.Y + Sender.Height - 1;
//--> modified code
// if (Top + Height) > Screen.Height then
// Top := P.Y - Height + 1;
// if Top < 0 then
// Top := P.Y + Sender.Height - 1;
        if (Top + Height) > ScrBottom then
          Top := P.Y - Height + 1;
//--
        Left := (P.X + Sender.Width) - Width;
//--> modified code
// if (Left + Width) > Screen.Width then
// Left := Screen.Width - Width;
// if Left < 0 then
// Left := Max(P.X, 0);
        if (Left + Width) > ScrRight then
          Left := ScrRight - Width;
        if Left < ScrLeft then
          Left := Max(P.X, ScrLeft);
//--
      end;
.
.
.
TagsNo tags attached.

Activities

asertac

2008-09-17 09:28

reporter   ~0014609

forgot to add,

uses
.., multimon;

obones

2008-09-29 06:45

administrator   ~0014724

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

2008-10-05 06:25

 

4462-3.zip (43,195 bytes)

asertac

2008-10-05 06:25

reporter   ~0014746

Done.

AHUser

2008-10-26 06:14

developer   ~0014914

Fixed in SVN.

Issue History

Date Modified Username Field Change
2008-09-17 09:17 asertac New Issue
2008-09-17 09:28 asertac Note Added: 0014609
2008-09-29 06:45 obones Note Added: 0014724
2008-09-29 06:45 obones Status new => feedback
2008-10-05 06:25 asertac File Added: 4462-3.zip
2008-10-05 06:25 asertac Note Added: 0014746
2008-10-26 06:14 AHUser Status feedback => resolved
2008-10-26 06:14 AHUser Fixed in Version => Daily / SVN
2008-10-26 06:14 AHUser Resolution open => fixed
2008-10-26 06:14 AHUser Assigned To => AHUser
2008-10-26 06:14 AHUser Note Added: 0014914