PDA

View Full Version : Calling a Method From a Function


lanceA
05-18-2009, 07:46 PM
OK. I give up.

Why am I having difficulty calling a method from within a function in Alice 2.0???

I have a world.Function and a world.Method. From within the Function I try to drag the method and it will not allow it? I want my Function to call the method, do something within the method and then return to the function , do somethings and then return True. But I can not drop the call to the method within the function.

Any one know why? I would be most appreciative.:(

To save on responses, I can not use Alice 2.2 because the project relies heavily on the Opacity property, which is not supported in 2.2 and it needs the varying degrees of visiblity. The IsShowing property is not an option for this project.

Thank you,

kcoder
05-19-2009, 02:39 PM
It looks like the developers decided to separate the function and method paradigms (I just tried it myself in 2.0). Is your method long? It's a pain, but you could always just rewrite the method code into another function, or rewrite the method code into the function itself. For the first option, you'll want to have it return some dummy value, or maybe return whatever the code is supposed to do in the first place.

Good luck!

lanceA
05-19-2009, 04:19 PM
It looks like the developers decided to separate the function and method paradigms (I just tried it myself in 2.0). Is your method long? It's a pain, but you could always just rewrite the method code into another function, or rewrite the method code into the function itself. For the first option, you'll want to have it return some dummy value, or maybe return whatever the code is supposed to do in the first place.

Good luck!


Thanks. The method code is not long at all but that would violate OOP principals, as would combining a method and a function. I'm trying to teach students to break code up in to small simple pieces. But thanks for your input.

But I am curious why this can not be done in Alice.

Thanks again for the input.

freshmeat
05-19-2009, 04:41 PM
Object Oriented Programming! Wow. Alice says it teaches the principals of oop, but in fact alice is really only object based. So some of the oop principals don't apply to alice.

FM