Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39128 > unrolled thread

CTRL use on canvas.

Started byJonas Thörnvall <jonas.thornvall@gmail.com>
First post2020-11-11 00:30 -0800
Last post2020-11-12 10:25 +0100
Articles 10 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  CTRL use on canvas. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-11 00:30 -0800
    Re: CTRL use on canvas. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-11 00:41 -0800
      Re: CTRL use on canvas. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-11 00:45 -0800
    Re: CTRL use on canvas. JJ <jj4public@gmail.com> - 2020-11-11 18:15 +0700
      Re: CTRL use on canvas. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-11-11 14:03 +0100
      Re: CTRL use on canvas. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-11 09:16 -0800
        Re: CTRL use on canvas. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-11 11:27 -0800
          Re: CTRL use on canvas. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-11 11:28 -0800
            Re: CTRL use on canvas. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-11 11:34 -0800
            Re: CTRL use on canvas. Arno Welzel <usenet@arnowelzel.de> - 2020-11-12 10:25 +0100

#39128 — CTRL use on canvas.

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-11-11 00:30 -0800
SubjectCTRL use on canvas.
Message-ID<e008ff78-09a2-4981-b28a-12a635a3140bo@googlegroups.com>
I have started a "silly" project trying to simulate some sort of text editor/command cursor format on canvas.

Shift seem to work implicity, chosing correct Charcode character, but CTRL charcode 17 just produce some rectangle symbol.

Should i just have some boolean on/off switch for CTRL and simply reposition charcode with an add x or subtract x.

Or is there some type of command that actually make it do what shift does?

[toc] | [next] | [standalone]


#39129

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-11-11 00:41 -0800
Message-ID<e4765c01-ab9e-4124-95b7-fd86cb4b4ee6o@googlegroups.com>
In reply to#39128
Den onsdag 11 november 2020 kl. 09:30:40 UTC+1 skrev Jonas Thörnvall:
> I have started a "silly" project trying to simulate some sort of text editor/command cursor format on canvas.
> 
> Shift seem to work implicity, chosing correct Charcode character, but CTRL charcode 17 just produce some rectangle symbol.
> 
> Should i just have some boolean on/off switch for CTRL and simply reposition charcode with an add x or subtract x.
> 
> Or is there some type of command that actually make it do what shift does?

Is the above is correct, is this also the way to do for other keys like the numberic keyboard?

What keyboard things will simply not canvas be able to handle?

[toc] | [prev] | [next] | [standalone]


#39130

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-11-11 00:45 -0800
Message-ID<59337ea5-6eb2-40f6-aa7f-86b6e7cb0f37o@googlegroups.com>
In reply to#39129
Den onsdag 11 november 2020 kl. 09:41:09 UTC+1 skrev Jonas Thörnvall:
> Den onsdag 11 november 2020 kl. 09:30:40 UTC+1 skrev Jonas Thörnvall:
> > I have started a "silly" project trying to simulate some sort of text editor/command cursor format on canvas.
> > 
> > Shift seem to work implicity, chosing correct Charcode character, but CTRL charcode 17 just produce some rectangle symbol.
> > 
> > Should i just have some boolean on/off switch for CTRL and simply reposition charcode with an add x or subtract x.
> > 
> > Or is there some type of command that actually make it do what shift does?
> 
> Is the above is correct, is this also the way to do for other keys like the numberic keyboard?
> 
> What keyboard things will simply not canvas be able to handle?

Sorry not awake yet forget about it.

[toc] | [prev] | [next] | [standalone]


#39131

FromJJ <jj4public@gmail.com>
Date2020-11-11 18:15 +0700
Message-ID<i5tmmkdoda7x$.1ta8cfjytkfzv$.dlg@40tude.net>
In reply to#39128
On Wed, 11 Nov 2020 00:30:32 -0800 (PST), Jonas Thörnvall wrote: 
> I have started a "silly" project trying to simulate some sort of text
> editor/command cursor format on canvas. 
> 
> Shift seem to work implicity, chosing correct Charcode character, but
> CTRL charcode 17 just produce some rectangle symbol. 
> 
> Should i just have some boolean on/off switch for CTRL and simply
> reposition charcode with an add x or subtract x. 
> 
> Or is there some type of command that actually make it do what shift
> does?

Please provide a proper context for once.

[toc] | [prev] | [next] | [standalone]


#39132

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2020-11-11 14:03 +0100
Message-ID<XnsAC728EF9FEEB1eejj99@194.109.6.166>
In reply to#39131
JJ <jj4public@gmail.com> wrote on 11 Nov 2020 in comp.lang.javascript:

> Please provide a proper context for once.

Twice? ;-)


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#39134

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2020-11-11 09:16 -0800
Message-ID<344fae3c-3474-487c-828d-1af5e497a32bn@googlegroups.com>
In reply to#39131
On Wed, 11 Nov 2020 00:30:32 -0800 (PST), Jonas Thörnvall wrote: 
> I have started a "silly" project trying to simulate some sort of text 
> editor/command cursor format on canvas. 
> 
> Shift seem to work implicity, chosing correct Charcode character, but 
> CTRL charcode 17 just produce some rectangle symbol. 

