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

by Efo74 Fri Apr 26, 2019 6:38 am

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: 54
Joined: Wed Jul 04, 2018 4:24 am
Location: USA

Re: EditorGadget, prevent use of Enter / CR LF

by DanLJr Sat Apr 27, 2019 2:26 am

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

by Efo74 Sat Apr 27, 2019 9:57 am

Thank you, nice solution :D
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 1 guest