[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Tk mouse events and keys

R. Mark Volkmann

12/3/2004 12:05:00 PM

I'm using the following code to detect a left mouse click.

canvas.bind('1', proc {|event| doPress(event)})

Inside my doPress method, is there a way I can ask the event object whether
the ctrl key was down when the mouse button was pressed?

Is proc what I should be using in my bind call?




6 Answers

Hidetoshi NAGAI

12/3/2004 2:24:00 PM

0

R. Mark Volkmann

12/4/2004 2:11:00 AM

0

If I have an item on a TkCanvas such as a Rectangle, is there a way to hide
it temporarily and then show it later?
Hopefully I don't have to delete it and recreate it later.




Hidetoshi NAGAI

12/4/2004 3:36:00 AM

0

Martin Weber

12/4/2004 8:17:00 AM

0

On Sat, Dec 04, 2004 at 11:11:28AM +0900, R. Mark Volkmann wrote:
> If I have an item on a TkCanvas such as a Rectangle, is there a way to hide
> it temporarily and then show it later?

I don't know Ruby/Tk, but I do know Tk, and the canvas supports this via
itemconfigure -state {normal, hidden}. For mental guidance, the equivalent
tcl code would be sth like ..

# ....
canvas .c
set id [.c create rectangle 50 50 200 200]
.c itemconfigure $id -state hidden
# .. lateron:
.c itemconfigure $id -state normal

Of course if you're using tags etc. you can have whole groups disappear at
once and reappear later etc. I suggest reading the canvas manpage, it's huge
but has a lot of info too :-)

Hth,

-Martin


Hidetoshi NAGAI

12/4/2004 8:37:00 AM

0

Martin Weber

12/4/2004 8:58:00 AM

0

On Sat, Dec 04, 2004 at 05:37:20PM +0900, Hidetoshi NAGAI wrote:
> Hi,

Moin,

> > (... me suggesting item's 'state' option ...)
> You are right. 'state' option is supported on Tk8.3+ (is it right?).

Dunno, it's been there ever since I've needed it :)

Regards,

-Martin