QC keyboard + message

itsthejayj's picture

Hi all, just wondered if anyone has built or has any ideas on displaying a message being typed using the keyboard, while keeping everything within qc (without a cocoa framework)?

I've tried using some simple javascript and the queue patch but i can't enter the same key twice lol - think this might solved by amending the javascript (but i suck @ javascript)!

Composition attached

PreviewAttachmentSize
qc_keyboard.qtz36.24 KB

cwright's picture
Re: QC keyboard + message

Unfortunately (and I mean no disrespect in what follows), this is a horrible way to solve this problem. Granted it's the only way to do so right now, but it's still far from optimal.

In about 2-3 weeks, we'll have a chance to release our Freeboard patch -- it outputs short strings of keypresses that can be concatenated/processed in javascript without needing all the glue noodles and such. Also handles future keycodes without needing to redesign the composition :)

itsthejayj's picture
Re: QC keyboard + message

Cheers Chris, no offence taken, indeed i thought it was a horrible way do things especially i as i starting thinking about lowercase letters and symbols. Wasn't the QWERTY keyboard originally designed to be ergonomically unsound so people wouldn't type so fast and the typebars wouldn't collide!

Freeboard sounds great looking forward to testing that, may this composition could wait till then.

cybero's picture
Re: QC keyboard + message

Well done - You've hit upon one humdinger of a JavaScript problem, at least for when we are working within browsers.

For one thing keystroke and charcode are honoured rather differently from one rendering engine - browser - to another.

In fact there is no currently accepted standard for capturing such events.

IMHO a bit of an oversight when you consider that we are communicating and working within an event driven interface.

However Quartz Composer currently doesn't employ JavaScript DOM handlers, but uses Core Classes only and not all of them, so far as I can tell.

The announced Keyboard entry patch sounds like a godsend for just such a circumstance as the one you are addressing though.

gtoledo3's picture
Re: QC keyboard + message

mmmm, Freeboard.

Concatenation.

Gnarly.

leegrosbauer's picture
Re: QC keyboard + message

Great news! Looking forward to this Freeboard patch.

tobyspark's picture
Re: QC keyboard + message

i've rigged a keyboard reader up for an installation (using a custom plug-in for the concatenation rather than js), but didn't have the knowledge to create a true source at the time. so chris: nice! looking forward to freeboard replacing the noodle stew.

till chris releases that, here's a horrible hack* plug-in, if you dare: you'll have to do your own noodling =]

  • though public api, so plug-in not patch folder
PreviewAttachmentSize
SPK-KeyboardToString.plugin.zip34.06 KB

dust's picture
Re: QC keyboard + message

i tried to tackle the same problem without java script in QC, but for some reason ran into trouble when multiplexing and duplexing the whole keyboard. for some reason ? the keyboard patch in qc would not send all T F values when connected to a plexor ? so i did basically the same sort of thing you did make a java script plexor or what ever. the problem lies in the "watcher" the watcher only changes when a new value is sent to it. when you double hit a key the watcher doesn't change the index because its value has not changed.

i would look at the developer examples and there is one called double click java or something. have a look at that then you should be able apply that to your javascript. just remember that you need to tripple click to type www. the example is for mouse clicks and based on time so it might not be entirely relevant to a key stroke.

actually the easiest way to fix your problem with out going to obj c and making a plug i think would to make a switch statement inside a loop . each time you enter a key it breaks out of the switch then increments the index count and goes back into the switch making it possible to type wwwwwwwww the wsitch is basically the same thing as an else if.

have a look at this keyboard attempt of mine im afraid its just as ugly as yours ;) i took a different approach to string concatenation.

http://kineme.net/Discussion/Programming/FTPpatch

itsthejayj's picture
Re: QC keyboard + message

cheers guys, managed to get what i need with a little bit more javascript!

so its ugly but it works, including ddddouble characters and backspaces now!

Something to use until some one offers a better solution

Cheers J

PreviewAttachmentSize
qc_keyboard+double+backspace.qtz31.3 KB

itsthejayj's picture
Re: QC keyboard + message

Hmm should have checked back here earlier by the looks of your plug-in Toby thxs for that anyway

dust's picture
Re: QC keyboard + message

cool always like to see other people approaches to problems. seems to be working. got to love the java script patch, it pretty useful for things. most things can be done with the QC standard patches but the javascript defiantly helps keep things cleaner.