Recent

Author Topic: problems with AltGr  (Read 13502 times)

Gaby

  • New Member
  • *
  • Posts: 21
problems with AltGr
« on: August 23, 2010, 01:08:13 pm »
Hola, buenos dias.
   Tengo un problema con el IDE de Lazarus, la tecla AltGr no funciona. No puedo escribir caracteres como {}@#, etc.
   Al principio pense que era un problema de configuracion, pero investigando el tema, me di cuenta que solo ocurria en el editor de codigo ( que es SynEdit), y si ponia un componente SynEdit en un proyecto.
   Todos los otros controles que admiten entradas de texto aceptan estas entradas.
   Investigando mas, puse varios breaks en los programas, para ver por donde pasaba, hasta que poniendolo en la unidad SynEdit, en la funcion TCustomSynEdit.KeyDown, vi que al hacer un break en la funcion, y despues reanudar la misma, aparecia el caracter en el editor, por haber detenido y reanudado la ejecucion solamente.
   Pensando un poco, hice lo siguiente, inserte un synedit en un form, en la propiedad onKeyDown del mismo, puse una funcion que retardaba la ejecucion( con un bucle for de 50 iters, y una llamada a refresh), y los caracteres especiales aparecian en el componente synedit.
   Porque??.
   Mi ambiente de trabajo es Linux Ubuntu 10.04 LTS, Lazarus 0.9.28.2-8Ubuntu 1 b, en el mismo ordenador tengo instalado Windows Vista, tambien con Lazarus, y en ese entorno no tengo ningun problema.
   Mi teclado es un inalambrico Microsoft Wireless MultiMedia Keyboard 1.1, y esta configurado en Ubuntu como Microsoft Wireless Multimedia Keyboard 1.0A.
   En todas las demas aplicaciones en que trabajo bajo Ubuntu, y en las demas opciones del IDE de Lazarus, funciona bien.
   Alguien puede darme algo de luz sobre el tema?.
      Saludos : Gaby

        I am Sorry for my bad English.

   Hello, good morning. I have a problem with the IDE of Lazarus, the AltGr key does not work. I cannot write characters like {} @#, etc.
    At the beginning I think that was a configuration problem, but investigating the subject, I realized that only it happened in the code publisher (that is SynEdit), and in a component synedit that I put in a form in a project.
    All the other controls that admit text entrances accept the characters {}[, etc.
    Investigating but, I put several breaks in the programs, to see through where it happened, until putting it in the SynEdit unit, the TCustomSynEdit.KeyDown function, I saw that when doing brake in the function, and later to resume the same, I shaw the character in the publisher, by to have stopped and to have resumed the execution only.
    Thinking a little, I did the following thing, inserts synedit in form, the property onKeyDown of the same, I put a function that slowed down the execution (with a for loop of 50 iters, and one call to refresh), and the special characters are writted in the component synedit.
    Because??. My environment of work is Linux Ubuntu 10,04 LTS, Lazarus 0.9.28.2 - 8Ubuntu 1 b, in the same computer I have installed Vista Windows, also with Lazarus, and in that environment I do not have any problem.
    My keyboard is wireless a Microsoft Wireless Multimedia Keyboard 1,1, and this formed in Ubuntu like Microsoft Wireless Keyboard Multimedia 1.0A.
    In all the other applications in which work under Ubuntu, and the other options of the IDE of Lazarus, works well. Somebody can give something me of light on the subject. Greetings: Gaby
« Last Edit: August 23, 2010, 01:12:38 pm by Gaby »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11896
  • Debugger - SynEdit - and more
    • wiki
Re: problems with AltGr
« Reply #1 on: August 23, 2010, 02:16:57 pm »
Which version / revision / snapshot of Lazarus do you use?

AtlGr is the same as Alt+Ctrl.
Maybe you Configuration (Options / Editor / Key mapping) have something assigned to alt-ctrl-"[" (or alt-ctrl-"]" or atlr-ctrl-"Q") ?

If not. I try to understand your debug work.

You say you put a break in TCustomSynEdit.KeyDown function.
That is only where commands (ctrl-key, cursor-keys, ...) are handled.

Did TCustomSynEdit.KeyDown function execute
  Key = 0?
or
  Include(fStateFlags, sfIgnoreNextChar);

If yes, then you do have a command assigned in "key Mapping"

If no, then you need to check in
  TCustomSynEdit.KeyPress
This is where the char is inserted in the text. it should call
  CommandProcessor(ecChar, Key, nil);


---------
Quote
, I shaw the character in the publisher, by to have stopped and to have resumed the execution only.

I am not sure, how you can see the char in the synedit, while on a breakpoint.
The paint event should not be called while you are on a breakpoint.
Even, if the char is inserted, it would not be on the display?

Quote
the property onKeyDown of the same, I put a function that slowed down the execution (with a for loop of 50 iters, and one call to refresh)
refresh = Application.ProcessMessages?

Does that mean:
- you press ctrl-alt-]
- "]" appears on display
- short wait
- "]" disappears / no longer there ?

