Ctrl+A and Ctrl-Home are the same

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

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

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

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

[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

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.

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:


Very cool. You can do some of this already with 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.

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 :stuck_out_tongue:

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 :slight_smile: 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):

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. :slight_smile:

Thanks anyway for the suggestions guys!

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

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

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

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.

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