Look at an ASCII table. What did you expect charcode 17 to display?

[toc] | [prev] | [next] | [standalone]


#39135

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-11-11 11:27 -0800
Message-ID<c0f6e2e2-0b22-49b3-8b37-ad7471b63656o@googlegroups.com>
In reply to#39134
Den onsdag 11 november 2020 kl. 18:17:06 UTC+1 skrev Michael Haufe (TNO):
> On Wed, 11 Nov 2020 00:30:32 -0800 (PST), Jonas Thörnvall wrote: 
> > I have started a "silly" project trying to simulate some sort of text 
> > editor/command cursor format on canvas. 
> > 
> > Shift seem to work implicity, chosing correct Charcode character, but 
> > CTRL charcode 17 just produce some rectangle symbol. 
> 
> Look at an ASCII table. What did you expect charcode 17 to display?

Ok i was a bit tired this morning so forget that question, but i have a connected question, when i . and ,"echo" dot it correctly tells me keycode 188 and keycode 190.

But what is echoed out is 3/4 and !/4 symbols, i know is is something with i am echoing wrong type of value.
key = e.keyCode ? e.keyCode : e.which;
character= String.fromCharCode(key);

[toc] | [prev] | [next] | [standalone]


#39136

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2020-11-11 11:28 -0800
Message-ID<8c094ead-a23a-4757-bc47-63a9dcb75debo@googlegroups.com>
In reply to#39135
Den onsdag 11 november 2020 kl. 20:28:02 UTC+1 skrev Jonas Thörnvall:
> Den onsdag 11 november 2020 kl. 18:17:06 UTC+1 skrev Michael Haufe (TNO):
> > On Wed, 11 Nov 2020 00:30:32 -0800 (PST), Jonas Thörnvall wrote: 
> > > I have started a "silly" project trying to simulate some sort of text 
> > > editor/command cursor format on canvas. 
> > > 
> > > Shift seem to work implicity, chosing correct Charcode character, but 
> > > CTRL charcode 17 just produce some rectangle symbol. 
> > 
> > Look at an ASCII table. What did you expect charcode 17 to display?
> 
> Ok i was a bit tired this morning so forget that question, but i have a connected question, when i . and ,"echo" dot it correctly tells me keycode 188 and keycode 190.
> 
> But what is echoed out is 3/4 and !/4 symbols, i know is is something with i am echoing wrong type of value.
> key = e.keyCode ? e.keyCode : e.which;
> character= String.fromCharCode(key);

By the way
key = e.keyCode ? e.keyCode : e.which;
Is some heavy monkey grammer who come up with this shit?

[toc] | [prev] | [next] | [standalone]


#39137

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2020-11-11 11:34 -0800
Message-ID<03eb1cba-f413-4e92-af1d-44d6fc32d84fn@googlegroups.com>
In reply to#39136
On Wednesday, November 11, 2020 at 1:28:57 PM UTC-6, jonas.t...@gmail.com wrote:

> By the way
> key = e.keyCode ? e.keyCode : e.which;
> Is some heavy monkey grammer who come up with this shit?

Those are old browser specific properties from before the standards were defined. Use this instead:

<https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key>

[toc] | [prev] | [next] | [standalone]


#39138

FromArno Welzel <usenet@arnowelzel.de>
Date2020-11-12 10:25 +0100
Message-ID<i14dc8FenijU1@mid.individual.net>
In reply to#39136
Jonas Thörnvall:

> Den onsdag 11 november 2020 kl. 20:28:02 UTC+1 skrev Jonas Thörnvall:
>> Den onsdag 11 november 2020 kl. 18:17:06 UTC+1 skrev Michael Haufe (TNO):
>>> On Wed, 11 Nov 2020 00:30:32 -0800 (PST), Jonas Thörnvall wrote: 
>>>> I have started a "silly" project trying to simulate some sort of text 
>>>> editor/command cursor format on canvas. 
>>>>
>>>> Shift seem to work implicity, chosing correct Charcode character, but 
>>>> CTRL charcode 17 just produce some rectangle symbol. 
>>>
>>> Look at an ASCII table. What did you expect charcode 17 to display?
>>
>> Ok i was a bit tired this morning so forget that question, but i have a connected question, when i . and ,"echo" dot it correctly tells me keycode 188 and keycode 190.
>>
>> But what is echoed out is 3/4 and !/4 symbols, i know is is something with i am echoing wrong type of value.
>> key = e.keyCode ? e.keyCode : e.which;
>> character= String.fromCharCode(key);
> 
> By the way
> key = e.keyCode ? e.keyCode : e.which;
> Is some heavy monkey grammer who come up with this shit?

No, this is called a ternary operator and many languages have this.

Also see <https://en.wikipedia.org/wiki/%3F:>

-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web