LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

FileSelectPopup focus issues

I'm having some trouble with the FileSelectPopup. If I position the dialog so that it is eclipsing my main application (but is smaller in dimension), and then shift focus to the main application (effectively hiding the file dialog) the application is put into an unrecoverable state. While this dialog is open the main application can not be interacted with (moving, resizing, etc), and the file dialog does not have its own taskbar icon. 

 

Is there any way to allow the main application to remain responsive while the File Selector is shown? Or is there a way to enforce the File Selector to stay on the top until it has been closed?

 

Thanks.

 

(I am using CVI 2015)

0 Kudos
Message 1 of 4
(2,739 Views)

FileSelectPopup, like any other *Popup function, actually is a modal window that should remain on top of the user interface and do not permit to switch back to it. The only scenario I can imagine to switch back from the popup to the rest of the application is when the popup is called from within a thread other than the main thread. If this is your case, I discourage you from doing this: you should keep user interface handling in a single thread. If you need to handle some user interaction in the secondary thread you could call PostDeferredCallToThread or PostDeferredCallToThreadAndWait to have UI functions executed in the main thread, thus avoiding possible problems.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(2,685 Views)

Perhaps I wasn't clear, the main window is not intended to be used. It cannot be interacted with in any way other than through giving it focus through the OS. This is the issue. Once the main window has focus, it cannot be interacted with, and therefore can not be moved in order to reveal the file selector again.

Is there a method for rejecting focus and diverting it back to the File Selector? How do I go about "not permitting" the application to switch back to the main window?

0 Kudos
Message 3 of 4
(2,667 Views)

Yes, that was quite clear. But the problem is: FileSelectPopup should not give you access to the main program screen if launched from the main thread.

You can try with one of CVI examples, e.g. ICOView.prj: when you press "Load icon" button, FileSelectPopup window opens (well, actually it's FileSelectPopupEx but it's the same in this respect); if you try clicking on the program main screen with the popup open, you are blocked and that's the standard behaviour of popups.

How are you calling the function? With a button on the UI, inside a callback, while on a indipendent thread? How?

 

Can you post a small example that exhibits this behaviour? Not necessarily your actual project but a working example that shows the misbehaviour so that we can take a look at it?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 4
(2,657 Views)