Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search and Select the Picture inside RxRichEdit

Posted on 2004-04-16
9
Medium Priority
?
521 Views
Last Modified: 2011-09-20
I wanted to select at runtime the image inside a TRxRichEdit
How do i do this?

example:
some data
some data

[image] <-- this will be selected and replace it with something else.

some data
some data

 Thanks
0
Comment
Question by:dopors
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10849214
I dont believe that functionality exists (i.e. select an image (or aby object) at runtime).

Howevern you can test for selection type

if (stObject in SelectionType) then


SHane
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 800 total points
ID: 10850962
download a working example:                http://www.geocities.com/esoftbg/ee/Q_20957296.zip
i tested it only with this picture
emil
0
 

Author Comment

by:dopors
ID: 10855726
esoftbg: I can't download it. The link is broke.
Any body how to extract the images inside an RTF Stream. I am using RxRichEdit

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:esoftbg
ID: 10856498
The Q_20957296.zip is only 12 Kbytes.It downloads so fast and seems like the link is broke, but it isn't. I just verifyed it.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10860240
procedure TForm1.Replace_Rtf_Image(Rtf_Name: string);
var
  B:      Boolean;
  I:      Integer;
  P:      Integer;
  S:      string;
  StrList:TStringList;
begin
  B := False;
  StrList := TStringList.Create;
  try
    for I := 0 to Memo.Lines.Count-1 do
    begin
      S := Memo.Lines[I];
      P := Pos('\object\objemb{\*\objclass Paint.Picture}', S);
      if (B or (P>0)) then
      begin
        if not B then
        begin
          B := True;
          S := Copy(S, 1, P-1);
          StrList.Add(S);
        end
        else
        begin
          P := Pos('}}}\par', S);
          if (P>0) then
          begin
            B := False;
            Delete(S, P, 2);
            P := Pos('\par', S);
            if (P>0) then
              Delete(S, P, 4);
            S := S + 'Here can be inserted new text';
            StrList.Add(S);
            StrList.Add('\par');
          end;
        end;
      end
      else
        StrList.Add(Memo.Lines[I]);
    end;
  finally
    RichEdit.Clear;
    Memo.Lines.Assign(StrList);
    Memo.Lines.SaveToFile(Rtf_Name+'_.rtf');
    RichEdit.Lines.LoadFromFile(Rtf_Name+'_.rtf');
    StrList.Destroy;
  end;
end;
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11851948
Dopors:

I do not program Delphi... I had the same problem with VB.NET... I try to explain how you could do it in Delphi:

> Make a for-loop from n to the length of the box
> in the for-loop: check if this selection is an OBJECT (in stead of text)
> when this is the picture, you should be able to do a replacement

Look at the vb.net code below to see the full idea.


Succes! Daniël


--(here is the VB.NET code; there must be some sort in Delphi!)---------------------------------------------------------------------------------------------------

        Dim n As Integer
        Dim text As String

        For n = 0 To RichTextBox1.TextLength

            'Select piece by piece
            RichTextBox1.Select(n, 1)  

            'Check is this an Object
            If RichTextBox1.SelectionType = RichTextBoxSelectionTypes.Object Then

                    RichTextBox1.Cut  '<<Cut it out!

            End If

        Next
----------------------------------------------
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question