Am Freitag, den 12.10.2007, 14:02 +0200 schrieb Andreas Gick:

> Well the most obvious place, where the keycode could vanish is the following 
> procedure:
> 
> procedure TfpgEdit.HandleKeyChar(var AText: string;
>   var shiftstate: TShiftState; var consumed: boolean);
> var
>   s: string;
>   prevval: string;
> begin
>   prevval := Text;
>   s       := AText;
>   consumed := False;
> 
>   // Handle only printable characters
>   // Note: This is not UTF-8 compliant!
>  if (Ord(AText[1]) > 31) and (Ord(AText[1]) < 127) then
>   begin
>     if (FMaxLength <= 0) or (UTF8Length(FText) < FMaxLength) then
>     begin
>       DeleteSelection;
>       UTF8Insert(s, FText, FCursorPos + 1);
>       Inc(FCursorPos);
>       FSelStart := FCursorPos;
>       AdjustCursor;
>     end;
>     consumed := True;
>   end;
> 
>   if prevval <> Text then
>     if Assigned(FOnChange) then
>   if prevval <> Text then
>     if Assigned(FOnChange) then
>       FOnChange(self);
> 
>   if consumed then
>     RePaint
>   else
>     inherited HandleKeyChar(AText, shiftstate, consumed);
> end;

It looks as if you are right (although not knowing anything about
fpGUI ;).

> I tried commenting out  "if (Ord(AText[1]) > 31) and (Ord(AText[1]) < 127) 
> then" and the corresponding "begin end;" structure, but it didn't seem to 
> change anything. 

If you step down in the code you'll see the "consumed=true" statement.
This is at least responsible for not handing over the char to the
inherited method. So if the char should be handled there, set consumed
to false, too.

I'd try surrounding "UTF8Insert(...)" with writeln's to see if that's
the spot. Or check the inner workings of that procedure. Or for testing
purposes set the char directly to the edits text field ...

Hopefully Graeme can give some more sophisticated comments, mine are
only poking in the fog ... ;)

HTH,
Marc



_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to