Forum > RichMemo

Where is TRichMemoInlinePicture?

<< < (3/7) > >>

skalogryz:

--- Quote from: Spoonhorse on September 20, 2021, 08:57:01 am ---But ... where is the code? I am only a simple code monkey but when I write code it does something. This is just a maze. Where is the thing that does the thing?
...
Why can't I find it like the compiler does?

--- End quote ---
it's not a maze, but an amazing back bone of LCL, known as VMT-hack. It's a very old solution (back from the days when FPC didn't support interfaces), that still works.
And in fact, the compiler doesn't find the proper implementation as well.

What's happening is a run-time construction of an additional virtual class, with a mix of methods from different classes. The mix is driven by the hierarchy you're trying to search through (TWSCustomRichMemoClass -> TWSCustomMemo -> TWSCustomEdit)
However, the actual implementation is being copied over from a selected widgetset.
For Win32, you might want to search TWin32WSCustomRichMemoClass (from richmemo package), TWin32WSCustomMemo (from LCL), TWin32CustomEdit (from LCL).
(one of those should have PasteFromClipboard method)

The VMT for the virtual classes is reconstructed based on the inheritance of TWin32WSxxx classes. (the same thing is explained here)

However, once you find Win32 PasteFromClipboard you might find it pretty boring and uninteresting:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---imptype procedure TWin32WSCustomEdit.Paste(const ACustomEdit: TCustomEdit);begin  SendMessage(ACustomEdit.Handle, WM_PASTE, 0, 0)end; 
In other words, all the "fun part" of actually pasting an image into a rich edit is implemented within the system code, and is not available for the review.

Spoonhorse:
skalogryz, oh darn. Well at the very worst I could hijack the paste method, I could put whatever I want to insert on the clipboard and then send a message like that to paste it in. If I first store whatever's on the clipboard somewhere and then restore it. It's crude, but it should work.

Spoonhorse:
zoltanleo, thanks, I may have to.

Spoonhorse:
... wait, skalogryz is the author?

OK. In that case, skalogryz, instead of telling me how to peek into the class, can you just tell me how to get the InDelInline method to work so that I can delight my users? Thanks.

skalogryz:

--- Quote from: Spoonhorse on September 21, 2021, 09:39:32 am ---instead of telling me how to peek into the class, can you just tell me how to get the InDelInline method to work so that I can delight my users

--- End quote ---
are you users limited to Windows? Otherwise it won't work.


--- Quote from: Spoonhorse on September 21, 2021, 09:39:32 am ---but when I told the unit to compile it complained that it couldn't open a resource file rminlinepicture.lfm
--- End quote ---
just get rid of {$R *.lfm} in rmInlinePicture.pas unit.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version