Page 9 of 11

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 04 Feb 2018, 09:35
by moefr01
thx just me for this awesome class... :clap:
hope DigiDon will continue that project properly to answer extraordinary questions from the community.
So, here's my first one:
Starting your GUI, I paste a WordPad/Word-table via clipboard successfully. Resizing the table-cells works fine, but is there any possibility to merge/unmerge cells (like Word does)???

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 05 Feb 2018, 05:27
by DigiDon
Hello moefr01
Yes I have made advancements on the mentioned improvements
See RichEdit : New Features to All
so I will be creating a new topic with improved class in the following days.

About tables I was wondering too.
The thing is it seems table manipulation will be extremely complicated to rely on RichEdit capabilities.

The biggest improvement I've made is that the RichEdit class will supports all OLE objects meaning you can import any file in a note and edit it in the appropriate program.
I think the better approch is to embed tables and work on them from Excel which is great at what it does.

See This preview
The only bad point for now is I have been unable to show the preview of the table as in this example direclty by dragging an excel file.
When I inserted with Word and then displayed it in AHK it was working fine though so I will try to investigate later why.
Edit: Might be some info here : REOleCb.cpp

The rest of this post will be used for reference

Important point is that a lot of features and capabilities depend on the version of the RichEdit control you are using.
As this class is intended to work for most people it will concentrate on the RichEdit 4.1 version which is shipped with Windows 7.
Newer versions of window ships with newer version of the controls especially with newer version of office dll that you could use.
A list I have found here : RichEdit versions
The latest version being RichEdit 8.0 which apparently have new methods for tables RichEdit 8.0 TOM Table Interfaces and other improvements

It seems ITextRow interface can also manipulate tables in some ways.
I think RichEdit 4.1 has some table capabilites referenced here.

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 08 Feb 2018, 12:34
by moefr01
Due to the fact that I'm terribly short of time... found another work-around for inserting tables: insert a rtf-file with predefined tables out of word and linked with a button/shortcut in the GUI.
...works fine!
I'm curious about DigiDon's further devs :) :?:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 09 Feb 2018, 08:56
by DigiDon
Hi moefr01,

Not sure what you mean by "out of word" and "linked with a button".
Could you elaborate?
What are you trying to achieve?

Anyway I have investigated a bit more tables.
There are no code implementation of an Insert Column function that I could find, which is really a pitty...

But I've figured out how you can insert an RFT table of x rows and y columns programmaticaly.
The problem is as I said I found no way of inserting a new column afterwards, not even speaking of merging cells.
You can nevertheless add new rows with the TAB key.
Image

Code: Select all

RN_InsertTable:
;3 columns, 4 rows, 3 centimeters of cell width 
RN_InsertRTFTable(RE2,3,4,3)
return

RN_InsertRTFTable(REObj,P_Cols,P_Rows,P_WidthCM) {
global
local rtfTable,WidthTwips
WidthTwips:=Round(P_WidthCM/2.54*1440)
	rtfTable := "{\rtf1\par"
	loop % P_Rows
		{
		rtfTable .= "\trowd\trgaph30"
		loop % P_Cols
		rtfTable .= "\cellx" WidthTwips * A_Index
		loop % P_Cols
			{
			rtfTable .= "\pard\intbl "
			rtfTable .= "\cell"
			}
		rtfTable .= "\row"
		}
	rtfTable .= "\par}"
	REObj.SetText(rtfTable,["SELECTION"])
}
More interestingly, I have prototyped a way you can create an Excel table of x rows and y columns that will be embedded into the RichEdit.
So the content is displayed directly, and on double-clic you can edit the table in Excel and the preview will be updated.
Image
In case anyone's is interested here is how the code looks like:

Code: Select all

