charcode and other such madness (javascript)
category: code [glöplog]
Is there an internal way to convert charcode+modifiers to a proper character? I'm not fancying this String.fromCharCode(e.keyCode || e.charCode) indexing a lookup table technique.
that is indexing a lookup table based on modifiers....
I wish. Alas there is no way to get the character from a keypress including the consumed modifiers and dead keys. This gap in the specs makes it impossible to make a serious app with keyboard navigation/input/shortcuts. You're left with hacking around.
Which modifiers to want/need to support ?
Which modifiers to want/need to support ?
s/to/do you
Aww, nuts. I trust you p01. you're javascript fu is strong. Just the shift modifier, I can use my table.
your
Here is an example for keyboard events (focus the edit field and hit any key on your keyboard):
http://www.mediaevent.de/javascript/Extras-Javascript-Keycodes.html
http://www.mediaevent.de/javascript/Extras-Javascript-Keycodes.html
Another paper on this:
http://unixpapa.com/js/key.html
http://unixpapa.com/js/key.html
Here is a keypress library for JavaScript (has a nice demo keyboard on the page, showing the keys pressed):
http://dmauro.github.io/Keypress/
http://dmauro.github.io/Keypress/
String.fromCharCode(e.keyCode || e.charCode) - wut? Why not just String.fromCharCode(e.which) ?
Ain´t this sorted in a standard byteArray anymore?
By first asking if shift (let it be $fe) is inputted, then asking what other key is inputted, you should get what you need, right? did they really complicate it? i guess i know why i dont want to code such stuff now, its just unnormal! ;)
Well, in other news i didnt want to post in here anymore! :( but i have to, because it´s normal to answer on such stuff!
Bye then! :D
PS: i am still into amiga-ascii...where Space equals $20 and from there you get numbers followed by a-z, followed by special characters !"§$%/(/( )&(/§%$%²³ dollowed by A-Z etc...all fitting into 256! ;) So for SHIFTed (uppercase) letters you´d just add some amount to your byte and be done!
By first asking if shift (let it be $fe) is inputted, then asking what other key is inputted, you should get what you need, right? did they really complicate it? i guess i know why i dont want to code such stuff now, its just unnormal! ;)
Well, in other news i didnt want to post in here anymore! :( but i have to, because it´s normal to answer on such stuff!
Bye then! :D
PS: i am still into amiga-ascii...where Space equals $20 and from there you get numbers followed by a-z, followed by special characters !"§$%/(/( )&(/§%$%²³ dollowed by A-Z etc...all fitting into 256! ;) So for SHIFTed (uppercase) letters you´d just add some amount to your byte and be done!
ok, you get them as Strings instead of char* , i see...cant you just decimate your string down to one single letter and from there convert it to "char", which is equivalent to "byte", so you know where you´re at again?
hardy: Remember that all this web stuff must work for all keyboard layouts and languages ( UNICODE baby ). It's a bit more complex than working with a couple of pages of lower ASCII characters ( <128 ) . Just to give you an idea, many languages have a single case ( no uppercase & lowercase, it's just one case ), have their own punctuations, have far more glyphs than available on a regular keyboard thus the user had to type 2-3 characters ( which of course are registered and displayed as individual key inputs) which are THEN transformed into a single glyph by the OS. Key handling and i18n is a wonderful and colorful world.
Good luck building a web app with keyboard shortcuts and that catches all this things correctly.
Now, of course you're free to make your app only available in English and support English keyboard layout ( Hello! EN_US and EN_GB layouts ), in which case you can take some shortcuts ( See what I did there :p ) in your key handling.
Good luck building a web app with keyboard shortcuts and that catches all this things correctly.
Now, of course you're free to make your app only available in English and support English keyboard layout ( Hello! EN_US and EN_GB layouts ), in which case you can take some shortcuts ( See what I did there :p ) in your key handling.
yep, i knew its about codetables and ISO-XX, just deleted that part after realizing it would make my answers even more hard to read/understanable/followable! I just still hoped for some easy solution ;) i am not into web tho, just tried to make it as easy as possible to other people or the threadstarter to find a working solution at all! :)
well, to me web2.0 is stuck in the 90s, eventho just NEW and thats not only thanks to the limitations, but also thanks to no1 really wants to use it graphics-wise, except us demosceners, whom are open up to everthing new ofcoz! ...well...i dont think we have to grow back but on!
Sorry, but to me this all sucks! if someone wants to learn coding, heshe can go easy roads or just the correct way! all of this web-code is 100% lamer to me! not coewise, but outcome-wise! there are superb web-demos by alcatraz and scoopex and others, but its all that far away from the roots! sometimes i think a monkey could do that, but i am certainly true it aint like that ofcoz! still lots of steps back if you can use NEW tech! and i am saying that while i am oldskooling wherever i can, i hate all of that OO-stuff, while using it almost in every routine i do nowadays! hard to tell, but distracts me the most, but i think its worthless to try to get into it, while everyone else says its the future! if it´s really the future, why the FunkyHomoSapien i´ve been there already? several times, 10 years ago?!!
Sorry, had to!
well, to me web2.0 is stuck in the 90s, eventho just NEW and thats not only thanks to the limitations, but also thanks to no1 really wants to use it graphics-wise, except us demosceners, whom are open up to everthing new ofcoz! ...well...i dont think we have to grow back but on!
Sorry, but to me this all sucks! if someone wants to learn coding, heshe can go easy roads or just the correct way! all of this web-code is 100% lamer to me! not coewise, but outcome-wise! there are superb web-demos by alcatraz and scoopex and others, but its all that far away from the roots! sometimes i think a monkey could do that, but i am certainly true it aint like that ofcoz! still lots of steps back if you can use NEW tech! and i am saying that while i am oldskooling wherever i can, i hate all of that OO-stuff, while using it almost in every routine i do nowadays! hard to tell, but distracts me the most, but i think its worthless to try to get into it, while everyone else says its the future! if it´s really the future, why the FunkyHomoSapien i´ve been there already? several times, 10 years ago?!!
Sorry, had to!
hArDy: Actually, Unicode is the modern alternative to the whole codepage-mess.
I havent been thru the codepage.mess at all ;) juat read about it later!
Been on a REAL computer until 2005! AMIGA 1200!
Been on a REAL computer until 2005! AMIGA 1200!
It shows.
[offtopic]
hardy: Diff'rent Strokes. The are room for all kinds of people, languages and platforms. I certainly appreciate web stuffs, old & new school tech attack. The thing I like about the web, despite the quirks, is the ubiquity and accessibility of the platform. But again, diff'rent strokes. Sorry, but may I ask if you code for a living or do you only code for fun ?
[/offtopic]
hardy: Diff'rent Strokes. The are room for all kinds of people, languages and platforms. I certainly appreciate web stuffs, old & new school tech attack. The thing I like about the web, despite the quirks, is the ubiquity and accessibility of the platform. But again, diff'rent strokes. Sorry, but may I ask if you code for a living or do you only code for fun ?
[/offtopic]
Quote:
meaning "I have no clue what I'm talking about."i am not into web tho
Quote:
meaning "I'll just troll around saying how stupid coding is nowadays".make it as easy as possible to other people or the threadstarter to find a working solution at all
Quote:
well, to me web2.0 is stuck in the 90s
...
Quote:
Sorry, but to me this all sucks! if someone wants to learn coding, heshe can go easy roads or just the correct way! all of this web-code is 100% lamer to me!
I think that mindset is more stuck in the 90's than anything else :)
is it hardy bashing season again? how about keeping things on topic? just a thought.
its ok, ps, thanks though!
its ok, because this time i really just trolled around! :D
xTr1m nailed it down! :)
its ok, because this time i really just trolled around! :D
xTr1m nailed it down! :)