Alice Community  

Go Back   Alice Community > Alice 3 > How Do I?

Thread Tools Display Modes
Mouse listeners, class and instance properties and instance variables
Posts: n/a
Default Mouse listeners, class and instance properties and instance variables - 06-09-2009, 03:07 PM

A couple more notes on the Alice 3 user interface. The attached shows an example of how to set mouse listeners and individual properties and also how to define variables for the instances of a class. In the case for the variable, you can use the class constructor. This will define the a unique version of the variable for each instance of the class. In the case of the individual propertes, you have to use the CustomSetup procedure for the scene. (See my earlier posting for how to access these from pulldown menus to both create and edit them.) If you use the class constructor for things like color, that appears to set that type of propertly for the entire class. Note that the value of a property and a function to set its value are both included in the properties window.

I also inclosed a (zipped) sample program. The mouse has to click on the head part of the chicken for the click to be correctly recognized. So far, the mouse click is the only event I've found (specifically there does not seem to be a corresponding keyboard event).
Attached Images
File Type: jpg CustomSetUp.jpg (25.7 KB, 56 views)
File Type: jpg DeclareProperty.JPG (26.4 KB, 54 views)
File Type: jpg CustomDouble.JPG (32.4 KB, 52 views)
Attached Files
File Type: zip (14.4 KB, 25 views)
Reply With Quote
Mouse listeners
Junior Member
Status: Offline
Posts: 3
Join Date: Jan 2012
Location: Toronto, Canada
Default Mouse listeners - 01-11-2012, 11:59 AM

I am using Alice Beta 3 in my class and we are following the general format of the textbook. We have started to make events. So far, I have been able to make the keylisteners work by following the instructions given elsewhere in this blog.

I cannot see how to make the mouselistener work. All I have managed to do is to make procedures run when I click the mouse anywhere in the run window. I want to be able to click on something specific in order to trigger an action.

Any ideas?
Reply With Quote

Thread Tools
Display Modes

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

Forum Jump

Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.