Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Position Embedded Application

Status
Not open for further replies.

sh00der

Technical User
Jul 15, 2003
58
CA
Ayup, I have an application that presents some data in a toplevel window top1. I can embed another application (a tcl script) in the toplevel window but I can't position it where I would like. Ideally I wanted to create a frame in the toplevel and then position the frame but I can only get it to work using ...

exec wish sript.tcl -use [winfo id .top1] &

if I try [winfo id .top1.embed] it falls over.

All the embedded application does is create a button and at the moment the button appears in the top left of top1, I would like to place it either bottom left or bottom centre, any ideas/suggestions?
 
Have you tried using the "place" geometry manager?
SYNOPSIS
place window option value ?option value ...?
place configure window ?option? ?value option value ...?
place forget window
place info window
place slaves window


DESCRIPTION
The placer is a geometry manager for Tk. It provides simple fixed placement of windows, where you specify the exact size and location of one window, called the slave, within another window, called the master. The placer also provides rubber-sheet placement, where you specify the size and location of the slave in terms of the dimensions of the master, so that the slave changes size and location in response to changes in the size of the master. Lastly, the placer allows you to mix these styles of placement so that, for example, the slave has a fixed width and height but is centered inside the master.

Bob Rashkin
rrashkin@csc.com
 
Here's an example of what I have done

toplevel .top1
canvas .top1.c1 -width 300 -height 300
grid .top1.c1

exec wish button.tcl -use [winfo id .top1] &

the button.tcl script looks like this ...

frame .f1
pack .f1
button .f1.exit -text "Exit" -command {exit}
pack .f1.exit

I think I'm probably not implementing the embedding properly. The place command sounds good but I'm not sure how to incorporate it in the above. If it goes in the button.tcl script then that would mean that it wouldn't be useable elsewhere, although that doesn't matter in this case, yet.
Many thanks
 
I guess I lost synch on what you're trying to do. You have a toplevel, top1, in which you put a canvas, .top1.c1. Then you have another script which, by itself, packs an exit button. For some reason you want to put the exit button in the toplevel but not in the canvas. Now, where is it you want the button to appear?

Bob Rashkin
rrashkin@csc.com
 
Sorry, I messed up. I didn't spend enough time 'fiddling' with it. I tried gridding a frame under the canvas and adding the button and couldn't get that to work for some reason but if I use a canvas then it works fine.

Sorry if it's confusing, I tried to simplify things (LOL) by pulling this example from my main program. I'm still doing something wrong though because in the main program I can't get it work if I use a child of the toplevel???

I'll do some more experimentation and if I'm still struggling I'll come back and try to post a clearer explanation, many thanks Bong.
 
Right, I've cracked it, thanks for your input Bong. I was getting an error because I needed to add an 'update' command before trying to embed the application in the frame I wanted to use.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top