Subject | [Geoff] Multimonitor systems and Enhanced Components |
---|---|
Author | Dany M |
Post date | 2006-07-04T10:43:01Z |
Hi!
When I run my app on the second monitor all dropdowns are shown on
monitor one. I made this change (lines 15-18);
procedure TCustomComboControlEnh.PositionControl;
var
Pt: TPoint;
//Rect: TRect;
begin
// Initially try the origin at immediately below the left-bottom point
// of the parent control...
Pt.X := Controller.Left;
Pt.Y := Controller.Top + Controller.Height;
Pt := Controller.Parent.ClientToScreen(Pt);
if (Pt.Y + Height) > Screen.Height then
begin // If too high to fit
Pt.Y := Pt.Y - (Controller.Height + Height); // display above parent
end;
// *** DANYCHANGE - next four lines commented out by me.
//if (Pt.X + Width) > Screen.Width then
//begin // If too wide to fit
// Pt.X := Pt.X - ((Pt.X + Width) - Screen.Width); // slide left
just enough
//end;
Left := Pt.X;
Top := Pt.Y;
end;
That is I commented out the X-axis test. To have this test back and
catering for two or more monitors one needs to find out the current
monitor of the parent (?). Or get some "all X axis" width. I don't how
to do either smartly. I could loop all monitors and find out witch one
to use for bound check using the current pixel location, but that seems
overworked.
The Y-axis test that I left in is actually not 100% ok either since you
can have monitor one with lesser pixels than monitor 2.
Well this is all mostly FYI. If someone who is into control manipulation
is willing to pitch in than I would be grateful.
Regards,
/Dany
When I run my app on the second monitor all dropdowns are shown on
monitor one. I made this change (lines 15-18);
procedure TCustomComboControlEnh.PositionControl;
var
Pt: TPoint;
//Rect: TRect;
begin
// Initially try the origin at immediately below the left-bottom point
// of the parent control...
Pt.X := Controller.Left;
Pt.Y := Controller.Top + Controller.Height;
Pt := Controller.Parent.ClientToScreen(Pt);
if (Pt.Y + Height) > Screen.Height then
begin // If too high to fit
Pt.Y := Pt.Y - (Controller.Height + Height); // display above parent
end;
// *** DANYCHANGE - next four lines commented out by me.
//if (Pt.X + Width) > Screen.Width then
//begin // If too wide to fit
// Pt.X := Pt.X - ((Pt.X + Width) - Screen.Width); // slide left
just enough
//end;
Left := Pt.X;
Top := Pt.Y;
end;
That is I commented out the X-axis test. To have this test back and
catering for two or more monitors one needs to find out the current
monitor of the parent (?). Or get some "all X axis" width. I don't how
to do either smartly. I could loop all monitors and find out witch one
to use for bound check using the current pixel location, but that seems
overworked.
The Y-axis test that I left in is actually not 100% ok either since you
can have monitor one with lesser pixels than monitor 2.
Well this is all mostly FYI. If someone who is into control manipulation
is willing to pitch in than I would be grateful.
Regards,
/Dany