Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Finding a panel's size and/or storing extra data with the panel.

Reply
Thread Tools

Finding a panel's size and/or storing extra data with the panel.

 
 
Ian Hobson
Guest
Posts: n/a
 
      12-06-2003
Hi all,

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.

I have my sub panels placed with 'width'=>-1 making a small gap between.
I have used bind to call procedures at the correct times. (And set up
'cursor'=>??? On the panels, so that is correct).

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 ?????

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?

This effort is starting to look like there is a need for a decent TK in
Ruby book. TCL/Tk and Perl/Tk are all very well, but.... I don't know
them.

Regards - and thanks for your help.

Ian
--
Ian - posting to a Newsgroup. Please remove everything to reply.
 
Reply With Quote
 
 
 
 
Hidetoshi NAGAI
Guest
Posts: n/a
 
      12-07-2003
Hi,

From: Ian Hobson <(E-Mail Removed)>
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$(E-Mail Removed)>
> 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 ((E-Mail Removed))


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does return-by-value mean extra copies and extra overhead? mathieu C++ 3 09-04-2009 04:25 PM
User Images: Storing in Files VS Storing in Database Jonathan Wood ASP .Net 1 06-02-2008 05:56 PM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
storing pointer vs storing object toton C++ 11 10-13-2006 11:08 AM
A problem in storing HTML in database or a problem in finding the right reporting solution? Merek ASP .Net 0 12-03-2003 06:07 PM



Advertisments