LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with auto-center not working on the first instance

In one of my apps I have a small panel and on the edit panel sheet I selected auto-center vertically and horizontally. I load and display the panel and it shows up in the top right. My app continues on and discards the panel, then loads another instance of the same panel and displays it. This time the panel will show up centered properly.
 
This is stumping me, any ideas?
 
RadioAct 
0 Kudos
Message 1 of 7
(4,731 Views)
Hi!
   Are you setting this panel property BEFORE launching it or AFTER? You should put SetPanelAttribute before DisplayPanel.

   Is this helpful? Please let me know...

graziano
0 Kudos
Message 2 of 7
(4,722 Views)
I set panel property in the panel editor, I will try to load the panel, set the property in code before I call the DisplayPanel.

I will let you know how that goes.

RadioAct
0 Kudos
Message 3 of 7
(4,706 Views)
Alright, I compiled the same code on another computer and the problem goes away. The panel centered itself just fine. The first computer I tried it on has dual displays so I'm thinking that this might have something to do with it.

RadioAct
0 Kudos
Message 4 of 7
(4,704 Views)
Hi RadioAct,
   thanks for reporting this problem!

   I've never used dual display features.... let me know if you fix the problem on that system!

   Have a nice day!

graziano
0 Kudos
Message 5 of 7
(4,688 Views)
I tested the same program on another pc with dual monitors and got different results. The panel centered on theproperly on the main display. It seems that depending on which monitor I have CVI open on when I edit the panel and compile the program determines which monitor the panel will open on. If the panel opens on a monitor that is not the main display (doesn't have the start bar) then the autocenter doesn't work.

Does anyone know how to determine if the system has multiple monitors and how to get the screen size of each monitor?

RadioAct
0 Kudos
Message 6 of 7
(4,677 Views)
Hello RadioAct,

When I tested the behavior on my machine, the panel always displayed centered on my primary monitor. Regarding your followup questions, in order to get the number of monitors in your setup, call

GetSystemAttribute (ATTR_NUM_MONITORS, &value);  


There are also various other monitor related attributes you can access with the GetSystemAttribute functions.  So I would encourage opening up the function panel for this function and taking a look at those.  Also, there are various other Monitor functions under User Interface Library >> Monitors.  From the CVI functions, you can get the color depth of a particular monitor, but to get the screen size of a monitor, you will have to use a Windows SDK function call.  One I ran across was the GetSystemMetrics function.

Hope that helps.


Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 7 of 7
(4,669 Views)