LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using SDK SetParent function, child panel doesn't respond correctly to parent scroll bar

Using the childpanel example from NI where SDK function SetParent is used to establish the parent/child relationship, if I enable scroll bars on the parent panel and run the example, the behavior of the child panel is strange. That is, it doesn't move at all when the parent panel is scrolled, and the child panel overlaps the scroll bar itself. Is there a simple way (attribute?) to let the child panel follow the scroll bar of the parent panel?
0 Kudos
Message 1 of 4
(3,412 Views)
What is the exact name of the example you're using? Is it the sdk\stdio\demo.prj example? The reason I ask is because that is the only shipping example that uses the SetParent function. And its purpose is to show how the SDK can be used from CVI, not to show how to create child panels. So, the underlying question is: why are you using this function to create a child panel, instead of simply using the first parameter of NewPanel or LoadPanel? The CVI User Interface Library is intended to be used without having to resort to the SDK, since the two don't "mix well." You might be able to use the SDK in some very specific cases, but I wouldn't recommend it unless you have a very specific reason for it.

Luis
NI
0 Kudos
Message 2 of 4
(3,412 Views)
The download file was Child_Window_in_LabWindowsCVI.zip. I don't remember exactly where I found it on your site. I am attaching the original zip file without the scroll bar change. I am using this methodology in order to have the minimize/maximize/close buttons on subpanels. Is there any documentation on where/why the two libraries don't "mix well"? Are there any plans to incorporate the min/max/close capability for child panels into the CVI User Interface library?
0 Kudos
Message 3 of 4
(3,412 Views)
Okay, I found the example (I had assumed that it was a shipping example, and not a download).

The problem with that example is that the SetParent trick does not/cannot handle all the situations in which a panel can be configured, as you found out. It illustrates what can happen when the two libraries (the Windows SDK and the CVI UI Library) are mixed. In this case, the problem arises from the fact that CVI library does not "know" that your MDI panel is a child panel, and therefore it does not clip it to the scroll bars. And of course, the SDK also knows nothing about the scroll bars, since they are completely implemented by the CVI library.

There have been a few suggestions to implement min/max/close functionality in native CVI child panels, but
never enough to make it a high priority. Still, it is in our suggestion database, and we are considering implementing itin the future. Still, we have no immediate, short term plans to do so. In the meanwhile, if you really need this functionality, you could try to implement it yourself. It would look a bit odd, but you could place a few picture buttons near the top-right corner of the panel, and then respond to those events by resizing or discarding the child panel. It would be a bit klunky, and it wouldn't look very Windows-like, but it should cover much of the MDI functionality.

- luis
0 Kudos
Message 4 of 4
(3,412 Views)