View Full Version : Mouse listeners, class and instance properties and instance variables

06-09-2009, 02: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).

01-11-2012, 10: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?