RN_InsertTable:
	;Creates a new excel temp file in the background using COM
	xl:=ComObjCreate("Excel.Application"),xl.Visible:=false
	wb:=xl.Workbooks.Add()
	;Number of columns and rows (which can come as function parameters of course)
	ColumnNumber:=4
	RowNumber:=3
	;Populate the cells top and left so that it RichEdit will display the desired table
	loop % ColumnNumber
		{
		AA_Index:=A_Index
		xl.Cells(1,A_Index).Value := "Column"
		}
	loop % RowNumber
	xl.Cells(A_Index,1).Value := "Rows"
	wb.SaveAs(A_ScriptDir "\TempTable.xlsx")
	wb.Close()
	xl.Quit()
	;INSERT AS OLE OBJECT (not yet implemented officially in the class)
	RN_InsertObject(RE2.HWND, A_ScriptDir "\TempTable.xlsx")
	;DELETE the temp file: we don't need it anymore because it was embbeded
	FileDelete, % A_ScriptDir "\TempTable.xlsx"
return

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 09 Feb 2018, 15:52
by moefr01
DigiDon... sorry for misunderstanding, here is the explanation:
First I created a new rtf-file with inserted tables (<clipboard<Word), saved it locally and at least used the function FileInsert of Poor Man‘s Rich Edit for that tables.rtf, added a button for further use. ;)

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 10 Feb 2018, 11:50
by DigiDon
Haa, interesting ! ;)

But now you can use my function above to have the number of columns and row you want directly.

You can put two inputbox to ask for value for example or directly use the interface I plan to introduce:
[GUI] Grid selection GUI

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 12 Feb 2018, 18:00
by DigiDon
Hi,

There are still room for improvement to understand and implement clearly the OLE features of Rich Edit into the class and the sample,.
Therefore there are some delays before a proper release.

Nevertheless, for those who would like to start right away I think it is good to release the major part of what was achieved recently.

It is now possible to embed any document into the Rich Edit control

Thanks to the OLE callback interface implementation done by just me and myself.

Many thanks to just me for all the help, work and knowledge you have brought/are still bringing.

Code: Select all

