[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Re: [sc-users] Sc3 keydown functions proposal



i reply to this through sc-dev.

btw. the focus primitive is great !  good work.  that one did bug me.
i'm still trying to get a supercollider.sourceforge.net cvs faq done.
i'll try tomorrow.

re: the consuming thing.
i guess it was Java's old system that i had read about years ago.
its done in a different way than what you laid out.
in the action function itself you consume or not the event.

usually rather than get
keyDown { arg  key, modifiers;

you get
keyDown { arg keyDownEvent;

which would be a simple object

KeyDownEvent {
	var key,modifiers;
	
}

(but you could easily add cool modifier matching methods to it to match
CAPS etc.   btw. if you want to mess with this, i just today FIXED some
major bugs with my modifiers matching in KeyDown sc2)

you the user would :

wobblyGui.keyDown = { arg keyDownEvent;
if(keyDownEvent.key.asChar = $q and: { keyDownEvent.modifier & 4 }, { // or whatever
		wobbly.goApeShit;
		^false; // i handled it here
	},{
		^true; // i don't care about this event go up the chain
	})
};

i would say make the keyDown function default to:

{
		if (key == $r, { this.value = 1.0.rand; ^this });
		if (key == $n, { this.value = 0.0; ^this });
		if (key == $x, { this.value = 1.0; ^this });
		if (key == $c, { this.value = 0.5; ^this });
		if (key == $], {
			this.value = this.value + (1/this.bounds.width);
			^this
		});
		if (key == $[, {
			this.value = this.value - (1/this.bounds.width);
			^this
		});
} // example from SCSlider

so if you set your own key down handler (or set it to nil), it overrides it.



also read this a bit, it criticizes this bubbling method and explains java event listeners:
http://216.239.39.100/search?q=cache:UzFwIsW9CCkC:www.lv2.clara.co.uk/ch3.
pdf+keydown+event+consume+bubble&hl=en&ie=UTF-8

but seriously, you should study how cocoa does it. its probably better :)




On Thursday, July 18, 2002, at 07:26 PM, heiko goelzer wrote:

no better examples yet, but I pulled out the standard keydowns and made
consuming possible as proposed by crucial.

    Heiko

I will come up with a new version soon, integrating consumers...

Heiko


_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users


____________________
http://crucial-systems.com