A Plain-text only editorGadget?
Re: A Plain-text only editorGadget?
As written, All the items fit in the window. No scoll necessary.
You're ending with a chr(13) which creates a carriage return at the end of the text.
Seems to work fine.
cheers
You're ending with a chr(13) which creates a carriage return at the end of the text.
Seems to work fine.
cheers
Re: A Plain-text only editorGadget?
Hello,
you never see the last line if it is empty, and impossible to scroll to the end.
you do not have this problem?
you never see the last line if it is empty, and impossible to scroll to the end.
you do not have this problem?
Re: A Plain-text only editorGadget?
Hi
Or
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, "")
SetGadgetText(0,Texte)
SendMessage_(hWnd, #EM_SETTEXTMODE, #TM_PLAINTEXT, 0)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
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)
SendMessage_(hWnd, #EM_SETTEXTMODE, #TM_PLAINTEXT, 0)
SetGadgetText(0, "")
SetGadgetText(0,Texte)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Egypt my love
Re: A Plain-text only editorGadget?
SendMessage_ (hWnd, EM_SETTEXTMODE #, # TM_PLAINTEXT, 0) does not work in the examples you give.
Indeed, it is possible to paste text in color (RTF)
We must make a SetGadgetText (0, "") just before.

Indeed, it is possible to paste text in color (RTF)
We must make a SetGadgetText (0, "") just before.

Re: A Plain-text only editorGadget?
Nico
Both the two examples are OK
Tested with PB 4.5 and XP x86 SP2 and Win 7 x86
For paste color RTF see next URL
http://www.purebasic.fr/english/viewto ... 2&t=43458
Both the two examples are OK
Tested with PB 4.5 and XP x86 SP2 and Win 7 x86
For paste color RTF see next URL
http://www.purebasic.fr/english/viewto ... 2&t=43458
Egypt my love
Re: A Plain-text only editorGadget?
Nico is correct Rashad. Your code allows for the pasting of styled text which is what the original code was there to prevent. You need to reorder the code.
I may look like a mule, but I'm not a complete ass.
Re: A Plain-text only editorGadget?
In that case we should keep Nico code as it is
Just update
To
There will be more 1 blank line but you can scroll to the end
Just update
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)
To
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(10)+Chr(13)
Egypt my love
Re: A Plain-text only editorGadget?
Yes it works but it's very annoying that scroll.
Thanks
Thanks
Re: A Plain-text only editorGadget?
Hi Nico,
I'm not exactly sure what it is you're attempting to do or what the issue is with the scroll.
Regarding plain text. I believe code has been posted which will make the editor gadget a plain text control.
Is there still some issue regarding plain text? You can set up a callback and capture any "paste" into the editor and only paste plain text yourself, as an alternative.
Regarding the scroll problem. In the Windows world, a "new line" is a CRLF or chr(13) + chr(10), whereas in Unix a chr(10) is sufficient.
Since Windows regards new line as a separator:
"There is also some confusion whether newlines terminate or separate lines. If a newline is considered a separator, there will be no newline after the last line of a file. The general convention on most systems is to add a newline even after the last line, i.e. to treat newline as a line terminator. Some programs have problems processing the last line of a file if it is not newline terminated. Conversely, programs that expect newline to be used as a separator will interpret a final newline as starting a new (empty) line." from Wikipedia.
I believe you can solve the scrolling problem by adhering to the Windows conventions for new lines - i.e. separate new lines with a CR+LF
If you wish to use LF as the separator, add a blank to the last line so it's not empty.
I haven't used a raw windows edit control enough to know if PB is handling this differently than MS but I doubt it since PB is merely employing the MS control.
Does that help at all?
cheers
I'm not exactly sure what it is you're attempting to do or what the issue is with the scroll.
Regarding plain text. I believe code has been posted which will make the editor gadget a plain text control.
Is there still some issue regarding plain text? You can set up a callback and capture any "paste" into the editor and only paste plain text yourself, as an alternative.
Regarding the scroll problem. In the Windows world, a "new line" is a CRLF or chr(13) + chr(10), whereas in Unix a chr(10) is sufficient.
Since Windows regards new line as a separator:
"There is also some confusion whether newlines terminate or separate lines. If a newline is considered a separator, there will be no newline after the last line of a file. The general convention on most systems is to add a newline even after the last line, i.e. to treat newline as a line terminator. Some programs have problems processing the last line of a file if it is not newline terminated. Conversely, programs that expect newline to be used as a separator will interpret a final newline as starting a new (empty) line." from Wikipedia.
I believe you can solve the scrolling problem by adhering to the Windows conventions for new lines - i.e. separate new lines with a CR+LF
If you wish to use LF as the separator, add a blank to the last line so it's not empty.
I haven't used a raw windows edit control enough to know if PB is handling this differently than MS but I doubt it since PB is merely employing the MS control.
Does that help at all?
cheers
Re: A Plain-text only editorGadget?
I am surprised that you did not have this problem, I decided to use a multiline stringgadget for now.
Thank you for your contribution!
Thank you for your contribution!