LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you set the position of a Pop-Up Window in CVI?

How do you set the position of a specific pop-up window in CVI?  Prior discussion topics somewhat related suggest calling SetPanelPos() prior to installing the pop-up.  But such functions as SetPanelPos() and SetPanelAttribute() require a panel handle.   How do you relate a handle to a pop-up?    I appreciate your comments.
0 Kudos
Message 1 of 5
(4,785 Views)

Hello Steve,

I could not quite understand your question. In CVI you already need to specify a panel handle to install a panel popup (using the function InstallPopup). There is no other way. If the popups you are talking about are the ones displayed by MessagePopup, ConfirmPopup, etc then I do not know a "direct" solution for this.

However, when I need such functionality, I design my own popup panels and use them instead of CVI popups. I write a function that loads that panel as a child in the currently displayed panel and displays my text (which I enter the function as a parameter) and shows appropriate buttons ("OK", "Cancel", "Abort", etc) according to the message. You can position this child panel whereever you like within the parent panel.

This way you can have a very flexible message popup. One more advantage: you can design it to match your other panels' color, font, etc. I can post a sample code if you need.

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 5
(4,769 Views)

Hello Steve,

you can use the SDK functions to achieve your goal. I found a solution but I must confess that it is not a very nice one Smiley Happy I attached the project to this message. What I do is the following:

Before calling the MessagePopup function, I start a second thread. This thread searches for the MessagePopup window, and gets a window handle for this window. Therefore I use the FindWindow SDK function, which is described here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/wi...

When a handle is obtained, the position of this window can be adjusted using the SetWindowPos function, described here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/wi...

IMPORTANT: don't forget to include <windows.h> in your file!

This needs to be done in a second thread, because the MessagePopup function quits after the user hits the OK button, so in the meantime no User Interface adjustments can be made. The main disadvantage of this approach is that you can see the Message Popup window appear in the center of the screen, and then after a very short (but still visible) time it moves to the new position.

0 Kudos
Message 3 of 5
(4,762 Views)
Eren,

My focus was the positioning of the standard pop-ups of the CVI library (message pop-up, confirmation pop-up, file/directory pop-up, graph pop-up, etc.).   Unfortunately, there does not seem to be a way to control the position of  these convenient objects.   Seems like there would be some attributes in SetSystemPopupsAttribute() to cover this.  Instead, the method you suggest is to create your own modal panel pop-ups using LoadPanel() or NewPanel() with InstallPopup().  While most modal pop-up windows would be simple to construct, the more difficult would be the file/directory pop-up.

Steve
0 Kudos
Message 4 of 5
(4,739 Views)

Steve,

SetSystemPopupsAttribute() does not seem to have such attributes.
My suggestion is for simple popups.
For complex ones like file/directory selection I think you may still consider using the method suggested by Wim.

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 5
(4,733 Views)