Hmm, it's been ages since I did any VB, so I can't remember what key events there are - the KeyPreview property sounds right though. Have you tried going up the tree i.e. turned off KeyPreview on the holding container, the form that holds the container, etc? It's definitely getting caught somewhere and then not being forwarded onto Scintilla - it's just a case of finding out where.
If you're unable to find out where it's going wrong, a possible workaround is to catch the key press event and send instructions to Scintilla to do what you want to do, for example SCI_CHARLEFT for the left arrow, etc. This should be a last resort option though - I only suggest it because I vaguely remember VB having an annoying habit of processing key events even before KeyPreview. Still, there must be other users of ScintillaVB who've had this problem before - hopefully one of them will pipe up.
Matt
On 02/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]
> wrote:
Thnaks for that.
Part 2 seems to work (I'd actually tried to do that, but forgot to give the focus to the ScintillaVB container 1st - then to scintilla control that it creates)
1st 1 seems a bit more of a problem. VB6 has a 'KeyPreview' property on the container. This means that I get to see key events in the container before they go to the component in the container that has focus. But it appears, as you say, that the unshifted cursor keys are not forwarded to the container in the 1st place. Don't appear to have the facilitity to override either - unless someone can tell me different.
Cheers
Simon
"Matt Salmon" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]02/03/2006 11:56
Please respond to Discussion of the Scintilla editing component
To: "Discussion of the Scintilla editing component" < [email protected]>
cc:
Subject: Re: [scintilla] ScintillaVB
Hey Simon
Issue 1: This is occurring because your container is swallowing the
key events. You need to find out which method to override and return
false. For example, embedding Scintilla in a Control in C#, you need
to override the following method:
protected override bool ProcessDialogKey(Keys keyData) {
return false;
}
The control then forwards the necessary key events to scintilla
itself. With VB I assume you will add the event handler, and then set
one of the event properties to False.
Issue 2:
How are you settting the caret position and getting focus? In C#, I'd
set the caret position and use the GRABFOCUS call, like so:
scintilla.CurrentPos = 3;
scintilla.SelectionStart = scintilla.CurrentPos;
scintilla.SelectionEnd = scintilla.CurrentPos;
scintilla.GrabFocus();
These will of course need to be adapted to ScintillaVB, but the
concepts should be the same.
If you are moving the caret position to somewhere outside of the
visible area, you will also need to call the ScrollCaret() method to
ensure the current position is scrolled into view.
Hope that helps,
Matt
On 02/03/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Question about history.
>
> I'm stuck using a VB6 environment. I've gor ScintillaVB and modified it for
> my application (basically adding extra interfaces). The cursor keys don't
> work, but they do with shify and CTRL.
>
> I searched the archive, and found a previous post on this. The suggestion
> was to try KeyPreview. Ive turned this on and put KeyUp and KeyDown
> handlers (KeyPress event returns ASCII code only - so doesn't work for
> cursor or F keys having KeyUp/KeyDown and KeyPress is nonsense anyway) into
> the form where the ScintillaVB control is placed. Pressing letter keys
> causes the sequence KeyDown event, the letter appears in the Scintilla
> window, KeyUp event. Pressing a cursor key with shift or CTRL generates a
> KeyDown, text highlights in scintilla widow (for shift), KeyUp. Pressing
> just the cursor key has no effect in the scintilla window and no events are
> generated in the form.
>
> As a second issue, when I set the focus to the scintillaVB control the caret
> does not appear at its current position. Also when I programatically move
> the current position, the text moves, but the caret is not shown.
>
> Clues please - I'm tearing my hair out.
>
> TIA
>
> Simon
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit
> http://www.messagelabs.com/email
> ______________________________________________________________________
>
> _______________________________________________
> Scintilla-interest mailing list
> [email protected]
> http://mailman.lyra.org/mailman/listinfo/scintilla-interest
>
>
>
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest
_______________________________________________ Scintilla-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scintilla-interest
