Version 4 of console - work with the parent window

Updated 2013-01-15 23:17:33 by Zipguy

Zipguy (2013-01-15) - You can find out my email address by clicking on Zipguy.

I've been thinking about How do you make two windows act as one?, and I started wondering about having the Console work with the parent window (the same as described in that article when minimizing/restoring them).

I noticed the command used in console -font? which was

    console eval { font configure TkConsoleFont -size 10 }

and thought what if I put the commands

 bind . <Unmap>      "console eval { wm iconify   .console}"
 bind . <Map>        "console eval { wm deiconify .console}"

into the code of the application that brought up the console with a button (named "Console"). So I did. That caused the application to produce an error message like this about thirty+ times:

http://www.geocities.ws/thezipguy/misc/error001.png

and when you hit the Detail button:

http://www.geocities.ws/thezipguy/misc/error002.png

I knew it was not a toplevel window. I tried to make it one, but that still failed. I'm looking into Tkcon which may have a toplevel window, or other things to do what I want.

Any ideas on what I should do to get the Console to work with the parent window? Any help would be great!.


Zipguy (2013-01-15) - I tried some wm commands with no success. But I did try

 console eval { puts "winfo id .console [winfo id .console ]"}

which gave me different results each time I ran it.

 winfo id .console 0x00000000010C02E2
 winfo id .console 0x0000000000A20CD0
 winfo id .console 0x0000000000640B4E ...

I could use this, if I knew how to tell Windows to iconify/deiconify this in C++, or assembler etc.

MG The console runs in its own interpreter, and has its own main toplevel window ".":

  % puts [console eval {winfo parent .console}]
  .
  % console eval {wm iconify .}

Zipguy (2013-01-15) - Thanks MG, that code works great! I have it like this:

 bind . <Unmap>    "console eval { wm iconify   .}"
 bind . <Map>      "console eval { wm deiconify .} ; focus .toolbar "

which does it make it work like one group of windows. It does work well.

I only have one more problem. In fact, it always seems to initially be on the console at first. Also, when I've clicked on the Appliction's minimize button, and I've clicked on the Application's Name to Restore it, both windows come back, but the focus has switched to the .console Window (instead of the Application's main window). I tried making the bind Map into focus on .toolbar, the main window, but now it always seems to focus on the console instead, until I click on the Application's window. hmmmm...