Hi all!
Is there a trick to make Richedit align wrap line like this?:
"list":[
{
"item": "this is the line
wrapped"
}
]
What I obtaining is:
"list":[
{
"item": "this is the line
wrapped"
}
]
Thanks in advance, HSE.
Hector, the only thing I can think of is autoindent which you have to code yourself. I have done them in editors but they are no joy to code.
It's possible with paragraph formatting, but I would have to look it up.
Quote from: hutch-- on November 01, 2022, 07:07:16 AM
the only thing I can think of is autoindent which you have to code yourself. I have done them in editors
Quote from: jj2007 on November 01, 2022, 07:15:33 AM
It's possible with paragraph formatting, but I would have to look it up.
Thanks Huth and JJ!!
Not successful yet, but I was beginning to try in that way :thumbsup:
Here is a snippet from RichMasm:
CASE PFM_STARTINDENT or PFM_RIGHTINDENT or PFM_OFFSET
mov pf2.dxOffset, eax ; twips, max 9999
mov pf2.dxRightIndent, edx ; twips
ENDSW
invoke SendMessage, hRE, EM_SETPARAFORMAT, 0, addr pf2
Excellent test JJ!
Must be obtained:\pard\fi-1980\li1980\tx0\tab"item": "this is the line wrapped"\par
Text is in first tab with position 0, but that position is displaced :biggrin:
Curiously, you send distance from right margin, but because alignament is left you have li instead of ri.
Now I have to see to make that :thumbsup:
Thanks, HSE.
Hi Hector,
I just tested a tweaked version of QE where I changed the riched to normal word wrap and the auto indent still worked correctly until you resize the window too narrow then the long lines are word wrapped in the normal manner.
I am not sure if that is what you are after but auto indent still works if the window is not too narrow,
I'm wondering two things Hector...
Is the window/rich edit control sizable or fixed size? And, are you using auto horizontal scroll? I think either or both of them could change how what you propose should be approached. Do you want to wrap on window width, or upon pressing enter? Or both/either?
Hi Hutch!!
Quote from: hutch-- on November 01, 2022, 09:12:36 AM
I just tested a tweaked version of QE where I changed the riched to normal word wrap and the auto indent still worked correctly until you resize the window too narrow then the long lines are word wrapped in the normal manner.
I have a Wrap plugin with just one line: "invoke SendMessage,hEdit,EM_SETTARGETDEVICE, 0, 0", and an UnWrap plugin with only:"invoke SendMessage,hEdit,EM_SETTARGETDEVICE, 0, 1". That work perfectly in standard QE.
Quote from: hutch-- on November 01, 2022, 09:12:36 AM
I am not sure if that is what you are after but auto indent still works if the window is not too narrow,
No. I'm trying to make something like JJ's rtf file in any RichEdit. He post a picture above. The wrapped part of the line is aligned with first part of that line.
Hi Zed!
Quote from: zedd151 on November 01, 2022, 09:25:15 AM
I'm wondering two things
I counted five. :biggrin: :biggrin:
Anyway, is only one thing. Just test JJ's rtf file above to see what must be achieved.
Thanks, HSE.
Attached a beta (use at your own risk bla bla):
- extract to a folder, then drag the rtf over the exe.
- put the cursor in front of "item"
- press Ctrl G: the Goto edit field opens
- type e.g. ind=120/200
The first value is the indent from the left, the optional second one from the right. You can size the window horizontally to see what it means for the phrase, or use different values such as 150/150 etc.
Under the hood it's EM_SETPARAFORMAT, of course. Btw PFM_BORDER won't work; it's not documented properly, but it simply won't display with any RichEdit control, including the Office versions. However, if you copy the bold
Para with
borders
paragraph and paste it into MS Word, you'll see the beauty of PFM_BORDER - Microsoft at its best :tongue:
Quote from: HSE on November 01, 2022, 10:58:08 AM
I counted five. :biggrin: :biggrin:
I thought of more as I typed. :tongue:
@jj2007, indent left and indent right? Who would have thunk? :tongue: As long as it works. :biggrin:
Quote from: HSE on November 01, 2022, 10:44:01 AM
The wrapped part of the line is aligned with first part of that line.
That sounds similar to the autoindent that qeditor uses (upon pressing ENTER) but I assume you want it to wrap automatically (without pressing ENTER)?
Quote from: jj2007 on November 01, 2022, 11:29:15 AM
Attached a beta (use at your own risk bla bla):
:thumbsup:
Quote from: jj2007 on November 01, 2022, 11:29:15 AM
The first value is the indent from the left,
Perfect. I have to see if that value can be detected with EM_POSFROMCHAR :biggrin:
Quote from: zedd151 on November 01, 2022, 12:00:49 PM
(upon pressing ENTER)
If you press ENTER then you have a new line, not wrap :biggrin:
Quote from: HSE on November 01, 2022, 11:03:59 PMI have to see if that value can be detected with EM_POSFROMCHAR :biggrin:
Good idea, I might steal it :biggrin:
Quote from: HSE on November 01, 2022, 11:03:59 PM
Perfect. I have to see if that value can be detected with EM_POSFROMCHAR :biggrin:
That message has some crazy parameters:
Quote
wParam
Rich Edit 1.0 and 3.0: A pointer to a POINTL structure that receives the client area coordinates of the character.
The coordinates are in screen units and are relative to the upper-left corner of the control's client area.
Edit controls and Rich Edit 2.0: The zero-based index of the character.
lParam
Rich Edit 1.0 and 3.0: The zero-based index of the character.
Edit controls and Rich Edit 2.0: This parameter is not used.
So I take it you're going to check which version of RichEdit you're talking to, right? What a pain in the butt.
Quote from: NoCforMe on November 02, 2022, 12:16:33 PMSo I take it you're going to check which version of RichEdit you're talking to, right? What a pain in the butt.
Indeed, it's very messy. Currently, I'm in the process of changing my editor from Ansi/Utf-8 to the Utf-16 version of the RichEdit control. The version I am using now is RichEdit
60W.
Almost 8 years ago
dpradov posted Allow the use of newer versions of RichEdit (https://github.com/dpradov/keynote-nf/issues/530):
QuoteOFFICE 2007 (12) : v6.0
C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\RICHED20.DLL
RichEdit Version 6.0
Product/file version: 12.0.6606.1000
Product name: 2007 Microsoft Office system
(+ msptls.dll)
ClassName: 'RichEdit60W'
I don't have Office 2007 installed, and I load from C:\Windows\System32\msftedit.dll
So I am a bit confused why it works on my ten year old Win7-64 machine.
Can I ask you a favour? Extract the attached files to a folder, then drag the rtf over the exe and hit F9. Tell me what you see as version info in the last line. Thanks :thup:
No Word 2007 here; I went back to Word 2000 (actually prefer it over the newer versions).
Computer is totally screwed up here; time for a completely new rig, unfortunately.
Edit = Profanity
Quote from: NoCforMe on November 02, 2022, 10:50:06 PM
No Word 2007 here; I went back to Word 2000 (actually prefer it over the newer versions).
I agree - Word 2003 here.
Thanks for the screenshot, so it works with older versions of C:\Windows\System32\msftedit.dll
My Win7 version is 21 November 2010, 04:24:01, 592,348 bytes.
You can load several "W" versions with msftedit.dll
50W has the space before problem, 20W and 60W don't (WordPad uses 50W)
50W is almost a factor 2 faster, but I hate the way it handles space before the paragraphs.
So in the end I voted for the most advanced msftedit version, which is 60W :cool:
Google phrase searches for "RichEdit70W" and "RichEdit80W" return few results. They exist but nobody uses them.
The topic pops up frequently here, see e.g. RICHEDIT diferences between RICHEDIT50W and RichEdit20A (http://masm32.com/board/index.php?topic=8678.0)
Hi all!
Take some hours :biggrin:
modify1 parse RichEdit content extracted (EM_STREAMOUT) to a buffer p1, and write to a buffer p2 that is sended (WM_SETTEXT) to same RichEdit, also need the original rtf size (the stream out, no text size) in RichEdit :
writechars macro Expression
FORC char,<&Expression>
mov byte ptr [xdi],"&char"
add xdi, 1
ENDM
endm
modify1 proc uses xsi xdi xbx p1:POINTER,p2:POINTER, tSize:POINTER
local final : POINTER
local cuenta : dword
local ini1 : dword, i : dword
local buffer[12]:CHRA
local bufsize:dword
mov cuenta , 0
mov xsi, p1
mov xax, tSize
add xax, xsi
mov final, xax
mov xdi, p2
.while xsi <= final
mov al, [xsi]
.if al == 0Ah
mov byte ptr [xdi], al
inc xdi
;inc cuenta
.repeat
inc xsi
mov al, [xsi]
.if al == " "
inc xsi
inc cuenta
.else
.if cuenta > 0
push eax
writechars \pard\fi-
add cuenta, 2
mov eax, cuenta
mov ecx, 160
mul ecx
invoke udword2decA, addr buffer, eax
invoke StrLengthA, addr buffer
dec eax
mov bufsize, eax
lea xbx, buffer
ForLp i, 0, eax, ecx
mov dl, [xbx+xcx]
mov byte ptr [xdi], dl
inc xdi
Next i
writechars \li
lea xbx, buffer
ForLp i, 0, bufsize, ecx
mov dl, [xbx+xcx]
mov byte ptr [xdi], dl
inc xdi
Next i
writechars \tx0\tab
if 0
ForLp i, 0, cuenta, ecx
mov byte ptr [xdi]," "
inc xdi
Next i
endif
pop eax
mov byte ptr [xdi], al
inc xdi
.else
mov byte ptr [xdi], al
inc xdi
.endif
mov cuenta, 0
jmp vuelve1
.endif
.until xsi > final
vuelve1:
.else
mov byte ptr [xdi], al
inc xdi
.endif
inc xsi
.endw
mov byte ptr [xdi], 0
inc xdi
ret
modify1 endp
Sorry, this became "not so Campus subject" :biggrin:
Thanks, HSE.
Quote from: jj2007 on November 02, 2022, 07:41:18 PMCurrently, I'm in the process of changing my editor from Ansi/Utf-8 to the Utf-16 version of the RichEdit control. The version I am using now is RichEdit60W.
New version released, download here (http://masm32.com/board/index.php?topic=94.0) (more (http://masm32.com/board/index.php?topic=10401.msg115554#msg115554)).