keyDownAction triggering without pressing the key

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

keyDownAction triggering without pressing the key

hrung
Hi all,

I'm new here, so hello! I have a GUI question. I've defined several keyDownActions in a view, and I'm trying to find a way to trigger them without pressing the key - to be able to trigger them from within a routine, or trigger several of them by pressing a different key. I know I could define the action functions separately, and then call them both in the keyDownAction functions and in the other places I want to use them, but that seems kind of wasteful. Is there any way to directly initiate a keyDownAction from within a function? Here's an example:

w.view.keyDownAction = { arg view, char, modifiers, unicode, keycode;
        if (char == $1) {chanceSlider.valueAction_(chanceMap.unmap(20))};
        if (char == $2) {rateSlider.valueAction_(rateMap.unmap(1))};
        if (char == $3) {detuneSlider.valueAction_(detuneMap.unmap(1.05))};
        if (char == $4) {densitySlider.valueAction_(densityMap.unmap(0.06))};
        if (char == $5) {fadeSlider.valueAction_(fadeMap.unmap(20))};
        if (char == $0) { /* trigger all 5 previous actions?? */ };
};

I'd love to be able to trigger the first 5 together when pressing "0". Thanks so much for your help!
Reply | Threaded
Open this post in threaded view
|

Re: keyDownAction triggering without pressing the key

loolarge
Bump.

I am looking into doing the same thing - sending events to QObjects in reaction to Midi Events.
I would like to drive my GUI solely by Midi/OSC events.
Reply | Threaded
Open this post in threaded view
|

Re: keyDownAction triggering without pressing the key

Nathan Ho
This top-level forum is not used. For subscribers to see your messages, you need to be subscribed to sc-users and you need to post in the "SuperCollider Users" subforum: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html


Nathan