From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to write a VI which has child window(s)?

Hi, every one.

Is it possible to write a VI with child window(s) on its front panel?
I want to write a VI which looks like an Excel's, i.e. a main window which
can have several child windows inside it.

Thanks for every advise.

Regards,

Byungin Bae / bibae@hitel.net
0 Kudos
Message 1 of 6
(2,959 Views)
Byungin Bae wrote:

> Hi, every one.
>
> Is it possible to write a VI with child window(s) on its front panel?
> I want to write a VI which looks like an Excel's, i.e. a main window which
> can have several child windows inside it.
>
> Thanks for every advise.
>
> Regards,
>
> Byungin Bae / bibae@hitel.net

The general answer is YES. You can simulate this behaviour by using VI
server capabilities. Take a look at. ../examples/viserver directory in
your installation for some examples of using VI control features of LabVIEW.

Generally algorithm could be suggested as follows.
Create main.vi, child.vi and server.vi. Open references to main and
child in server. You are ready to play with properties and methods of
main and child in serv
er. I mean size, position some behaviour
properties and etc. You can synchronize child and main parameters from
server.
There are tricks there and several ways of doing it, like controlling
main from child and child from main without server, but I don't want to
raise this discussion by my answer. LabVIEW Gurus, don't hit me with
objections and child window's theory, please 🐵 This is just a general
opinion for YES answer and was discussed in Info-LabVIEW mailing list.

--
Sergey Krasnishov
____________________________________
Automated Control Systems
National Instruments Alliance Member
Moscow, Russia
sergey_acs@levsha.ru
http://acs.levsha.ru
0 Kudos
Message 2 of 6
(2,959 Views)
I tried to find a possibility to do this too, but I haven't found an easy
way.

Anyway, I needed some time bu I realized it in a different way:

I write the panel margins of the main window every 100ms in a global
cluster.
In the child panel I read that coordinates every 200ms and set the panel
margins if the child window is out of the boarders of the main window. This
is the only way I found to do this.
Nevertheless the user will recognize that it is not a normal child window.
If he moves the main window very fast he sees that the simulated child
window is not in the other window. Additionally, when you minimize the child
window...

The windows API has commands for child window but I do not know them. If you
should find a better way, please let me know it. I think this
is a good idea
for the next LV version.

Max


--
-> max.weiss@gmx.de / max@web.de <-
-> Max Weiß * Eulenweg 2 * 76356 Weingarten * Germany <-
-> Fax: 0180 505254775181 * Tel: 0175 1228001 * DB 8 MWE <-
0 Kudos
Message 3 of 6
(2,959 Views)
....
> The windows API has commands for child window but I do not know them. If you
> should find a better way, please let me know it. I think this is a good idea
> for the next LV version.
>

The best way to do this is to make an ActiveX OCX. An OCX can
be windowless, but most of them have a child window that usually
belongs to another, then another, and eventually to the LV panel
or whatever container they are hosted in.

If the thing you want to host needs a child window, then it
will not take too much work for you to make an OCX wrapper so
that it can easily be hosted in a LV panel.

There are utility functions on the ftp and web site that will
give you the HWND of a LV panel. Some customers have called
reparenting functions directly to attach their chi
ld windows
to the LV window or attaching a LV panel to another window.
These child windows work reasonably well, but not nearly as
well as an OCX. It is also tricky to attach and detach them
at the right time.

Greg McKaskle
0 Kudos
Message 4 of 6
(2,959 Views)
"Max Weiß" wrote:

> I tried to find a possibility to do this too, but I haven't found an easy
> way.
>
> Anyway, I needed some time bu I realized it in a different way:
>
> I write the panel margins of the main window every 100ms in a global
> cluster.
> In the child panel I read that coordinates every 200ms and set the panel
> margins if the child window is out of the boarders of the main window. This
> is the only way I found to do this.
> Nevertheless the user will recognize that it is not a normal child window.
> If he moves the main window very fast he sees that the simulated child
> window is not in the other window. Additionally, when you minimize the child
> window...
>
> The windows API has commands for child window but I do not know them. If you
> should fi
nd a better way, please let me know it. I think this is a good idea
> for the next LV version.
>
> Max
>
> --
> -> max.weiss@gmx.de / max@web.de <-
> -> Max Weiß * Eulenweg 2 * 76356 Weingarten * Germany <-
> -> Fax: 0180 505254775181 * Tel: 0175 1228001 * DB 8 MWE <-

Try "Set Parent.vi". Download "G Toolbox" from my web site.

George Zou
http://gtoolbox.topcool.net
http://george-zou.sinacity.com
0 Kudos
Message 5 of 6
(2,959 Views)
"Max Weiß" wrote:

> I tried to find a possibility to do this too, but I haven't found an easy
> way.
>
> Anyway, I needed some time bu I realized it in a different way:
>
> I write the panel margins of the main window every 100ms in a global
> cluster.
> In the child panel I read that coordinates every 200ms and set the panel
> margins if the child window is out of the boarders of the main window. This
> is the only way I found to do this.
> Nevertheless the user will recognize that it is not a normal child window.
> If he moves the main window very fast he sees that the simulated child
> window is not in the other window. Additionally, when you minimize the child
> window...
>
> The windows API has commands for child window but I do not know them. If you
> should fi
nd a better way, please let me know it. I think this is a good idea
> for the next LV version.
>
> Max
>
> --
> -> max.weiss@gmx.de / max@web.de <-
> -> Max Weiß * Eulenweg 2 * 76356 Weingarten * Germany <-
> -> Fax: 0180 505254775181 * Tel: 0175 1228001 * DB 8 MWE <-

Try "Set Parent.vi". Download "G Toolbox" from my web site.

George Zou
http://gtoolbox.topcool.net
http://george-zou.sinacity.com
0 Kudos
Message 6 of 6
(2,959 Views)