EditorGadget, prevent use of Enter / CR LF

Just starting out? Need help? Post your questions and find answers here.
Efo74
Posts: 16
Joined: Sat Mar 24, 2018 9:58 am

EditorGadget, prevent use of Enter / CR LF

Post 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 ?
User avatar
DanLJr
Posts: 58
Joined: Wed Jul 04, 2018 4:24 am
Location: USA

Re: EditorGadget, prevent use of Enter / CR LF

Post 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 ?
-Dan L.
:: falling on my face a lot lately; learning even more because of it! ::
Efo74
Posts: 16
Joined: Sat Mar 24, 2018 9:58 am

Re: EditorGadget, prevent use of Enter / CR LF

Post by Efo74 »

Thank you, nice solution :D
Post Reply