home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / tcl / 1840 < prev    next >
Encoding:
Text File  |  1992-11-15  |  1.9 KB  |  48 lines

  1. Newsgroups: comp.lang.tcl
  2. Path: sparky!uunet!mcsun!dxcern!dxcern.cern.ch!trones
  3. From: trones@dxcern.cern.ch (Jostein Lodve Trones)
  4. Subject: Button-size in pix's or frame-size in char's?
  5. Message-ID: <1992Nov16.102838.17193@dxcern.cern.ch>
  6. Sender: news@dxcern.cern.ch (USENET News System)
  7. Reply-To: trones@dxcern.cern.ch (Jostein Lodve Trones)
  8. Organization: CERN, European Laboratory for Particle Physics, Geneva
  9. Date: Mon, 16 Nov 1992 10:28:38 GMT
  10. Lines: 36
  11.  
  12.  
  13. I hope somebody out there can help me with the following problem...
  14.  
  15. I am going to open a frame containing some buttons in columns and rows.
  16. Since I will do this quite often, and with a different number of buttons,
  17. I am writing a procedure to do this.
  18.  
  19. I use place instead of pack, because I want a somewhat speciall lay-out, 
  20. with space around the buttons.
  21.  
  22. The problem is that I need to know the size of the frame before I open it.
  23. But to calculate the size of the frame, I need to know the size of a button.
  24. The button's size is known in characters, but not in pixels.
  25.  
  26. I thought of using the winfo command to return the button-size in pixels,
  27. but this do not work, unless the button is already placed or packed in
  28. the frame, and the frame already packed/placed on the root-window, or 
  29. another packed/placed window.
  30.  
  31. So I have the famous "chicken-and-the-egg" problem: I can not calculate
  32. the size of the button, unless the frame is opened, and I can not open
  33. the frame unless I know the size of the button...
  34. (With "open" I mean place/pack the window so that it is visible on the screen)
  35.  
  36. I could of course first place the frame, then place a button on it, find
  37. the size and regeometrize(?) the frame, but is there a better way?
  38.  
  39. What I actually need, is a way to get the button's size in pixels when
  40. I know the size in characters, or a way to specify the frame-size in 
  41. characters.
  42.  
  43.  
  44. Thank you for any help!
  45.  
  46. Cheers,
  47.         Jostein
  48.