That would mean that the char is deleted after insert, so if you debug, watch for a 2nd call to keypress / keydown.

Gaby

  • New Member
  • *
  • Posts: 21
Re: problems with AltGr
« Reply #2 on: August 23, 2010, 07:56:22 pm »
Hello Martin.
   My Lazarus is: Lazarus 0.9.28.2-8ubuntu1 r22277 FPC 2.4.0 x86_64-linux-gtk 2 (beta)
    
Quote
AtlGr is the same as Alt+Ctrl.
Maybe you Configuration (Options / Editor / Key mapping) have something assigned to alt-ctrl-"[" (or alt-ctrl-"]" or atlr-ctrl-"Q") ?
  I think no, becose when I pulse the Key "{" in the Edit Dialog of the property Lines of a SynEdit in the object inspector then the pulsation is Ok.
   Also if I pulse "{" in any site is Ok, except the code editor or a synedit in an application.
Quote
If no, then you need to check in
  TCustomSynEdit.KeyPress
This is where the char is inserted in the text. it should call
  CommandProcessor(ecChar, Key, nil);
  I situed breaks in TCustomSynEdit.KeyPress, and whith any caracter the program stop, bat with {}[] not.
Quote
refresh = Application.ProcessMessages?
  Form.Refresh = Repaint the screen.
  
Quote
Does that mean:
- you press ctrl-alt-]
- "]" appears on display
- short wait
- "]" disappears / no longer there ?

That would mean that the char is deleted after insert, so if you debug, watch for a 2nd call to keypress / keydown.
  No, I press ctrl-alt-],
   the timer run ( I see in a label caption the "For" variable decrement)
   When the timer is end, then the caracter "]" appears in the screen.
                                 
                                                 Saludos : Gaby


  

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11896
  • Debugger - SynEdit - and more
    • wiki
Re: problems with AltGr
« Reply #3 on: August 23, 2010, 09:14:20 pm »
object-inspector and edit dialog are directly under gtk2 control.

That is the input (even the multi line input in the dialog) are handled by gtk, and the LCL (IDE) doesn't do the key-processing (or less of it)

SynEdit is not GTK2 native. It needs to do all the work itself => that is why it sometimes can behave different.


Quote
No, I press ctrl-alt-],
   the timer run ( I see in a label caption the "For" variable decrement)
   When the timer is end, then the caracter "]" appears in the screen.

so somewhere in TCustomSynEdit.KeyDown you have code similar to:
  For i := 1 to 50 do begin
    SomeLabelOrForm.Caption := inttostr(i);
    Form.repaint;
  end;

And with this code everything is ok. And the "[" will keep being there, even after the loop finished?

But without this code, the [ is not inserted?

---
r22277 is quite old. Maybe you can test with a daily snapshot? Maybe it is already fixed?



Gaby

  • New Member
  • *
  • Posts: 21
Re: problems with AltGr
« Reply #4 on: August 27, 2010, 02:07:11 pm »
I tested with the version in svn trunk, the error is like.
   greetings : Gaby

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11896
  • Debugger - SynEdit - and more
    • wiki
Re: problems with AltGr
« Reply #5 on: August 27, 2010, 02:29:25 pm »
Can you work around bz using "left-alt" + "left-ctrl" + "[" ?

I don't know if that works under gtk2, or with a Spanish Keyboard.
It does work with a German Keyboard on Windows.

I don't know how Gtk2 handles AltGr...
There is an issue, with a very special setup, in which certain keys do not work:
http://bugs.freepascal.org/view.php?id=14716

The reason is, because VNC reports that 2 keys have been pressed by the user within the very same microsecond. (Normal humans aren't that fast).

There was a patch to workaround (but it breaks other features). The patch will no longer work, because gtk2 code has been copied, and no longer uses the gtk1 directory.
It may be possible that the same code now is in gtk2, and could be tested with a similar change....

You would need to find the gtk2 keyhandler and log all the incoming events. (at gtk level, not in synedit)

-----------
Unfortunately I will not be able to assist at the moment, since I am going to be away for several weeks.

Gaby

  • New Member
  • *
  • Posts: 21
Re: problems with AltGr Solved!
« Reply #6 on: August 27, 2010, 07:52:21 pm »
   Thanks Martin, and excuse me for my post, the error was in Linux, in the keyboard definition, but in the other applications not fail.
   I redefined the keyboard and all is OK.
   Thank very much  Gaby

soitjes

  • Newbie
  • Posts: 6
Re: problems with AltGr
« Reply #7 on: May 25, 2013, 09:28:06 pm »
Hello Gaby,

I have the same problem.  Could you tell me what you changed in your keyboard definition that solved the problem ?

Thanks,

Soitjes.

 

TinyPortal © 2005-2018