Recent

Author Topic: Where is TRichMemoInlinePicture?  (Read 12355 times)

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #15 on: September 21, 2021, 08:39:27 pm »
Quote
just get rid of {$R *.lfm} in rmInlinePicture.pas unit.

Yes, I found that bit, but see my subsequent posts.

Quote
are you users limited to Windows? Otherwise it won't work.

For now it's Windows-only, there are a few things that Windows seems to do better than anything else and I'm leaning heavily on one of them, I don't see an easy way to replace it.

Pictures would be dispensable but my project is visually boring and it's reaching the finishing-touches stage where I care about that.

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #16 on: September 21, 2021, 08:42:51 pm »
P.S. skalogryz, there is just one other thing I've been having difficulties with. It seems like if I change the text itself (not the rich formatting, but the actual words) programmatically, rather than the user doing it by typing, then Undo can't go back beyond that point. Is there anything I can do about this? Thanks.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Where is TRichMemoInlinePicture?
« Reply #17 on: September 21, 2021, 09:48:14 pm »
Is there anything I can do about this?
do you need to be able to undo programmatic changes?

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.
I did try your example and it works for me.
Code: Pascal  [Select][+][-]
  1. var
  2.   rm :  TRichMemoInlinePicture;
  3.   sz : TSize;
  4. begin
  5.   rm:=TRichMemoInlinePicture.Create(Image1.Picture);
  6.   sz.cx:=64; sz.cy:=64;
  7.   RichMemo1.InDelInline(rm, 0,0, sz);
  8.  
« Last Edit: September 21, 2021, 09:53:18 pm by skalogryz »

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Where is TRichMemoInlinePicture?
« Reply #18 on: September 21, 2021, 11:35:48 pm »
Hey Skalogryz,

I did try your example and it works for me.
Code: Pascal  [Select][+][-]
  1. var
  2.   rm :  TRichMemoInlinePicture;
  3.   sz : TSize;
  4. begin
  5.   rm:=TRichMemoInlinePicture.Create(Image1.Picture);
  6.   sz.cx:=64; sz.cy:=64;
  7.   RichMemo1.InDelInline(rm, 0,0, sz);
  8.  

Is TRichMemoInlinePicture present in the version that OPM lists, or is it only present in your GitHub(Is it on GH or somewhere else, my memory fails me ATM) version of the TRichMemo?

Cuz I've done a grep -i --include=*.{pas,pp,inc} --recursive TRichMemoInlinePicture . on the folder that OPM downloads and I found nothing.

Sorry to insist on this subject.

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Where is TRichMemoInlinePicture?
« Reply #19 on: September 22, 2021, 02:01:05 am »
Cuz I've done a grep -i --include=*.{pas,pp,inc} --recursive TRichMemoInlinePicture . on the folder that OPM downloads and I found nothing.
TRichMemoInlinePicture is not a part of richmemo package. This is a class created by Spoonhorse, inheriting from TRichMemoInline.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1090
  • Professional amateur ;-P
Re: Where is TRichMemoInlinePicture?
« Reply #20 on: September 22, 2021, 02:11:11 am »
Hey Skalogryz,

TRichMemoInlinePicture is not a part of richmemo package. This is a class created by Spoonhorse, inheriting from TRichMemoInline.

OOOOPPPPSSS !!!!  :-[

I just now had a look at the first post and he lists the code for it LOL!!!!!

Ok, now I'm baffled at the subject of this thread!!
Why name it Where is TRichMemoInlinePicture? when you then post the code on the message?

Me dumb-dumb !!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #21 on: September 22, 2021, 05:15:47 am »
I named it that because it expects such a thing to exist but I had to roll my own.

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #22 on: September 22, 2021, 05:21:18 am »
skalogryz, I do rather need to undo programmatic changes, yes. Otherwise anything like autocorrect or autocomplete or whatever will mess things up, the user won't be able to delete past those. It would be silly for me to have to write another Undo routine on top of your code when there's already one in there.

Maybe there's something wrong with how I'm using the image insertion code, I'll try it again in a simpler environment, and with different images, etc, see if I can find where I'm going wrong. Thanks.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Where is TRichMemoInlinePicture?
« Reply #23 on: September 22, 2021, 07:34:24 am »
It seems like if I change the text itself (not the rich formatting, but the actual words) programmatically, rather than the user doing it by typing, then Undo can't go back beyond that point. Is there anything I can do about this?
How are you changing the text?  (RichMemo1.Text := NewVersionOfText;?)
Try to use InDelText method, see if it makes any difference on the Undo behavior.
...
and you need to use the latest version for github.
« Last Edit: September 22, 2021, 08:06:59 am by skalogryz »

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #24 on: September 22, 2021, 08:26:37 am »
skalogryz, thanks, I'll try that, I didn't know about it. Up until now I've been changing SelStart and SelLength and then setting SelText, because doing it that way doesn't mess up the justification, I thought that that was the True Way.

I have got the pictures to work. You'll laugh at me, but I guess I was taking the notion of inserting the picture in the memo too literally, I thought once I'd done the insertion I should free up the TPicture and the TRichMemoInlinePicture like a tidy coder. It looks like I have to keep lists of them, one for each picture, instead.

Couple of questions. Is there any way to center the pictures? And is there any easy way to resize them once they've been inserted? (I can always just redo the memo, by "easy way" I mean not that.)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Where is TRichMemoInlinePicture?
« Reply #25 on: September 22, 2021, 08:47:01 am »
Is there any way to center the pictures?
if a picture sits on its own paragraph you should be able to change the paragraph alignment to center.
There's no option for the text overflow the picture. (the just like you can see in MSWord)

And is there any easy way to resize them once they've been inserted? (I can always just redo the memo, by "easy way" I mean not that.)
no, there's no way to do that.

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #26 on: September 22, 2021, 08:52:43 am »
Is this the right version? https://github.com/cutec-chris/richmemo

If so, I may have the wrong one, the thing I installed had a readme file but not a gitignore and this is the other way round.

Thanks.

P.S: Using the InDelText method didn't fix the Undo thing on the version I have.
« Last Edit: September 22, 2021, 09:01:03 am by Spoonhorse »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Where is TRichMemoInlinePicture?
« Reply #27 on: September 22, 2021, 09:01:10 am »
« Last Edit: September 22, 2021, 10:27:43 am by skalogryz »

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #28 on: September 22, 2021, 01:21:10 pm »
Thank you!

I've got the pictures working fine, but I'm concerned about memory leakage, because it doesn't like me freeing up the TPictures and TRichMemoInlinePictures even after I've cleared the TRichMemo. Can you tell me what's going on?

Thank you for all your help. It's a magnificent app now and it owes all its good looks to TRichMemo.

Spoonhorse

  • Full Member
  • ***
  • Posts: 123
Re: Where is TRichMemoInlinePicture?
« Reply #29 on: September 22, 2021, 02:54:53 pm »
skalogryz, you made that change 'cos I needed it?!?  :o First, I am very very grateful, and second it doesn't seem to work, I still can't undo past an InDelText, and also now when I press Ctrl + Z it undoes absolutely everything until it hits that wall, instead of Undo-ing things a bit at a time.

 

TinyPortal © 2005-2018