Get color of current cursor position

  • Hi,

    I'm using USEEXPRESSBARS
    Textcolor to textbackgroundcolor in the editor are changed by following procedures.

    Code
    procedure TForm1.mbBGColorChange(Sender: TObject);begin  WPRichText.Changing;  WPRichText.SelectedTextAttr.SetBGColor(mbBGColor.Color);end;procedure TForm1.mbTextColorChange(Sender: TObject);begin  WPRichText.Changing;  WPRichText.SelectedTextAttr.SetColor(mbTextColor.Color);end;

    When scrolling through the text, I want mbBGColor and mbTextColor to reflect the current color under the cursor.

    I thought of using OnChangeCursorPos event, but don't know how to get the color under the cursor and set it to the controls. Like:

    Code
    procedure TForm1.WPRichText1ChangeCursorPos(Sender: TObject);
    begin
     mbTextColor.Color := WPRichText1.SelectedTextAttr.GetColor.....???
     mbBGColor.Color   := WPRichText1.SelectedTextAttr.GetColor.....???
    end;

    Can you give me some samplecode on how to set this up?