Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

LMDRichEdit TLMDSelectionType

hello how to use LMDRichEdit.SelectionType

stText Text
stObject At least one OLE object
stMultiChar More than one character of text
stMultiObject More than one OLE object

THANKS

Comments

  • 4 Comments sorted by Votes Date Added
  • Your question is too general. This is one of the properties, which describes rich edit current state. An application can use it to show/hide or enable/disable some actions or menu items, for example.
  • edited April 22 Posts: 15Vote Up0Vote Down
    hello, yes it is for this purpose that I would like to use this function.
    I can't use this function, how to encapsulate RichEdit.SelectionType & TLMDRichSelection.

    // TPopUpMenu OnPopup
    procedure TForm.PopUpRichPopup(Sender: TObject);
    begin
      case RichEdit.SelectionType of
        stText:
          ShowMessage('Text');
        stObject:
          ShowMessage('Object');
        stMultiChar:
          ShowMessage('MultiChar');
        stMultiObject:
          ShowMessage('MultiObject');
      end;
    end;

    or
    if RichEdit.SelectionType = TLMDRichSelection.stText then


    Thanks a lot

  • SelectionType is a set property, you can read more here:

    https://docwiki.embarcadero.com/RADStudio/Sydney/en/Structured_Types_(Delphi)#Sets

    So, several flags can be set simultaneously, and you can check for them like this:

    procedure TForm.PopUpRichPopup(Sender: TObject);
    begin
      if stText in RichEdit.SelectionType then
        ShowMessage('Text');
      if stObject in RichEdit.SelectionType then
        ShowMessage('Object');
      if stMultiChar in RichEdit.SelectionType then
        ShowMessage('MultiChar');
      if stMultiObject in RichEdit.SelectionType then
        ShowMessage('MultiObject');
    end;

    or like this:

    procedure TForm.PopUpRichPopup(Sender: TObject);
    begin
      if RichEdit.SelectionType = [stText, stObject] then
        ShowMessage('Text and object');
    end;
  • I think I found

      if RichEdit.SelectionType = [stText, stMultiChar] then
          ShowMessage('Text')
      else if RichEdit.SelectionType = [stObject] then
          ShowMessage('Object');
Sign In or Register to comment.