When I create a new VCL application with the New Item option to use the TMS FNC Ribbon Form for VCL and run the application it will cover the Windows task bar when the form is maximized (by clicking the maximize button when the application is running).
A standard TForm application does not have this problem. Using Delphi 11.1 with patch 1.
Can this be fixed? Thanks in advance.
Greeting,
Fons
Hi,
You can use the following code to workaround this. We'll investigate if we can add this internally
procedure TTMSFNCRibbonForm31.FormResize(Sender: TObject);
var
r: TRect;
begin
if WindowState = TWindowState.wsMaximized then
begin
SystemParametersInfo(SPI_GETWORKAREA, 0, @r,0) ;
SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top) ;
end;
end;
Thanks. I am not sure, but does this code also works correctly in a 2 monitor setup in which the monitors have different screen resolution dimensions? I am unable to test that scenario myself.
No this is for the primary monitor, for multi-monitor support, please use
uses
WinApi.MultiMon;
procedure TTMSFNCRibbonForm32.FormResize(Sender: TObject);
var
r: TRect;
MonInfo: TMonitorInfo;
begin
if WindowState = TWindowState.wsMaximized then
begin
MonInfo.cbSize := SizeOf(MonInfo);
if GetMonitorInfo(MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST), @MonInfo) then
begin
r := MonInfo.rcWork;
SetBounds(r.Left, r.Top, r.Right - r.Left, r.Bottom - r.Top);
end;
end;
end;
Thanks for this fix. Did anything end up getting built into the main product or is this still the best workaround?
Currenlty this is still the best workaround. We plan on working on the ribbon in the future and will take this into consideration