You are here: PSPad forum > Bug report / Hlášení chyb > Re: Using Multiple Displays

Re: Using Multiple Displays

Goto Page: Previous1 2 3

#21 Re: Using Multiple Displays

Posted by: pspad | Date: 02/06/2017 07:47 | IP: IP Logged

CieraBrier:
Freeman:
Jan, I wrote small sample, but cannot test it, because I have only one monitor:

TMainForm = class(TForm)
protected
procedure WMWindowPosChanged(var Msg: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED;
end;

procedure TMainForm.WMWindowPosChanged(var Msg: TWMWindowPosChanged);
begin
inherited;
if not (csLoading in ComponentState) then
with Msg.WindowPos^ do
MoveWindow(Application.Handle, x, y, cx, cy, True);
end;

This caused wrong Window border on Windows 10

Options: Reply | Quote | Up ^


#22 Re: Using Multiple Displays

Posted by: lucileburt | Date: 09/06/2017 17:02 | IP: IP Logged

sasumner:
I noticed a multiple displays issue recently regarding what appears on which screen; maybe it is a known issue. I am using pspad 4.5.9 (2512).

At my desk I have a two-external-monitor setup with a notebook PC in a docking station; I keep the notebook's lid closed so that its screen isn't used. I run pspad's main window on the secondary monitor (the one without the Win7 taskbar at the bottom). This is the normal situation and all is good.

When I undock my PC and use it with its single screen, pspad's main window will "move" there after undocking (this is correct). When I do a replace the find/replace dialog comes up fine and I enter my search and replace text, but if I check the Prompt on Replace checkbox (as I usually do), the prompt dialog that should show upon each find match is not visible. I can still press Y or N (or Esc) for each found match, so I think the prompt dialog is actually there, it is just still on the second screen (which isn't there at this point).

This happen to me one.
although i came back from a party

Options: Reply | Quote | Up ^


#23 Re: Using Multiple Displays

Posted by: AnthonyBeavor | Date: 12/14/2017 15:03 | IP: IP Logged

bkneepkens:
I experienced the same problem with a Delphi application. The solution proved to be as follows.
I don't know what Delphi version was used to build PSPad, but this is what I did in Delphi 7:

1. In FormCreate, hide the VCL-controlled taskbar button and assign an handler for the OnActivate event:


procedure TfrmMain.FormCreate(Sender: TObject);
var
windowLong: integer;

begin
Application.OnActivate := OnApplicationActivate;

// Hide the taskbar button for the zero-size Application window.
// We'll let Windows deal with taskbar buttons and not the VCL.
windowLong := ((GetWindowLong(Application.Handle, GWL_EXSTYLE) and (not WS_EX_APPWINDOW)) or WS_EX_TOOLWINDOW);
SetWindowLong(Application.Handle, GWL_EXSTYLE, windowLong);
end;

2. Implement the OnActivate event as follows:


procedure TfrmMain.OnApplicationActivate(Sender: TObject);
begin;
// Set the focus to the currently visible form. This may not always
// happen automatically because we're bypassing part of the VCL.
try
Screen.ActiveForm.SetFocus();
except
end;
end;

3. Override CreateParams to show a taskbar button:


procedure CreateParams(var Params: TCreateParams); override;

procedure TfrmMain.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);

// Show a taskbar button
params.ExStyle := (params.ExStyle or WS_EX_APPWINDOW);

// Set the desktop as the window's parent.
// Without this the taskbar button will still appear, but then it
// won't move to Windows 10's second taskbar if the window is moved
// to a secondary monitor. (This is probably also true for Windows 8,
// but I haven't been able to test that).
params.WndParent := GetDesktopWindow();
end;

4. Handle the WM_SYSCOMMAND message to support minimize/restore:


procedure WMSysCommand(var msg: TWmSysCommand); message WM_SYSCOMMAND;

procedure TfrmMain.WMSysCommand(var msg: TWmSysCommand);
begin
// Bypass the VCL and let the Windows API
// handle minimize/restore functionality.
case (msg.CmdType and $FFF0) of
SC_MINIMIZE: begin
ShowWindow(Self.Handle, SW_MINIMIZE);
msg.Result := 0;
end;
SC_RESTORE : begin
ShowWindow(Self.Handle, SW_RESTORE);
msg.Result := 0;
end;
else begin
inherited;
end;
end;
end;

Hmm, the forum removes indentation, even within code tags... oh well. Hope this helps smiling smiley

Although I am quite sure it wont solve the problem this is a brilliant idea, cheers

Options: Reply | Quote | Up ^


#24 Re: Using Multiple Displays

Posted by: AnthonyBeavor | Date: 12/14/2017 15:09 | IP: IP Logged

Sorry for my pessimism anyway. It may work finallyyawning smiley

--
phenq-fr.com

Options: Reply | Quote | Up ^


#25 Re: Using Multiple Displays

Posted by: pspad | Date: 12/14/2017 17:41 | IP: IP Logged

Thank you very much, I will test it. Just now I am fighting with themes - they consume all messages sad smiley

Edited 1 time(s). Last edit at 12/14/2017 17:41 by pspad.

Options: Reply | Quote | Up ^


#26 Re: Using Multiple Displays

Posted by: Gabriel_ACE | Date: 12/19/2017 17:47 | IP: IP Logged

I have 3 monitor

do you need help testing it?

Best Regars!

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3





Editor PSPad - freeware editor, © 2001 - 2018 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák