Forum > Other

FPGui Keyevent

(1/3) > >>

relocate:
Hello,

is there a way to get a basic Keyevent with FPGui. Here with a fpgmemo.
I tried to use OnKeypress, but the Memo allready forefilled its task after the Key is pressed.
So I press the backspace key and i want to prevent in some cases, that the char will be deleted, but I can't prevent that an because it is allready deletet when the event is fired I don't know which char has been deleted so I am also not able to restore this. How can I catch the key in advanced.

Greetings relocate

Bart:
Well, if the key is already handled by the memo before OnKeyDown/OnKeyPress are called, then this would be a bug IMO.

Bart

Fred vS:

--- Quote from: relocate on February 15, 2021, 11:50:15 am ---Hello,

is there a way to get a basic Keyevent with FPGui. Here with a fpgmemo.
I tried to use OnKeypress, but the Memo allready forefilled its task after the Key is pressed.
So I press the backspace key and i want to prevent in some cases, that the char will be deleted, but I can't prevent that an because it is allready deletet when the event is fired I don't know which char has been deleted so I am also not able to restore this. How can I catch the key in advanced.

Greetings relocate

--- End quote ---

Hello.

Please ask this to fpGUI mailing list:

http://geldenhuys.co.uk/webnews/

or create a issue here:

https://github.com/graemeg/fpGUI/issues

Thanks.

relocate:
I don't see it as a bug, it seems to be the normal behavior. May be I'm doing something wrong.
The Memo response as it should, a key ist pressed for example 'c' and it occurs in the memo.
Or keep it with backspace. The char in front of the cursor will be deleted, as it should.
But in this case I want to prevent this and I don't know how, it doesn't work with the events, or I'm doing it wrong. That's the reason I asked in the board.

winni:
Hi!

The "default" way goes like this:

After every keypress make an unvisible copy of the Memo1.lines.text.
If you made a typo then fetch your copy and use it in the Memo1.
This Undo is typically connected to Ctrl-z

If you need more than 1 undo-step, then you have to build an array of TStringlist for your copies.  And for a big amount you have obvious to refine that undo-system, that not the whole text is buffered but only the last char(s) .  Otherwise the Lazarus IDE could not offer 32767 undo-steps for the editor.

Winni

Navigation

[0] Message Index

[#] Next page

Go to full version