LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

choose file popup front panel position?

Solved!
Go to solution
Highlighted

Hello,

 

I develop my softwares in a two monitor environment, mainly for data aquisition, and this makes some of my softwares and popups to appear outside of other users' monitors. 

I've managed to force all front panels to show up in the calling VI monitor, except for file dialog VI's. They don't have any property, reference and always show up in the same place they were moved to the last time. Is there any way to move them programmatically?

 

Thanks

0 Kudos
Message 1 of 7
(309 Views)
Highlighted

Its better to share VI Snippet so that forum users can better understand your problem and provide concrete solutions.

Palanivel Thiruvenkadam,
CLA|| CTD
0 Kudos
Message 2 of 7
(224 Views)
Highlighted

It's pretty clear to me.

 

Open a file dialog (from Open VI, Insert VI, browse path, File Dialog function).

Move it.

Open a file dialog (from Open VI, Insert VI, browse path, File Dialog function).

 

The 2nd dialog will have the last position you moved it to. It can't be changed programmatically.

0 Kudos
Message 3 of 7
(218 Views)
Highlighted

Thanks for the reply. And since this window doesn't have a name, I can't use, as far as I know, windows API to programatically move it. 

 

My other option would be creating a custom VI, but I guess it would be a lot of work.

0 Kudos
Message 4 of 7
(191 Views)
Highlighted
Solution
Accepted by topic author Giovanno

@Giovanno wrote:

Thanks for the reply. And since this window doesn't have a name, I can't use, as far as I know, windows API to programatically move it. 


It seems to me the dialog has a title. It's "Open" or "Select a file to open", or something like that.

 

If it's top level, you can use that information to get the hWindow. It will be a hack... You'll see the dialog popup and then move.

 

Not sure about the class of the file dialog. That could be used to find it as well.

 

I guess you could try to use a .NET OpenFileDialog. I think you'd need to create a form and the OpenFileDialog will appear in it's top left corner.

 

Another way would be to create a OFNHookProc callback function. how-to-change-position-of-an-openfilename-dialog-in-windows. You can try to make a dll in LabVIEW with the callback function, and then use LoadLibrary and GetProcAddress to get a pointer to it, then set it as a callback. This Common Item Dialog is a more recent document, but at a glans I can't see too much usefulness.

 

Sorry, no idea how any of this will turn out... 

Message 5 of 7
(177 Views)
Highlighted

I know this post is partially about the built in dialog.  But I did post a demo of some code that allowed for centering a panel on the current monitor, or maximize on various monitor options.

 

https://lavag.org/topic/21678-what-determines-which-monitor-a-dialog-shows-on/?do=findComment&commen...

0 Kudos
Message 6 of 7
(157 Views)
Highlighted

I had no idea you could get the window name even when it doesn't show in the task bar. I've managed to programatically move the window position by windows API utilities.

 

https://forums.ni.com/t5/Example-Code/Windows-API-Function-Utilities-32-bit-for-LabVIEW/ta-p/3996462...

 

Just wrote the window name "Choose or Enter Path of File" in a constant, set it to "move window.vi" and worked like a charm. Thanks for pointing me to the right direction.

Message 7 of 7
(138 Views)