;=========================================
; Name:     	  RichEdit OleCallback
; Namespace:      RichEdit
; Authors:        just me & DigiDon
; Description:    IRichEditOleCallback interface AHK implementation for the RichEdit control
;=========================================
;
;=========================================
;RE_SetOleCallback
;Need to call this function just after creation of the RichEdit control
;HRE - Handle of the RichEdit Control
;ex: RE_SetOleCallback(RE2.HWND)
;Specify your contextmenu in IREOleCB_GetContextMenu() if you have one because it won't be called otherwise
;and disable existing dropfiles special GUI label for the RichEdit Control
;Then you can start dragging and dropping any document into the RichEdit field.
;=========================================
RE_SetOleCallback(HRE) {
   ; EM_SETOLECALLBACK = 0x0446
   SendMessage, 0x0446 , 0, % IREOleCB_Create() , , ahk_id %HRE%
   If (ErrorLevel = "FAIL") || (ErrorLevel = 0) {
      MsgBox, 16, %A_ThisFunc%, ERROR: %ErrorLevel%!
      Return False
   }
   Return True
}
; ================================================================================================================================
; IRichEditOleCallback -> msdn.microsoft.com/en-us/library/windows/desktop/bb774308(v=vs.85).aspx
; ================================================================================================================================
IREOleCB_Create() {
   Static VTBL := [RegisterCallback("IREOleCB_QueryInterface")
                 , RegisterCallback("IREOleCB_AddRef")
                 , RegisterCallback("IREOleCB_Release")
                 , RegisterCallback("IREOleCB_GetNewStorage")
                 , RegisterCallback("IREOleCB_GetInPlaceContext")
                 , RegisterCallback("IREOleCB_ShowContainerUI")
                 , RegisterCallback("IREOleCB_QueryInsertObject")
                 , RegisterCallback("IREOleCB_DeleteObject")
                 , RegisterCallback("IREOleCB_QueryAcceptData")
                 , RegisterCallback("IREOleCB_ContextSensitiveHelp")
                 , RegisterCallback("IREOleCB_GetClipboardData")
                 , RegisterCallback("IREOleCB_GetDragDropEffect")
                 , RegisterCallback("IREOleCB_GetContextMenu")]
   Static HeapSize := A_PtrSize * 20 ; VTBL pointer + 13 method pointers + 4 unused pointers + reference count + HEAP handle
   Static HeapOffset := A_PtrSize * 19 ; offset to store the heap handle within the heap
   Heap := DllCall("HeapCreate", "UInt", 0x05, "Ptr", 0, "Ptr", 0, "UPtr")
   IREOleCB := DllCall("HeapAlloc", "Ptr", Heap, "UInt", 0x08, "Ptr", HeapSize, "UPtr")
   Addr := IREOleCB
   Addr := NumPut(Addr + A_PtrSize, Addr + 0, "UPtr")
   For Each, CB In VTBL
      Addr := NumPut(CB, Addr + 0, "UPtr")
   NumPut(Heap, IREOleCB + HeapOffset, "UPtr")
   Return IREOleCB
}
; --------------------------------------------------------------------------------------------------------------------------------
; IUnknown::QueryInterface
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_QueryInterface(IREOleCB, REFIID, ByRef IFPtr) {
   OutputDebug, %A_ThisFunc%
   Return 0 ; S_OK
}
; --------------------------------------------------------------------------------------------------------------------------------
; IUnknown::AddRef
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_AddRef(IREOleCB) {
   Static RefOffset := A_PtrSize * 18
   OutputDebug, %A_ThisFunc%
   NumPut(RefCount := NumGet(IREOleCB + RefOffset, "UInt") + 1, IREOleCB + RefOffset, "UInt")
   Return RefCount
}
; --------------------------------------------------------------------------------------------------------------------------------
; IUnknown::Release
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_Release(IREOleCB) {
   Static RefOffset := A_PtrSize * 18
        , HeapOffset := A_PtrSize * 19
   OutputDebug, %A_ThisFunc%
   NumPut(RefCount := NumGet(IREOleCB + RefOffset, "UInt") - 1, IREOleCB + RefOffset, "UInt")
   If (RefCount = 0) {
      Heap := NumGet(IREOleCB + HeapOffset, "UPtr")
      DllCall("HeapDestroy", "Ptr", Heap)
   }
   Return RefCount
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::GetNewStorage
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_GetNewStorage(IREOleCB, IStoragePtr) {
   OutputDebug, %A_ThisFunc%
   ; msdn.microsoft.com/en-us/library/windows/desktop/aa378977(v=vs.85).aspx
	If !(HR := DllCall("Ole32.dll\CreateILockBytesOnHGlobal", "Ptr", 0, "Int", 1, "PtrP", ILockBytes)) {
      ; msdn.microsoft.com/en-us/library/windows/desktop/aa380324(v=vs.85).aspx
      ; STGM_READWRITE = 0x02, STGM_SHARE_EXCLUSIVE = 0x10, STGM_CREATE = 0x1000
   	If (HR := DllCall("Ole32.dll\StgCreateDocfileOnILockBytes", "Ptr", ILockBytes, "UInt", 0x1012, "UInt", 0, "PtrP", IStorage))
         ObjRelease(ILockBytes)
      Else
         NumPut(IStorage, IStoragePtr + 0, "UPtr")
   }
   Return HR
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::GetInPlaceContext - not implemented
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_GetInPlaceContext(IREOleCB, Frame, Doc, FrameInfo) {
   OutputDebug, %A_ThisFunc%
   Return 0x80004001 ; E_NOTIMPL
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::ShowContainerUI - not implemented
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_ShowContainerUI(IREOleCB, Show) {
   OutputDebug, %A_ThisFunc%
   Return 0x80004001 ; E_NOTIMPL
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::QueryInsertObject - returns S_OK
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_QueryInsertObject(IREOleCB, CLSID, STG, CP) {
   OutputDebug, %A_ThisFunc%
   Return 0 ; S_OK
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::DeleteObject - returns S_OK
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_DeleteObject(IREOleCB, OleObj) {
   OutputDebug, %A_ThisFunc%
   Return 0 ; S_OK
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::QueryAcceptData - returns S_OK
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_QueryAcceptData(IREOleCB, DataObj, Format, Operation, Really, MetaPic) {
   OutputDebug, %A_ThisFunc%
   Return 0 ; S_OK
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::ContextSensitiveHelp - not implemented
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_ContextSensitiveHelp(IREOleCB, EnterMode) {
   OutputDebug, %A_ThisFunc%
   Return 0x80004001 ; E_NOTIMPL
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::GetClipboardData - not implemented
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_GetClipboardData(IREOleCB, CharRange, Operation, DataObj) {
   OutputDebug, %A_ThisFunc%
   Return 0x80004001 ; E_NOTIMPL
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::GetDragDropEffect - returns S_OK
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_GetDragDropEffect(IREOleCB, Drag, KeyState, Effect) {
   OutputDebug, %A_ThisFunc%
   Return 0 ; S_OK
}
; --------------------------------------------------------------------------------------------------------------------------------
; IRichEditOleCallback::GetContextMenu - not implemented
; --------------------------------------------------------------------------------------------------------------------------------
IREOleCB_GetContextMenu(IREOleCB, SelType, OleObj, CharRange, HMENU) {
	;PUT YOUR  CONTEXT MNU HERE
	;Menu, RN_ContextMenu, Show
   ; OutputDebug, %A_ThisFunc%
   Return 0x80004001 ; E_NOTIMPL
}
Enjoy! ;)

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 13 Feb 2018, 04:32
by moefr01
DigiDon wrote:Haa, interesting ! ;)

But now you can use my function above to have the number of columns and row you want directly.

You can put two inputbox to ask for value for example or directly use the interface I plan to introduce:
[GUI] Grid selection GUI
thanks DigiDon... your hint works fine. ;)
Found out that the frame (visible in rtf) of an inserted table is invisible in a converted pdf-file... in contrary to my clipboard-pasting. Looks :ugeek: fine!

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 13 Feb 2018, 05:33
by DigiDon
moefr01 wrote: Found out that the frame (visible in rtf) of an inserted table is invisible in a converted pdf-file... in contrary to my clipboard-pasting. Looks :ugeek: fine!
Right, I figured this out as well. I've finally managed to add proper borders.
Was not simple because the code from a Word table is quite awfully complicated and RTF syntax for table is... erf!

Anyway here is an improved version that will display table borders well in other programs (at least it should. Works in Word):

Code: Select all

RN_InsertRTFTable(REObj,P_Cols,P_Rows,P_WidthPx) {
global
local rtfTable
; WidthTwips:=Round(P_WidthCM/2.54*1440)
WidthTwips:=Round(P_WidthPx/A_ScreenDPI*1440)
	rtfTable := "{\rtf1\par"
	loop % P_Rows
		{
		rtfTable .= "\trowd\trgaph144"
		loop % P_Cols {
			rtfTable .= "\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 "
			rtfTable .= "\cellx" WidthTwips * A_Index
			}
		rtfTable .= "\pard\intbl "
		loop % P_Cols
			{
			rtfTable .= "\cell"
			}
		rtfTable .= "\row"
		}
	rtfTable .= "\par}"
	; msgbox % rtfTable
	REObj.SetText(rtfTable,["SELECTION"])
}
Notice that I changed from WidthCm (centimeters) to Pixels.

Right now I'm calling it this way so the total width of the table is (such as in Word) always approximately equals to a page width.

Code: Select all

RN_InsertRTFTable(RE2,GridGUICols,GridGUIRows,786/GridGUICols)

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 13 Feb 2018, 08:25
by burque505
@DigiDon, @just me, thank for this class and your continued work on it.
Regards,
burque505

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 24 Aug 2018, 03:25
by truekefir
Hi!

Is there any better way to insert formatted text into table other than adding it manually like I did in this script?

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
Menu Tray, Icon, shell32.dll, 190
#include Class_RichEdit.ahk


appname := "richtextthing"
Gui +Resize +LastFound +hwnd%appname%


Gui Add, Button, x1 y1 w80 h23 gDrawTable, DrawTable
Gui Add, Button, x1 y24 w80 h23 gSaveFile, Save
MyRichEdit := new richedit(%appname%,"x81 y1 w736 h575")
MyRichEdit.SetBkgndColor("0x242424")
MyRichEdit.SetDefaultFont({Name: "Courier New", Color: "0xffffff", Size: "8", Style: "B"})
MyRichEdit.SetParaSpacing({Before: "1", After: "1"})
MyRichEdit.ShowScrollBar(0, False)

Gui Show, x1 y1 w800 h600, % appname
Return

DrawTable:
    P_Cols:=2
    P_Rows:=1
	rtfTable := "{\rtf1 {\colortbl `;\red36\green36\blue36;\red51\green246\blue255;\red212\green51\blue255;\red0\green88\blue166;\red148\green0\blue2;\red149\green149\blue149;\red36\green36\blue36;\red255\green255\blue255;}"
	loop % P_Rows
		{
		rtfTable .= "\trowd\trgaph30"
		loop % P_Cols
            {
            rtfTable .= "\clbrdrt\brdrw1\brdrcf1\clbrdrb\brdrw1\brdrcf1\clbrdrl\brdrw1\brdrcf1\clbrdrr\brdrw1\brdrcf1"
            WidthTwips:=Round(4/2.54*1440)+Round(14/2.54*1440)*(A_Index-1)
            rtfTable .= "\cellx" WidthTwips
            }
		loop % P_Cols
			{
            rtfTable .= "\pard\intbl "
            if (A_Index = 1)
                {
                random, lines, 2,3
                fontsize:=round(48/lines)
                rtfTable .= "\qr\fs" . fontsize
                loop % lines
                    {
                    random, underline, 0,1
                    if Underline
                        rtfTable .="\ul"
                    rtfTable .= "\cf" . A_index+1
                    rtfTable .= "Cell 1 Line " A_index
                    if Underline
                        rtfTable .= "\ulnone"
                    rtfTable .= "\par "
                    }
                rtfTable:=SubStr(rtfTable, 1, -5)
                }
            else 
                {
                rtfTable .= "\fs48\cf" . 5
                text:=" Cell " . A_Index . " Cell " . A_Index . " Word " . A_Index . " 1"
                Loop, Parse, text, %A_Space%
                    {
                    if (A_Loopfield = "Cell")
                        {
                        rtfTable .= "\highlight4\fs36 "
                        rtfTable .= A_Loopfield
                        rtfTable .= "\highlight0\fs48 "
                        rtfTable .= " "
                        }
                     else if (A_Loopfield = "2")
                        {
                        rtfTable .= "\highlight6\cf8 "
                        rtfTable .= " " . A_Loopfield . " "
                        rtfTable .= "\highlight0\cf5 "
                        rtfTable .= " "
                        }
                     Else
                        {
                        rtfTable .="\ul "
                        rtfTable .= A_Loopfield
                        rtfTable .= "\ulnone"
                        rtfTable .= "  "
                        }
                    }
                rtfTable := SubStr(rtfTable, 1, -1)
                }
			rtfTable .= "\cell"
			}
		rtfTable .= "\row"
		}
	rtfTable .= "}"
	MyRichEdit.SetText(rtfTable,["SELECTION"])
      MyRichEdit.SetFont({Color: "0x959595", Size: "4", Style: "B"})
   MyRichEdit.SetText("`n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------`n", ["SELECTION"])
return

SaveFile:
    MyRichEdit.SaveFile("tabletest " . A_Now . ".rtf" )
return

GuiEscape:
GuiClose:
    ExitApp
    

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 18 Sep 2018, 14:19
by truekefir
probably worthy addition to library? Hope I did it right
both together allowing to select line containing caret for future use, copy, clear, duplicate, move between controls, etc.

Code: Select all

   
GetCaretLineIndex() { ; Get index of the line containing the caret
	; EM_LINEINDEX = 0xBB
	SendMessage, 0xBB, -1, 0, , % "ahk_id " . This.HWND
	Return ErrorLevel
}
   
GetCaretLineLength() { ; Get length of the line containing the caret
	; EM_LINEINDEX = 0xBB, EM_LINELENGTH = 0xC1
	SendMessage, 0xBB, -1, 0, , % "ahk_id " . This.HWND
	SendMessage, 0xC1, %ErrorLevel%, 0, , % "ahk_id " . This.HWND
	Return ErrorLevel
}

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 12 Dec 2018, 11:27
by JnLlnd
This RichEdit class is great. Thanks for this just me and others who built on it.

But it would be even greater if we could paste HTML content to it and keep the rich format? This would suppose the control would detect that the clipboard contains the HTML format but no RTF and would convert the HTML to RTF.

Maybe this could be done by using other classes or tools. I looked at the WinClip class. It helps seeing what is in the clipboard but would not help converting its content.

The only way I found to do it is to copy from a web page, paste to Word and then copy from Word and paste to the RichText control. In addition to the HTML format, Word is adding the content converted to RTF. But Word is doing that in a very verbose way, adding lots of code.

This would be great if all this could be put together in one control. Any idea or leads on other approaches?

Jean

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 12 Dec 2018, 17:07
by burque505
Hello Jean,
I'm looking at this page and this page to see if there's anything I can filch - maybe build a DLL, or a modified console app like the one proposed in the first page. I'll post if I have any luck.
Regards,
burque505

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 12 Dec 2018, 17:13
by JnLlnd
burque505 wrote:
12 Dec 2018, 17:07
Hello Jean,
I'm looking at this page and this page to see if there's anything I can filch - maybe build a DLL, or a modified console app like the one proposed in the first page. I'll post if I have any luck.
Regards,
burque505
Interesting. This is beyond my own coding capabilities but it would be great if you could work on it :-)

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 12 Dec 2018, 17:44
by burque505
:) It's probably beyond my capabilities too, but I'm going to give it a shot.
Regards,
burque505

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 24 Jan 2019, 03:57
by Xtra
Hi JustMe,
Thanks for creating this! :clap:

FindText() doesnt return true if the text was found.
The last line should be:
Return true :thumbup:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 24 Jan 2019, 11:44
by burque505
@Xtra, FindText is working for me, but it does need tweaking.
The problem is that the caret may end up at the bottom of the text, and if so, the FindText(RE) dialog is going to report it didn't find it.
But change the direction to "Up" and it should find it if it's there.
What is lacking is a dialog asking whether the user wants to start from the beginning of the document again, as in Word.
For now, in my own version I just changed the Find dialog to this:

Code: Select all

Find:
Send, ^{HOME}
RichEditDlgs.FindText(RE2)
Return
I'm going to post another update to my own version in the next day or so - I'll try to get a dialog in there to ask if the user wants to start over, if time permits.
Regards,
burque505

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 24 Jan 2019, 12:46
by Xtra
burque505 wrote:
24 Jan 2019, 11:44
But you are not checking if it was found lol. :?:
Also default is search up not down. Set the caret position before searching and it works as intended.

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Posted: 24 Jan 2019, 13:18
by burque505
I don't know what version you are using.
It should be clear from the code I just posted above that I am, in fact, setting the caret position before searching (Send, ^{HOME})
See below. (This isn't posted yet, though). Default search is Down, not Up.
RE 2019.gif
RE 2019.gif (300.51 KiB) Viewed 5922 times