Jump to content

Custom Titlebar: Inconsistent FP Maximize behavior with multiple monitors of different resolutions

Recommended Posts

Hello Lavag's,

Currently developing an UI with custom titlebar like JKI Package Manager 2020, applications from MS Office etc. I have a laptop (1440 X 900) running windows 7 and a second monitor with resolution 1920 X 1080. Scale and layout options for both monitors are set to 100%. 

"FP.State = Maximized" seems to work only when the resolutions for all monitors are equal or selecting the monitor with highest resolution as main screen.

1. Laptop(1440 X 900) as main screen: FP.State = Maximized works fine in Laptop but not in second monitor. The Panel Bounds and Window Bounds are way out of the screen resolution.

       image.png.b343fd04ef226cda3790e1acbcb4f3fa.png     image.png.57b75dace2dc4d47d361dd5b9bd3767e.png

Same as in case of JKI VI Package Manager (2020)


2. Setting Window bounds and panel bounds manually:

Some pixels appear in the another monitor when setting the Window Bounds and Panel Bounds manually. This sems to be also the case with NI-Package Manager

Is there a way to make it work?  Any help is greatly appreciated.





Custom Titlebar.vi

Link to comment

When a window (any window, including LabVIEW) is maximized on monitor1 (1920x1080), the window rectangle is (-8,-8,1928,1048) on my laptop (Win7 Pro).  That extra 8 pixels on each side is the frame edge.  I noticed this when I started to use Win7.


Link to comment

If memory serves right, this is because LabVIEW does not take Windows themes into account. Essentially, the window drawn by LabVIEW gets surrounded by a border that is provided by Windows. You should see different results if you change your theme to one that has smaller or no borders.

Also, Window Bounds does not include the window border. It is implicitly mentioned in the context help: "The four elements in the cluster are the top, left, bottom, and right values of the front panel window, which includes the interior region, scroll bars, title bar, menu bar, and toolbar."

Your best bet is to use Window Bounds and subtract the border size manually. Unfortunately, it will break again if the user changes themes.


Link to comment

I'm seeing the same issue as @nikp, where the window bounds for a maximized window on the second display are way off. It looks to be related to whether the title bar is visible or not.

There are two displays in a side-by-side configuration, the primary is 1920x1080 and the secondary is 2560x1440. Running under Windows 10 with display scaling off.


I tried the examples posted in the thread @LogMAN linked to with very different results. @hooovahh's version worked for both displays, while @Aristos Queue's version only had correct results on the primary display. After trying to work out why they were so different, I noticed the title bar visibility was different between the two examples. The snippet below demonstrates the different results.


When the front panel is on the primary display, the bounds only differ by one pixel when title bar visibility is toggled. When the front panel is on the secondary display, difference between the Right and Bottom values is huge.

title-bounds-primary.PNG.476ca5cb6192e69f6456bf8f7c920193.PNG      title-bounds-secondary.PNG.20b9f975ef0463387953b6742d755fee.PNG

Calling GetWindowRect() and GetClientRect() from user32.dll on the front panel window has the same results when toggling the title bar visible, so it looks to be a Windows level issue rather than LabVIEW.

In any case toggling the title bar visible works well enough. Not sure if it will help your application @nikp.


Link to comment

Hmm, it seems the difference in resolution of primary vs secondary displays is being added to the maximized window on the secondary. In this case it's a difference of 640x320 ( or 2560-1920 x 1440-1080). If those numbers are then subtracted from the window bounds when the title bar isn't visible, they're within 1px. Looks to work for your resolutions and results too @nikp. Might be a better solution than toggling the title bar.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By hichem55
      I will take the CLD exam in two days and I would be grateful if anyone could help me in these two questions:
      1/ Do I have the ability to change a Cluster from the given UI into a Typedef?
      2/ In addition to Tip strips, Is it recommended to add some comments on the front panel or not?

      Thank you very much!
    • By jj321
      programmatic control of front panel requires signaling instead of just simple value change . This requires access to controls . The attached VI's should do the job. The controls can be anywhere including tabs etc which requires recursive access.
      Get FP References.vi
      Get Set FP Value Signaling Anywhere.vi
    • By ASalcedo
      Hello to all.
      Thanks for helping me.
      I have developed an application in a laptop of 15.6 inches.
      Now I am creating a .EXE to deploy in a PLC of 15 inches.
      All my front panel is a tab control which has controls and indicators inside.
      The problem is that when I deploy de application I can not see a part of tab control (15 inches vs 15.6 inches).
      How can I fit tab control to 15 inches easyly?
      Thanks a lot.
    • By jj321
      clone vi front panel access requires slight trick to handle clone vi's (re entrant) shown in the attached file
      Get FP data.vi
    • By spaghetti_developer
      Hi to all,
      I'm able to see a SubVI front panel in a Main front panel using a SubVI object and inserting it into the object.
      I have been wondering if I can do the same launching an executable file and looking its user interface inside a main executable, both built using the LabView application builder. Have you ever done a work like this? Have you an idea to advise me, that can help me?
      Thank you all
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.