Question on MouseReleasedE

burgi
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 115
Registriert: 15. Apr 2009 18:08
Wohnort: Ludwigshafen

Question on MouseReleasedE

Beitrag von burgi »

Hi,

does anyone why MouseReleasedE never changes it's count Signal ? I thought I could use this to distinguish between even and odd clicks, but actally the count never changes. Does anyone know if it's possible to get it counting or is it concepually not working ?

Greets Dominic

imaier
Mausschubser
Mausschubser
Beiträge: 61
Registriert: 21. Okt 2013 21:27

Re: Question on MouseReleasedE

Beitrag von imaier »

I don't understand your question. Mouse.mouseReleasedE is an event, not a signal. It also does not "have a count Signal", so how could it change it? The values of the event are moreover of type Point, so there is no place to put an event count. That being said, if you want to count event occurrences, this should be really easy with the combinators given to you during the lecture, exercise and on the sheet. -- Ingo

burgi
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 115
Registriert: 15. Apr 2009 18:08
Wohnort: Ludwigshafen

Re: Question on MouseReleasedE

Beitrag von burgi »

Thanks for your reply,

I found a way to use the combinators in a quite simple way, as you said. The thought my question was pointing to, cam from the "Auto-complete"-fuction of eclipse which offered me a count Singnal for the MouseReleseEvent. But reading the Refrence Manual it became obvious that this could not be.

Greet Dominic

aderhold.st
Neuling
Neuling
Beiträge: 2
Registriert: 7. Nov 2013 15:45

Re: Question on MouseReleasedE

Beitrag von aderhold.st »

Hi,

now I'm a little bit confused. There is a method count for any event, which returns a signal. So why not use it?
In my implementation this works correctly. Are there any non-obvious drawbacks?

burgi
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 115
Registriert: 15. Apr 2009 18:08
Wohnort: Ludwigshafen

Re: Question on MouseReleasedE

Beitrag von burgi »

Hi,

how did you get that count method to work ? For me it never changed it's value, no matter how I tried. Maybe you could give a short code snippet. Just for interest, as I mentioned theres another way using the clicks evnent and the snapshot/toggle methods of i.

Greetings Dominic

imaier
Mausschubser
Mausschubser
Beiträge: 61
Registriert: 21. Okt 2013 21:27

Re: Question on MouseReleasedE

Beitrag von imaier »

Yes, there is a count method. I did not say that you should not use it. I was concerned about the terminology that was used earlier in this thread. I was afraid that there was a rather severe misunderstanding of what signals and events are. To be clear: an event does not *have* a count signal, but you can create one using method count. For comparison: an event does not have a map or filter event but you can create a mapped or filtered event from an original event, similar to how a collection does not have a map or filter collection, but you can create a mapped or filtered collection from an original collection. Please be careful with your terminology. It will be important in the exam to express yourself so that we understand you right away.

If the signal returned by count doesn't work, it's most likely a bug in REScala. There is a simple way to implement it on your own using another combinator, though. Please don't post a solution to this here. I'd prefer if people think about it on their own. Given that there is a limited number of combinators that we list on the sheet, this should even be possible using trial and error.

Cheers,
Ingo

Antworten

Zurück zu „Archiv“