# Ctrl+A and Ctrl-Home are the same

**URL:** <https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104>\
**Category:** General\
**Created:** [November 5, 2013, 8:33am UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104 "2013-11-05T08:33:37Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain\_Bailleul](https://forum.xojo.com/user_avatar/forum.xojo.com/alain_bailleul/32/1370_2.png) [@Alain\_Bailleul](https://forum.xojo.com/u/Alain_Bailleul)\
**Post date:** [November 5, 2013, 8:33am UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/1 "2013-11-05T08:33:37Z")

</div>

Hi,

I’m writing an editfield in a canvas on Windows and I need to implement Ctrl+A (Select all) and Ctrl+Home (Go to the the beginning of the document). However, I get the same key code for both. (&h01 for the key, Keyboard.ControlKey = true). How can I make a difference between the two?

Thanks!  
Alain

---

<div class="post-metadata">

**Author:** ![Alain\_Bailleul](https://forum.xojo.com/user_avatar/forum.xojo.com/alain_bailleul/32/1370_2.png) [@Alain\_Bailleul](https://forum.xojo.com/u/Alain_Bailleul)\
**Post date:** [November 5, 2013, 10:06am UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/2 "2013-11-05T10:06:52Z")

</div>

Think I solved it by checking Keyboard.AsyncKeyDown(&h73) ’ home to make a difference between the two

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [November 5, 2013, 10:58am UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/3 "2013-11-05T10:58:36Z")

</div>

Yeah, that seems to do the trick. Just tested it with the following code in KeyDown event of the Window:

```auto
Function KeyDown(Key As String) As Boolean
  if Asc(Key) = &h01 then
    
    if Keyboard.AsyncKeyDown(&h73) then
      MsgBox "Ctrl+Home"
    else
      MsgBox "Ctrl+A"
    end if
    
  end if
 End Function
```

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [November 5, 2013, 2:33pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/4 "2013-11-05T14:33:00Z")

</div>

[quote=44196:@Alain Bailleul]Hi,

I’m writing an editfield in a canvas on Windows and I need to implement Ctrl+A (Select all) and Ctrl+Home (Go to the the beginning of the document). However, I get the same key code for both. (&h01 for the key, Keyboard.ControlKey = true). How can I make a difference between the two?

Thanks!  
Alain[/quote]  
I’d start not with a Canvas but a subclass of TextInputCanvas  
This is a plugin we created to make it possible to do cross platform text entry easier  
It’s what underlies the code editor in the IDE

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [November 5, 2013, 2:58pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/5 "2013-11-05T14:58:50Z")

</div>

> [@44221:@Norman Palardy](#):
>
> I’d start not with a Canvas but a subclass of TextInputCanvas

Well, he did say it was for Windows. IMO, you’d only need the Text Input Canvas plugin if you were supporting cross platform like our Formatted Text Control (which used the plugin).

The new event model for the Text Input Canvas is not for the feint of heart, though. It’s a pain, to be honest.

---

<div class="post-metadata">

**Author:** ![Alain\_Bailleul](https://forum.xojo.com/user_avatar/forum.xojo.com/alain_bailleul/32/1370_2.png) [@Alain\_Bailleul](https://forum.xojo.com/u/Alain_Bailleul)\
**Post date:** [November 5, 2013, 3:18pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/6 "2013-11-05T15:18:40Z")

</div>

It’s a special form of editfield I have written to be used in a canvas. I wrote it because it was the only other control besides a canvas that I still used and it caused flickering on Windows. I wanted to be able to control every aspect of it (Graphical).

some screenshots:

![](http://gorgeousapps.com/Editfield1.png)  
 ![](http://gorgeousapps.com/Editfield2.png)

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [November 5, 2013, 5:21pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/7 "2013-11-05T17:21:24Z")

</div>

Very cool. You can do some of this already with Formatted Text Control ([https://www.bkeeney.com/formatted-text-control/](https://www.bkeeney.com/formatted-text-control/)) and with just a little bit of work you could get the background images working the same way.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [November 5, 2013, 5:44pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/8 "2013-11-05T17:44:42Z")

</div>

> [@44227:@Alain Bailleul](#):
>
> It’s a special form of editfield I have written to be used in a canvas.

TextInputCanvas IS a canvas - just a special one that handles text input properly cross platform (which is crucial for OS X as you really cannot do it properly using just keydowns in Cocoa)  
So IF you happen to care about being x-plat that’s why I would use it

If you don’t then forget my suggestion 😛

---

<div class="post-metadata">

**Author:** ![Alain\_Bailleul](https://forum.xojo.com/user_avatar/forum.xojo.com/alain_bailleul/32/1370_2.png) [@Alain\_Bailleul](https://forum.xojo.com/u/Alain_Bailleul)\
**Post date:** [November 5, 2013, 7:03pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/9 "2013-11-05T19:03:29Z")

</div>

> [@](#):
>
> Bob Keeney Formatted Text Control

This is an excellent control you wrote Bob! I had a good look at it and really liked it, but some things I do like to do myself. Well, actually, a lot 🙂 One of the things the edit control needs to do is being able to draw on top of the editiable text (like the glas glow effect is on top, not underneath) or something like this for my help system (here simulated):

![](http://gorgeousapps.com/Editfield3.png)

> [@](#):
>
> Norman Palardy TextInputCanvas IS a canvas

From which version on does this exist? I still do a lot of work in RB2007r4 so I probably missed it. Is this used in the Xojo IDE? The reason I ask is because I don’t have a very good user experience with the Xojo IDE on Windows. E.g. the last time I checked, the enter key (right from the numeric keyboard) does not work and when programming I use this one a lot. 🙂

Thanks anyway for the suggestions guys!

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [November 5, 2013, 7:38pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/10 "2013-11-05T19:38:37Z")

</div>

> [@44266:@Alain Bailleul](#):
>
> From which version on does this exist? I still do a lot of work in RB2007r4 so I probably missed it.

Yeah this isn’t in that version its new to Xojo

> [@44266:@Alain Bailleul](#):
>
> Is this used in the Xojo IDE?

The code editor  
But issues with buttons not working is more likely a bug in our use of it than anything else  
We’ve fixed a number of those

---

<div class="post-metadata">

**Author:** ![Andre\_Kuiper](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@Andre\_Kuiper](https://forum.xojo.com/u/Andre_Kuiper)\
**Post date:** [November 5, 2013, 8:56pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/11 "2013-11-05T20:56:21Z")

</div>

> [@44221:@Norman Palardy](#):
>
> I’d start not with a Canvas but a subclass of TextInputCanvas

Where can i find this TextInputCanvas? I don’t see it in the Library.

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [November 5, 2013, 9:42pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/12 "2013-11-05T21:42:00Z")

</div>

> [@44293:@Andre Kuiper](#):
>
> Where can i find this TextInputCanvas? I don’t see it in the Library.

> **[GitHub - xojo/TextInputCanvas: TextInputCanvas is a plugin for the Xojo...](https://github.com/xojo/TextInputCanvas)**
>
> TextInputCanvas is a plugin for the Xojo programming environment that allows developers to implement custom text input controls with international input support. - GitHub - xojo/TextInputCanvas: Te...

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [November 5, 2013, 9:43pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/13 "2013-11-05T21:43:02Z")

</div>

> [@44266:@Alain Bailleul](#):
>
> This is an excellent control you wrote Bob

I’d love to say that we did all the coding but we acquired it after the original developer left the community. We’ve added a number of things and have more additions coming up.

---

<div class="post-metadata">

**Author:** ![Andre\_Kuiper](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@Andre\_Kuiper](https://forum.xojo.com/u/Andre_Kuiper)\
**Post date:** [November 5, 2013, 9:50pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/14 "2013-11-05T21:50:17Z")

</div>

> [@44308:@Bob Keeney](#):
>
> [GitHub - xojo/TextInputCanvas: TextInputCanvas is a plugin for the Xojo programming environment that allows developers to implement custom text input controls with international input support.](https://github.com/xojo/TextInputCanvas)

Thanks Bob, i got the impression it was a new Xojo buildin control.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [November 5, 2013, 10:21pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/15 "2013-11-05T22:21:34Z")

</div>

> [@44313:@Andre Kuiper](#):
>
> Thanks Bob, i got the impression it was a new Xojo buildin control.

TextInputCanvas is

Bob’s formatted text control is based on it now - it wasn’t before

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 4:55pm UTC](https://forum.xojo.com/t/ctrl-a-and-ctrl-home-are-the-same/12104/16 "2020-10-29T16:55:33Z")

</div>


