A Plain-text only editorGadget?
A Plain-text only editorGadget?
Before I spend another entire day (or more) in MSDN and the RTF documentation, does anyone know if it's possible to specify an editorGadget as plain-text ONLY.
I'd like to use an editorGadget to allow the entry of text but I would prefer if the user not expect their output data to include any formatting that may have been entered e.g. via a command or "paste" or whatever.
I know i could plainText the data after entry, or disallow any rich text type commands at entry via callback, but would prefer if their were another, easier, method.
If there any API or other command, which will set the editor as accepting plainText only?
cheers
I'd like to use an editorGadget to allow the entry of text but I would prefer if the user not expect their output data to include any formatting that may have been entered e.g. via a command or "paste" or whatever.
I know i could plainText the data after entry, or disallow any rich text type commands at entry via callback, but would prefer if their were another, easier, method.
If there any API or other command, which will set the editor as accepting plainText only?
cheers
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: A Plain-text only editorGadget?
You can use a multiline StringGadget.
Code: Select all
OpenWindow(0, 100, 100, 300, 300, "")
StringGadget(0, 5, 5, 290, 290, "", #ES_AUTOHSCROLL | #ES_MULTILINE | #WS_BORDER | #PB_String_BorderLess)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
Re: A Plain-text only editorGadget?
Actually, Mr Fox, that was my initial approach (but I was unaware of the autoscroll capability
, so I had very limited entry (3 lines) - it's a small area)
I may need to use this, if there's no way to employ the editor.
Thanks once again.
cheers

I may need to use this, if there's no way to employ the editor.
Thanks once again.
cheers
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: A Plain-text only editorGadget?
Alternatively you can play with #EM_SETTEXTMODE and #TM_PLAINTEXT (though I can't make it work)
Stuff to spend another day anyway
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Stuff to spend another day anyway

http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Re: A Plain-text only editorGadget?
Hi rsts
Is that what you mean?
Check both types
Have a good day
Code: Select all
OpenWindow(0, 0, 0, 640,480, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget|#PB_Window_ScreenCentered)
;CreateWindowEx_(#WS_EX_CLIENTEDGE,"EDIT","", #WS_VISIBLE | #WS_CHILDWINDOW | #ES_AUTOHSCROLL |#ES_AUTOVSCROLL | #ES_MULTILINE | #ES_WANTRETURN |#ES_NOHIDESEL,50,50,300,300,WindowID(0),200,GetModuleHandle_(0),0)
CreateWindowEx_(#WS_EX_CLIENTEDGE,"EDIT","", #WS_VISIBLE | #WS_CHILDWINDOW | #WS_HSCROLL|#WS_VSCROLL| #ES_MULTILINE | #ES_WANTRETURN |#ES_NOHIDESEL,50,50,300,300,WindowID(0),200,GetModuleHandle_(0),0)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
Check both types
Have a good day
Egypt my love
Re: A Plain-text only editorGadget?
You need to clear the text first - even though the control looks empty.Arctic Fox wrote:Alternatively you can play with #EM_SETTEXTMODE and #TM_PLAINTEXT (though I can't make it work)
Code: Select all
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
hWnd = EditorGadget(0, 8, 8, 306, 133)
SetGadgetText(0, "")
SendMessage_(hWnd, #EM_SETTEXTMODE, #TM_PLAINTEXT, 0)
For a = 0 To 5
AddGadgetItem(0, a, "Line "+Str(a))
Next
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: A Plain-text only editorGadget?
Okay, now I understand 
Thanks for clarifying this, srod.

Thanks for clarifying this, srod.
Re: A Plain-text only editorGadget?
So many nice options to choose from.
Thanks to you both.
cheers
Thanks to you both.

cheers
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: A Plain-text only editorGadget?
Have you not tried Scintilla?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Re: A Plain-text only editorGadget?
Not so far. I'm already in way over my headDoubleDutch wrote:Have you not tried Scintilla?

But someday...
cheers
Re: A Plain-text only editorGadget?
Scintilla is nice (if a bit quirky!
) I have just started using it myself and once you get used to it's api, it is really quite easy to use. I am about to release a wrapper which includes a fully customisable styling / code-folding lexer which you'd be welcome to use. Will probably release today.

I may look like a mule, but I'm not a complete ass.
Re: A Plain-text only editorGadget?
Hello,
I suppose, these 2 little functions are useful for you:
http://www.purebasic.fr/german/viewtopi ... =8&t=21039
Best wishes
Hyper
I suppose, these 2 little functions are useful for you:
http://www.purebasic.fr/german/viewtopi ... =8&t=21039
Best wishes
Hyper
Re: A Plain-text only editorGadget?
Pardon my ignorance, I thought that the editor gadget was just the multiline stringgadget.
If it's the rtf field in windows, what is it in the other operating systems?
If it's the rtf field in windows, what is it in the other operating systems?
Re: A Plain-text only editorGadget?
The editorGadget, at least under windows, is reasonably complete rtf capable (I'm not sure of the exact RTF specs).
cheers
cheers
Re: A Plain-text only editorGadget?
I have a problem with this code,unable to scroll down the page at the return, is it possible to do something?
Code: Select all
Texte.s="1"+Chr(13)+"2"+Chr(13)+"3"+Chr(13)+"4"+Chr(13)+"5"+Chr(13)+"6"+Chr(13)+"7"+Chr(13)
If OpenWindow(0, 0, 0, 300, 120, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
hWnd = EditorGadget(0, 10, 10, 280, 100)
SetGadgetText(0, "")
SendMessage_(hWnd, #EM_SETTEXTMODE, #TM_PLAINTEXT, 0)
SetGadgetText(0,Texte)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf