Page 1 of 1

EditorGadget, prevent use of Enter / CR LF

Posted: Fri Apr 26, 2019 6:38 am
by Efo74
EditorGadget(#PB_Any, 10, 80, 330, 90,#PB_Editor_WordWrap),

Hello, I have a EditorGadget and I want prevent the use of Enter key to get in new line, is possible ?

Re: EditorGadget, prevent use of Enter / CR LF

Posted: Sat Apr 27, 2019 2:26 am
by DanLJr
I went through this same challenge. I solved it by binding the Change event (#PB_EventType_Change) to the control, and on every change to the data, I just looked for #LF$ and if exists in the data, just remove it, something like:

Code: Select all

If CountString(GetGadgetText(#UserInputEditor), #LF$)
  SetGadgetText(#UserInputEditor, RemoveString(GetGadgetText(#UserInputEditor), #LF$))
EndIf
...within the procedure that you bind to the event. Hopefully this points you in the right direction!
Efo74 wrote:EditorGadget(#PB_Any, 10, 80, 330, 90,#PB_Editor_WordWrap),

Hello, I have a EditorGadget and I want prevent the use of Enter key to get in new line, is possible ?

Re: EditorGadget, prevent use of Enter / CR LF

Posted: Sat Apr 27, 2019 9:57 am
by Efo74
Thank you, nice solution :D