From: Hidetoshi NAGAI Date: 2003-12-08T06:45:43+09:00 Subject: Re: Finding a panel's size and/or storing extra data with the panel. Hi, From: Ian Hobson Subject: Finding a panel's size and/or storing extra data with the panel. Date: Sun, 7 Dec 2003 07:42:14 +0900 Message-ID: <2AmQ1jLmql0$EwzN@ntlworld.com> > I am trying to write (Ruby and Tk 8.3) a TkPanel containing two TkPanels > where the sash between the panels can be dragged by the mouse to move > the border between the panels. 'ext/tk/sample/tkmultilistbox.rb' (included in 1.8.1-preview3) maybe help you. It shows 3 panes without Panedwindow (Tk8.4 feature). Each pane has one listbox with a horizontal scrollbar. And all listboxes are controlled simultaneously by only one vertical scrollbar. > How can I find out the size of the panels, and convert the x,y to parent > panel coordinates, so I can calculate the new 'relheight'=> values? > > panel.height gives me 0 for all heights ????? Probably you must use TkWinfo.height(panel) or panel.winfo_height. However, you will not be able to get the exact value before the panel is mapped on your window. > What are the x and y passed into the do_motionY call here? > > @panel.bind('B1-Motion', proc{|x,y| do_motionY(x,y)}, "%x %y") > > Are they screen co-ordinates? If so how can I get the top top of @Panel? The screen coordinates are given by %X and %Y. The top corner coordinates of the widget are given by TkWinfo.rootx(@Panel) (@Panel.winfo_rootx) and TkWinfo.rooty(@Panel) (@Panel.winfo_rooty). -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)