Forum > RichMemo

Where is TRichMemoInlinePicture?

(1/7) > >>

Spoonhorse:
So looking through previous discussions it seems that in order to insert a picture into a RichMemo I need to pass InDelInline a TRichMemoInlinePicture. I can't find where this is defined (You'd have thought along with RichMemo but no) but I did find some suggested code for it. I stuck it in a unit (code below) but when I told the unit to compile it complained that it couldn't open a resource file rminlinepicture.lfm. This hasn't happened to me before and I don't understand it.

What's the latest advice on getting pictures to work in a RichMemo?

Thanks.


--- 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";}};} ---unit RMInlinePicture; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, RichMemo, Graphics, Types; type   { TRichMemoInlinePicture }   TRichMemoInlinePicture = class(TRichMemoInline)    pic: TPicture;    constructor Create(Apicture: TPicture);    procedure Draw(Canvas: TCanvas; const ASize: TSize); override;  end; implementation {$R *.lfm} { TRichMemoInlinePicture }   constructor TRichMemoInlinePicture.Create(Apicture: TPicture);  begin    inherited Create;    pic:=APicture;  end;   procedure TRichMemoInlinePicture.Draw(Canvas: TCanvas; const ASize: TSize);  begin    inherited Draw(Canvas, ASize);    Canvas.Draw(0,0, pic.Graphic);  end; end.

Spoonhorse:
Well the unit was behaving like that because of the {$R *.lfm} thing that got in there somehow. I shouldn't try to debug when tired. I have some very nearly working code, will report back soon.

Spoonhorse:
Well, I still have nearly-working code. It will insert pictures into the text without complaint, but when it comes to *display* the memo it crashes with a SIGSEGV complaint. It does this even if I comment out the contents of the draw method so it doesn't do anything.

At this point I'm at a loss, does anyone know the authors? Or anyone who's successfully managed to make it work?

Since I know I can paste pictures into the text from the clipboard, there might be a way around it by essentially getting my app to do that. But it's terrible clumsy.

Gustavo 'Gus' Carreno:
Hey SpoonHorse,

This is just  suggestion from a person that has not had a look at any code from either TRichMemo or anything related, but if the component is able to do it on the paste event, I would have a look at that particular region of the code and see how it does it.

I'm sorry I can't pitch in with something more substantial, but that's how I'd go about solving this problem.

Hope this can give you another avenue of enlightenment :)

Cheers,
Gus

Spoonhorse:
Well I would but I can't figure out how. If I open up RichMemo I can find where it says procedure PasteFromClipboard; override; but there's no clue as to where the implementation is. So as far as I know it's done by magic. How does that even work?

Navigation

[0] Message Index

[#] Next page

Go to full version