Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with 'wm iconify', is there any command similar?

122 views
Skip to first unread message

María San José Seco

unread,
Oct 4, 2012, 10:46:26 AM10/4/12
to
Hello,

I have a C++ program that executes a tcl/tk program, but i want to minimize my window. I'm using "wm iconify $w" but this doesn't really minimize my window. It stays in my desktop like an Xterm icon.

Thanks in advance.

Regards,

Maria

Robert Heller

unread,
Oct 4, 2012, 11:51:46 AM10/4/12
to
At Thu, 4 Oct 2012 07:46:26 -0700 (PDT) =?ISO-8859-1?Q?Mar=EDa_San_Jos=E9_Seco?= <mcarmen...@gmail.com> wrote:

>
> Hello,
>
> I have a C++ program that executes a tcl/tk program, but i want to
> minimize my window. I'm using "wm iconify $w" but this doesn't really
> minimize my window. It stays in my desktop like an Xterm icon.

Are you giving time to the Tcl/Tk event loop? Eg. are you calling
Tcl_DoOneEvent?

>
> Thanks in advance.
>
> Regards,
>
> Maria
>

--
Robert Heller -- 978-544-6933 / hel...@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments



María San José Seco

unread,
Oct 4, 2012, 12:01:23 PM10/4/12
to
Yes, I only iconify and the result is that.

My main app is made in C++ code, but i call wish command with my tcl/tk and the result is a window that i can't minimize completely.

Thanks a lot.

Robert Heller

unread,
Oct 4, 2012, 2:21:22 PM10/4/12
to
At Thu, 4 Oct 2012 09:01:23 -0700 (PDT) =?ISO-8859-1?Q?Mar=EDa_San_Jos=E9_Seco?= <mcarmen...@gmail.com> wrote:

>
> Yes, I only iconify and the result is that.
>
> My main app is made in C++ code, but i call wish command with my tcl/tk and=
> the result is a window that i can't minimize completely.

You *have* to call Tcl_DoOneEvent regularly, typically *every time*
through your main loop.

It is generally *simplier* to have the Tcl/Tk be the main program and
have the C++ code as a loadable shared library, exposing descrete
function calls or instance methods. Even if the Tcl/Tk code does
little more that just call the C++ code and implement the GUI (eg
almost all of the -command scripts are calls to the C++ code's
functions or methods). Even then you need to be careful to have the
C++ code either call Tcl_DoOneEvent() itself or not have any actually
*long* loops or (long) I/O bound code in the C++ code (nothing that
waits on something like a pipe or socket). It is *very important* for
the Tcl event handler loop to BE the main loop of the program,
otherwise the GUI will simply hang and be 'non-responsive' (including
failing to iconify, etc.).

Note:

If you are doing something like this in your C++ code (including using
the low level fork()/exec() functions):

system("wish foo.tcl");

and foo.tcl does not call 'exit', the window won't go away when the
program runs to the end of file on foo.tcl.

You message is not clear what you are doing.

>
> Thanks a lot.
>
> El jueves, 4 de octubre de 2012 17:51:47 UTC+2, Robert Heller escribi=F3:
> > At Thu, 4 Oct 2012 07:46:26 -0700 (PDT) =3D?ISO-8859-1?Q?Mar=3DEDa_San_Jo=
> s=3DE9_Seco?=3D <mcarmen...@gmail.com> wrote:
> >=20
> >=20
> >=20
> > >=20
> >=20
> > > Hello,
> >=20
> > >=20
> >=20
> > > I have a C++ program that executes a tcl/tk program, but i want to
> >=20
> > > minimize my window. I'm using "wm iconify $w" but this doesn't really
> >=20
> > > minimize my window. It stays in my desktop like an Xterm icon.
> >=20
> >=20
> >=20
> > Are you giving time to the Tcl/Tk event loop? Eg. are you calling
> >=20
> > Tcl_DoOneEvent?=20
> >=20
> >=20
> >=20
> > >=20
> >=20
> > > Thanks in advance.
> >=20
> > >=20
> >=20
> > > Regards,
> >=20
> > >=20
> >=20
> > > Maria
> >=20
> > > =20
> >=20
> >=20
> >=20
> > --=20
> >=20
> > Robert Heller -- 978-544-6933 / hel...@deepsoft.com
> >=20
> > Deepwoods Software -- http://www.deepsoft.com/
> >=20
> > () ascii ribbon campaign -- against html e-mail
> >=20

Andreas Leitgeb

unread,
Oct 5, 2012, 9:23:21 AM10/5/12
to
María San José Seco <mcarmen...@gmail.com> wrote:
> Yes, I only iconify and the result is that.
> My main app is made in C++ code, but i call wish command
> with my tcl/tk and the result is a window that i can't
> minimize completely.

This seems to me like more of a babylonian problem: What
you think your English text means, seems not to be what
it means to others.

First question:
if you call wish with your "tcl/tk"(-script?) directly from
command line, then do you see the same problem? If yes, then
see next questions, else if behaviour depends on that it is
called from C++, then say so, explicitly.

Second question:
in Tcl, there is no such thing as "minimizing not completely".
Either the window is still there, afterwards, or it isn't.
If the window disappears, but some icon shows up instead, then
this your system's way to show an "iconified" window, namely as
an "icon". If you want to hide the window completely, rather
than have an icon shown for it, then replace the call
to "wm iconify ..." by "wm withdraw ...".

Third question:
does your tcl-script really need any windows? If you don't
want it to ever show any windows, then you probably want to
execute "tclsh" instead of "wish". If you're on windows OS
and tclsh causes some "dosbox"-window to appear, then using
wish with "wm withdraw ." may indeed be worth a consideration.

María San José Seco

unread,
Oct 8, 2012, 6:42:18 AM10/8/12
to a...@logic.at
Thank you thank you thank you!

wm withdraw works perfectly! It does what I want.

Regards,

Maria

0 new messages