Recent

Author Topic: Still An Issue - Windows 10 - Taskbar icon not showing on secondary monitor  (Read 2846 times)

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
I was going to reply to the following thread, but the system strongly suggested, in red, I kick off a new topic.

Reference:
http://forum.lazarus.freepascal.org/index.php?topic=30703.0

This is still an issue.

Without using a screen dump, here is the necessary information:
* Lazarus IDE is on the left (primary) monitor.
* The application uses xml to save the last window position, and appears on the right (secondary) monitor.
* Disabling -wg (as per original thread) did not help, but instead produced a blank window in addition to the application. This occurred within and outside the Lazarus IDE. I am assuming this is the console window discussed in the old thread.
* The Application's icon always appears on the primary monitor taskbar, both inside the IDE (Run) and standalone.
* Windows 10.
* Lazarus 1.6.4 r54278 FPC 3.0.2 x86_64-win64-win32/win64

Is there a fix, or how do I set up a change request?

Thanks,

B
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
I have discovered a quick fix that works.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormActivate(Sender: TObject);
  2. begin
  3.   Application.Minimize;
  4.   Application.Restore;
  5. end;
  6.  

The above causes the TaskBar icon to move to the second monitor.

Background:
The application uses an XML file to store last position and size of the main form. The XML file is read and the settings adjusted during FormCreate. However until the above code was introduced, the application would only show on the main monitor.

It was discovered when I manually minimized the application and saw the icon automatically transferred do the secondary screen.

Bazza.
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

dot.not

  • New Member
  • *
  • Posts: 22
  • The answer is 42

This is interesting

So if we could find out what WidgetSet.AppMinimize does there would be no reason to flicker the mainform

There's 10 kinds of people

jamie

  • Hero Member
  • *****
  • Posts: 3665
Try using the OnActivate in the TApplication instead...

 The App it self has a main window that isn't the MainForm.

 If maybe earlier events in the TApplication.
The only true wisdom is knowing you know nothing

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
I cannot find anything that has sample code re Application.OnActivate.

Everything points to the Form event, which I am using with success.

Have you got a link?  :-[

B
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

taazz

  • Hero Member
  • *****
  • Posts: 5365
I cannot find anything that has sample code re Application.OnActivate.

Everything points to the Form event, which I am using with success.

Have you got a link?  :-[

B
there is a component in your component palette called TApplicationProperties drop it in a form and write code to what ever events it has.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

jamie

  • Hero Member
  • *****
  • Posts: 3665
I just did a quick look, I didn't see anything off hand.

The TApplication.OnActivate is the same as what you find in Delphi TapplicationEvent.OnAactive;

  You can place a TNotiyEvent procedure in your form class somewhere which will be
valid by the time TApplication.Run is performed.

 Application.OnActivate := MyMainform.MyEearlyActivateHandler or TNotifyEvent;

 In that handler, you place your code in there that does the settings for application.
This comes before the main form activates.

Procedure MyearlyActivateHandler(Sender:Tobject)
 Begin
   Do your code you need like reading your config file and set up your desktop
 end;

 Application.OnActivate := MyMainForm.MyEarlyActivateHandler;
 
Or you can do your configuration in the Main unit before the Application.Run is hit.
its your choice

The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 3665
Guess I missed the boat, I forgot about the TApplicationProperties

Sorry, Yes that would most likely due  :)
The only true wisdom is knowing you know nothing

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
It does seem a lot of work for so little reward. There seems to be no flicker when the application is run. The icon just transfers over to the secondary monitor taskbar as the main form opens. I am currently testing the 2 commands in OnShow, and it seems to work just as good. The event description for OnShow seems it is the logical place for this code. If only Spock were alive.  ::)

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormShow(Sender: TObject);
  2. begin
  3.   Application.Minimize;  // Transfer taskbar icon to secondary monitor, if applicable.
  4.   Application.Restore;
  5. end;
  6.  

Anyway the icon is in the correct taskbar, and the main form is happily loading into the secondary monitor.

B
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.

This is interesting

So if we could find out what WidgetSet.AppMinimize does there would be no reason to flicker the mainform

dot.not,

I finally started looking up WidgetSet.AppMinimize, but once again, there is no flicker. In theory, there should be a brief appearance of the form before minimize is called, but it seems not so. But on a slow machine, there may be an issue.

I could put a delay in between the commands to see the affect of a slower machine, but as is seems to work fine.

B


Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Thonolan

  • Newbie
  • Posts: 3
Re: Still An Issue - Windows 10 - Taskbar icon not showing on secondary monitor
« Reply #10 on: September 04, 2020, 08:09:25 pm »
I found a better fix for the issue.

In the Application section of the program add the following lines before the Application.CreateForm() call

Code: Pascal  [Select][+][-]
  1.   {$IFDEF WINDOWS}
  2.   Application.MainFormOnTaskBar:=true;
  3.   {$ENDIF}
  4.  

The {$IFDEF WINDOWS} is needed because it is a Windows specific variable. In case you are compiling for multiple operating systems.

--
Lazarus 2.0.6 FPC 3.0.4 x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
Re: Still An Issue - Windows 10 - Taskbar icon not showing on secondary monitor
« Reply #11 on: September 12, 2020, 07:12:28 am »
Thanks Thonlon,

I'm putting together some new stuff for the application that had the issue, and will try your suggestion out.

Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
Re: Still An Issue - Windows 10 - Taskbar icon not showing on secondary monitor
« Reply #12 on: September 26, 2020, 08:24:37 am »
Test appears successful. Thanks Thonolan.

Note to future readers, the taskbar icon will only show in the second screen monitor if Form1.Left > Screen.Monitors[0].Width.



Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

 

TinyPortal © 2005-2018