TAdvRichEditor

Hi
I have a problem with the TAdvRichEditor (version 1.6.10.0).
When I set a selection of the text to bold, I'm not able to set i back to normal, its also the same with italic. I use the TAdvRichEditorButtonBar to set the font, but it is also the same when I do it using my own code.
I have a second screen in my application who works without any problems using the same components.
The problem TAdvRichEditor is placed on a TAdvOfficePage the other one who is working is put directly on a form, but that's probably not important since I tried to put the non working directly on the form, but it was of no help..
When I debug, I can see that IsSelectionBold fails, it returns false no matter what I do (in red).

function TAdvRichEditorBase.IsSelectionBold: boolean;
var
  el: TREElement;
begin
  el := Caret.Element;

  if Assigned(el) and not FDefaultChanged then
  begin
    Result := TFontStyle.fsBold in el.Font.Style;
  end
  else
    Result := TFontStyle.fsBold in GetDefaultFont.Style;
end;

Any help would be much appreciated.

I have retested this here with a TAdvRichEditor and a TAdvRichEditorFormatButtonBar but I cannot see an issue with toggling the font style here (fsBold). 
Do you have more details / sample source project / step by step info how this can be reproduced?

Sorry, there is almost no code at all, just the TAdvRichEditor +
TAdvRichEditorFormatButtonBar, that's why I can't understand why. When
the user opens the screen with the TAdvRichEditor, the editor is
readonly and the color is set to clSilver. When I set the colour to
clWhite, the background colour in the editor is still clSilver so I have
to set the bg color by doing this:
memBrevtekst.ReadOnly       := AReadOnly;
  memBrevtekst.Color          := CREAD[AReadOnly];
  memBrevtekst.SelectAll;
  memBrevtekst.SetSelectionBkColor(CREAD[AReadOnly]);
  memBrevtekst.UnSelect;

Then I fill in the text into the editor (it's txt format, not RTF) by doing this:
memBrevtekst.Clear;
memBrevtekst.AddMultiLineText(FCurrentMal.Tekst.Innhold);
FCurrentMal.Tekst.Innhold is a System.string.
In
a a second screen I use in another part of my app, I do almost the
identical, but there is no problem with the second editor, just this
one.
I know this is not easy :)

I'm sorry, but I cannot reproduce this.
Test code applied on a default TAdvRichEditor and TAdvRichEditorFormatButtonBar:


procedure TForm3.Button1Click(Sender: TObject);
begin
  AdvRichEditor1.SelectAll;
  AdvRichEditor1.SetSelectionBkColor(clwhite);
  AdvRichEditor1.UnSelect;

  AdvRichEditor1.Clear;
  AdvRichEditor1.AddMultiLineText('line 1'#13'line 2');

  AdvRichEditor1.ReadOnly := false;
  AdvRichEditor1.Color := clWhite;

end;

procedure TForm3.FormCreate(Sender: TObject);
begin
  AdvRichEditor1.Color := clSilver;
  AdvRichEditor1.AddMultiLineText('Preset text in the richeditor');
  AdvRichEditor1.ReadOnly := true;
end;

After this code, I can still toggle the bold style on text in the TAdvRichEditor.

If a problem persists, please provide some sample source app & detailed steps to enable us to reproduce the issue here

Bruno Fierens2017-05-01 18:26:47

I will create a new form and move all the components to the new form and see if it helps.

The problem was solved when I created a new form and moved the components to the new form. I also replaced the TAdvOfficepager with the standard TPageControl. No code was changed.

If a problem somehow shows up again, please provide some sample source project with which we can reproduce this here so we can investigate this.

Ok, I will.