----- Edit this page: http://wiki.tcl.tk/edit/11149@ Return to Recent Changes: http://wiki.tcl.tk/4 ----- '''Mail''' [Robert Abitbol] Thanks Peter for your excellent presentation on the "Answered Questions on ..." pages. The idea to put trails on each page (Home, back, and forward) was '''grand'''. The idea for a table of contents for each page was also very appropriate. The same goes for the excellent presentation on the [Answered Questions Index Page]. This is very professional work which makes those pages a pleasure to read. Thanks again! ---- ---- ---- ---- --------- '''Category: ''' Nov 04, 2003 Newbie asks: I'm trying to create a "yellow stick note" app. I have created a little decoration-less window using wm overrideredirect, and now I need to generate window-moving events so that I can manually place the sticky note. I believe I need to use event generate, but how do I get drag coordinates into a little script, which would (I believe) call wm geometry? Thanks... Here's a solution: set ::moveable 0 wm overrideredirect . 1 bind . {set ::moveable 1} bind . {set ::moveable 0} bind . {if {!$::moveable} {break}; wm geometry %W +[expr %X-10]+[expr %Y-10]} JPT Newbie responds: Sacrosanct bovine, Batman! You guys sure make it look easy! Just to make myself feel better, I modified your solution so that the frame wouldn't 'jump' to the cursor: set ::moveable 0 set ::X 0 set ::Y 0 wm overrideredirect . 1 bind . {set ::moveable 1; set ::X [expr %X-$::X]; set ::Y [expr %Y-$::Y]} bind . {set ::moveable 0; set ::X [expr %X-$::X]; set ::Y [expr %Y-$::Y]} bind . {if {!$::moveable} {break}; wm geometry %W +[expr %X-$::X]+[expr %Y-$::Y]} ---- '''Category: ''' 22-Oct-2003 I'm using tclkit to run tcl stuff on windows plattforms, but i can't open files under Windows XP. Win 2000 works fine, are there any known issues with Win XP, maybe concerning filepaths? Bernd [Vince] -- no, there are no known problems on XP. You'll have to be much more precise about what your doing. Provide a short script (< 10 lines) which works on 2000 but fails on XP. This should be easy if you ''can't open files''. Well, a single line will do: "set FILE [open test/file.txt r]". This works fine on 2000 but fails to find the requested file on xp. The problem remains when i replace slash by backslash, i'd think both variants should work. There is nothing else in the script i used for my test, the script is wrapped for win using: "sdx wrap tclxp.exe -runtime tclkit-win32.upx.exe". -- Bernd I'm really surprised now, because i can't even open a file in the same directory ("set FILE [open file.txt r]"). So it's not a slash, backslash problem. -- Bernd [Vince] with any bug report, the ''error message'' you get is critical. Anyway, I suggest you report this on comp.lang.tcl or on sourceforge, not here. ---- Question on text widgets displaying large files moved to [text]. --------------------------------------- '''Category: ''' 18-Oct-2003 Hello! I have a question about Winico. I have installed the package and have trouble loading it. After copying the winico03.dll into the working directory, I enter the following: load winico03.dll I get a cannot find library winico03.dll or one of its dependants. What would cause this and what do I do to overcome it? Thanking you in anticipation. --------------------- '''Category: ''' Broken Link??? Sep 30 - 2003 Hello. I tried the following link that was on the wiki site (ftp://ftp.dcade.de/pub/ml/tcl/packages/tcl_messageBox10.zip) but could not get through. Anyone have any luck as I would like to view this. Thanks Ep -------------------------------------- '''Category: ''' Tcl Installation/Uninstallation Sep 30 - 2003 Hi all! I easily compiled and installed the latest Tcl source code. I was needing it for compiling expect. Now I am done with my tasks, I have successfully uninstalled expect, but I found that there is NO make uninstall available for the Tcl code. Does anybody know any way to uninstall Tcl source code, apart from searching by date and removing file by file!? Your help is much appreciated!! Have fun, Oscar --------------------------------------- '''Category: ''' Sep 29 - 2003 How can i use the options(-error,-sockname,-peername) of configure command of socket ? The main problem is, like -sockname option returns three elements so how can i store these values to use further? ---- '''Category: ''' Sep 26 - 2003 I want to make a frontend to gcc in tcl. if {[catch {exec gcc -c $Compiler_Flags $Filename } Result]} { puts $Result exit 1 } I want to map gcc's output messages to stdout and stderr, while the command runs. I could direct it to a file, but we'll proberbly be running this frontend, several persons at the same time. - [RS]: Experiment with eval exec [list gcc ... > @stdout 2> @ stderr $Compiler_Flags [list $Filename] ---- '''Category: ''' Sep 25, 2003 I have a channel that I have opened as: set cid [ socket -server cfg $port ] From time to time the client times out reading this channel. When that happens the data in the buffer (from a puts command) is no longer valid. I would like to throw it away. NOT [flush] it, which just sends it to the client the next time the client tries to do a read, but actually empty the buffer and throw the data away. How can I do this? Thank you in advance. ---- '''Category: ''' 22/09/2003 Does Tcl includes the ability to control other applications, e.g. notepad? Other programming languages provide commands like Sendkey (VB) or Sendmessage (VC). So I can executing notepad, putting text into textbox and saving that in a file. That's all possible because of controlling menuoptions by sending Windows-Messages ... It is possible in Tcl too? - [RS]: See [tcom] for COM support, but not sure whether Notepad understands that.. - JPT: You could also try [cwind] (http://mini.net/tcl/5019). I've used it once and it did the (simple) job I had to do. ---- '''Category: ''' 20-Sep-2003 I'm messing around with tk_setPalette I have a problem with the foreground being black on black or more precisely very dark blue this is only a problem with errors which I can't read unless I edit both libs: dialog.tcl and bgerror .tcl. I made the foreground red which is readable. I hate messing with the lib scripts though, is there a way I can do this from within the main script? ---- '''Category: ''' 16-Sep-2003 If I want use binary Library-Code (e.g. from a DLL) in Tcl I need a Library which includes a special Init-Function. Does someone know what functionality that Init-Function have to contain? - [RS]: See [Building Tcl DLL's for Windows] for a complete example. ---- '''Category: ''' '''Older questions that remain unanswered or partially answered''' go below the following line: -------------------------------------------------------------- '''Category: ''' 02/09/03 Hi,following piece of code shows the creation of a toplevel-widget (child) inbound a frame of another toplevel-widget (parent). I asked me how I can move the parent-window so that the child-window keep it's relative position. set xmax [winfo screenwidth .] set ymax [winfo screenheight .] set xsize 480 set ysize 360 set xpos [expr ($xmax/2)-($xsize/2)] set ypos [expr ($ymax/2)-($ysize/2)] wm title . "parent" wm geometry . +$xpos+$ypos wm minsize . $xsize $ysize frame .main -borderwidth 1 -relief sunken pack .main -expand yes -fill both -anchor nw toplevel .child -class children wm title .child "child" wm transient .child . bind children { raise %W after idle { update idletasks set wx [expr [winfo rootx .main]+1] set wy [expr [winfo rooty .main]+1] wm geometry %W +$wx+$wy } } I've tried to bind child on parent over motion-event but it doesn't work. Has someone any ideas to solve the problem? [FW]: Well, first of all, your code binds for visibility, which will trigger just once when the window becomes visible. To bind for any time the window is redrawn (for example, when it is moved or resized) use the event. Your code doesn't have anywhere near all the functionality needed for relative window moving, but I can give you a complete example (I've been meaning to implement this myself as an exercise for a good while too). I just need to know - besides moving relative to the window, do you also want the subwindow to be trapped within it? Or should it be allowed to leave the larger window, but still move relatively? [tje]: Does this help at all? [Toplevel Geometry Manager] includes the bindings, etc. needed to make two toplevels "tied" together. I've cutted out all uninteresting code for that problem. Configure-event I use just to control maximumsize of smaller window, but if I can use it for more ... I'll do it. Okay, conditions for smaller window are: * start position should be the upper left corner of frame. It should work like ... place .child -x 0 -y 0 -anchor nw (... but that doesn't work for toplevel-widgets. It would be nice if I could change a toplevel-widget into a frame OR if I could bind a frame onto a toplevel-widget because a frame as container for toplevel is easier to handle than a pure toplevel ...) * size should be <;= frame of larger window * if larger window have been moving, smaller window have to keep it's position. * and last but not least: smaller window is inbound the frame of larger window at home, that means it's not allowed for it to leave domestic frame. FW. It would be nice if I could see your example code. I'm just interested in the way how you handle your toplevels. tje. Do you know how I can two toplevels tied together? Seems to be a way to place toplevels like other widgets with place-command. Do you show me that? [FW]: Is the smaller window to be resizable? If so, how should it being resized be handled? Should it snap back to the edge of the frame if you try to resize it beyond the edge? FW. What's wrong? I thought concept of this formum is: "Ask, and it shall be given", not "Ask, and it shall be asked again". Conditions for smaller window are clearly defined. Sorry, but I only would have an answer of my questions or an idea or hint. My suggestion if you really want to help: read again. it's not so difficult. If you want to talk about programming in tcl, c, pascal or general about developing software send email to: dev_store@yahoo.de [FW]: No, it was just a simple addendum question. You didn't specify the case of window resizing, which is rather different. I'm just going to take my best guess, since there seems to be a communication problem here. [FW] (again): You're right, I thought you were talking about how to implement the task of constrained windows in general. OK, now that that's all cleared up. Now, you say binding for motion? I assume that means the event, for the cursor moving. I realize this is probably getting exhausting by now, but could you describe the problem you're encountering a little more? FW. So I thought also. I've tried to bind larger window on smaller window with -event, so that if larger window is moved, smaller window is moved too, but no result. How did you solve that problem? [FW]: Aha. won't do it, because to move or resize a window (in Windows, for example) you use the title bar or drag the edges of the window. The border and title bar are provided by the window manager, and clicking on them won't trigger any Tk events. As I mentioned earlier, I'd bind to to respond when a window is resized or moved. However, you've got to check to make sure the window has actually moved and isn't configuring for other reasons, otherwise needlessly adjusting the geometry will itself trigger a , and go into an infinite loop.