LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Child window refresh issue with LabVIEW 8.0

Hello All; long time reader, first time user here...
 
I'm using LabVIEW 8.0 and trying to create a child window within an application.  The VI I created has no problem creating the child window itself, but it does not refresh properly.  The window looks like the screen inside the window has been offset from the window itself.  I have attached my sub-VI and a bmp image of the window itself.  I'm probably trying to do something silly, but cannot figure this out.  Any help would be appreciated.
 
Thanks in advance,
DJH
0 Kudos
Message 1 of 26
(4,464 Views)
How is this code supposed to be used?

It seems that you're trying to open a child window dynamically. If so, is there any particular reason why you're simply not using the VI Server to open your child window instead of going through Windows calls?
0 Kudos
Message 2 of 26
(4,430 Views)

Hello;

At present, I am trying to experiment with parent / child window relationships.  In my application I have several separate VIs, any of which may be open at any given time.  The VI I am experimenting with, for example, is an 'About' screen which pops up with information about the program itself (i.e. when, what, who, etc.), similar to the 'About' screen in any Help menu.  The parameters to which I have been assigned call for a parent window, or main GUI, with several sub-windows contained therein.  I have used the Sub-Panel functions in LabVIEW 8.0 to dedicate regular VIs within the parent, however, there are some seldom-used VIs which will need to be used periodically as well; hence the dynamically calling the VIs.  Most of this application was written with LabVIEW 6.1 (if that helps), and imported a week or so ago into LabVIEW 8.0.

Since the end application will require that several VIs be open at a single time, it seemed the best way to call each of them dynamically (when needed) and communicate between them via queues, which in and of itself seems to work quite well.  I am not sure what advantages using VI server will give me, but I'll be sure to look into this also.

In the meantime, I have attached a second ZIP file, in which a working demo is contained.  This demo also exhibits the 'refresh' issue (for lack of a better term).  Is there something that can be done with this method, or do I need to rethink my approach?

DJH

0 Kudos
Message 3 of 26
(4,420 Views)
I tried to edit my previous reply, but I don't know how...
 
I looked at the VI Server examples provided with LabVIEW 8.0, and it looks like I'm using them correctly (far as I can tell)... was not familiar with the term VI Server.  Anyhoo, further assistance would be appreciated.  Thanks.
 
DJH
0 Kudos
Message 4 of 26
(4,415 Views)
I ran your code and I never saw the child window pop up. I saw a flash and then it looked like it had closed itself, but was still running. I had to quit LabVIEW (which caused it to crash). I then modified the "Child Window" VI to disable the code where you calling that code that uses the Windows functions and reran Main.vi. This time the child window popped up just fine and looked just fine:



Just out of curiosity, do you by any chance have any software installed like WindowBlinds that allows you to have custom themes? This software messes up the windows in LabVIEW.

As for the advantages of using the VI Server: well, you wouldn't have to mess with Windows functions, which you don't for what you're trying to do. Plus, it doesn't make LabVIEW crash like it did when I tried to run your code.

For editing your messages: After you post your message you can pull down the "Options" menu that appears along the title bar of the message. When you do that you should see an "Edit Message" menu option. However, this is only available for few after you post, so if it's been some time this menu option will no longer be available.


Message Edited by smercurio_fc on 03-03-2006 09:45 AM

Download All
0 Kudos
Message 5 of 26
(4,404 Views)
Does the window still have the parent/child relationship active after your modifications (i.e. minimising the main window also minimises the child window, etc.)?  When I disable the part of the code that uses the user32.dll from Windows, it will load up, but it loses the parent/child attribute.  Can you post your modifications for me to try out?  I am very interested in seeing what the differences are.  Thanks!
 
DJH
0 Kudos
Message 6 of 26
(4,386 Views)
All that I had done was to disable the code that was in the "Create Window Dependencies" case. Consequently, there was no parent-child relationship. I found that when the "SetParent" call was executed the "Child Window" VI simply disappeared, but it was still running in the background. I didn't realize that the window was being placed *inside* the frame of the "Main" window. However, the position of the window was being shifted when this happened and the parent window wasn't being told to refresh. Due to where the "Child Window" was initially this had the effect of the "Child Window" appearing to disapper. When I moved the "Child Window" so that it would appear within the viewable frame I found that the shifting of the window caused it to look all messed up. It appears the "Main" window wasn't being told to refresh/repaint itself. If I minimized the "Main" VI then reopened it the "Child Window" would look just fine. This appears to be a Windows thing, and not a LabVIEW thing, so any solution will likely be aroung Windows library functions. Unfortunately I don't know what that would be.

I did simplify the "Child Window" VI which you can take a look at if you want. I configured the "Window Appearance" properties to be a Dialog Box. I found that the automatic closing of the front panel would be broken by the "SetParent" function and had to add a bit of code for the child window to close itself.
0 Kudos
Message 7 of 26
(4,380 Views)

Thanks; I looked at the VI and it operates a bit smoother (except now I periodically get the following error: "Error 1000 occurred at Invoke Node in Open About VI Reference.vi->Main.vi"), but the refresh issue is still a problem.  Once again, if I minimise the window and restore it, it seems to clear up.

Since the USER32.DLL I am using is a Windows function and not written for LabVIEW, is there something available from LabVIEW that will allow me to do the same thing?  Right now, I am using the SubPanel feature of LabVIEW 8.0 to display my sub-VIs, but there is only so much room on the screen.  It would be really nice to get this feature working properly.

Any ideas?

Thanks.

DJH

0 Kudos
Message 8 of 26
(4,372 Views)
I wasn't getting that error with the About box. You would get that if you tried to reopen a window that was already open. In this case you have to check if the window is already open. If so, don't bother trying to open it with the VI server or you'll get the 1000 error.

As for the child window business, try the following dirty trick. I modified the "Create Child Window" VI to make a call to the "SetWindowPos" API function. I basically perform two steps: (1) set the window to be bottom-most in the z-order with a size of 0 for width and height, and (2) set the window to be top-most with a specified width and height. I hard-coded values for the width and height - I'm sure you can update the code to pass these in or perhaps use the "GetWindowRect" API function to get the size of the window before you termporarily shrink it. It seems to work.
0 Kudos
Message 9 of 26
(4,360 Views)
Hmmm... Wonder if I should have copyrighted my previous post given the rules on this board...

Um... I hereby copyright the previous post. Is that enough?
0 Kudos
Message 10 of 26
(4,357 Views)