Hello,
Searching documents and testing, no solution for these items.
On the font ribbon, how to change the drop count for the two popup menus?
How to make the richedit control transparent?
I found this:
VCL New Features in RAD Studio 11, The New RichEdit Control
The most visible new feature is TRichEdit migration to the most recent platform version, the RichEdit control 4.1 implemented by MSFTEDIT.dll. Beside a general improvement, the new controls offers features like spell checking, URL recognition, transparency, with new properties that include Transparent, EnableURLs, SpellChecking, and the new OnLinkClick event.
Does AdvRichEditor support transparency?
How to determine the total size of all the elements, the width and height in pixels required to fully render the elements?
Normally I would draw to a path, get max and min points,...
How to determine the column and line of the caret position? I want to show the values in a status bar.
Thanks,
Mark
- You'd need to loop over AdvRichEditorFontRibbonToolBar1.Controls and check for TComboBox and for these you can change the DropDownCount property.
- TAdvRichEditor is not based on any Windows control and does not have Windows dependencies like the standard TRichEdit. It is written from the ground up in VCL but it doesn't have a transparency setting.
- To expose the text size calculation, you can write code like:
type
TAdvRichEditorClass = class(TAdvRichEditor);
procedure TForm1.FormCreate(Sender: TObject);
var
sz: TSize;
begin
sz := TAdvRichEditorClass(AdvRicheditor1).GetSize(false,0)
end;
GetSize is protected in 1.8.9.17. I assume not protected in the next release?
Not decided yet. For now, you can use the method provided.
I guess I am confused.
The size will change based on what is added to the editor, no? I want to get the size after the user has added/removed/edited/etc.. and is closing the form.
And "TAdvRichEditorClass" is not defined, via searching the "TMS VCL UI Pack" directory.
What I am showing is basically the same as what is explained here:
To access a protected member in Delphi using typecasting, you can create a new type that matches the class with the protected member / method and then cast an instance of the original class to this new type. Here's a step-by-step example:
Step-by-Step Example
- Define the class with a protected member:
delphi
Copy code
type
TMyClass = class
protected
FProtectedMember: Integer;
public
constructor Create;
end;
constructor TMyClass.Create;
begin
FProtectedMember := 0; // Initial value
end;
- Define a new type with the same structure:
delphi
Copy code
type
TMyClassAccess = class(TMyClass)
public
property ProtectedMember: Integer read FProtectedMember write FProtectedMember;
end;
- Use typecasting to access the protected member:
delphi
Copy code
var
MyObject: TMyClass;
AccessObject: TMyClassAccess;
begin
MyObject := TMyClass.Create;
try
// Cast MyObject to TMyClassAccess to access the protected member
AccessObject := TMyClassAccess(MyObject);
// Now you can access the protected member
AccessObject.ProtectedMember := 10;
ShowMessage(IntToStr(AccessObject.ProtectedMember));
finally
MyObject.Free;
end;
end;
Explanation
- TMyClass: This is the original class with the protected member
FProtectedMember
.
- TMyClassAccess: This new type is derived from
TMyClass
and exposes the protected member through a public property ProtectedMember
.
- Typecasting: By casting
MyObject
(of type TMyClass
) to TMyClassAccess
, you can access the protected member as if it were public.
Key Points
- Typecasting: The line
AccessObject := TMyClassAccess(MyObject);
casts MyObject
to TMyClassAccess
, allowing you to access the protected member.
- Property Access: The property
ProtectedMember
in TMyClassAccess
provides public read and write access to the protected member FProtectedMember
.
Yeah I know how to do that. Missed the declaration when I read the original response.
This works:
for i:=0 to AdvRichEditorFontRibbonToolBar1.ControlCount - 1 do
if (AdvRichEditorFontRibbonToolBar1.Controls[i] is TAdvCustomOfficeComboBox) then
TAdvCustomOfficeComboBox(AdvRichEditorFontRibbonToolBar1.Controls[i]).DropDownCount:=64;
1 Like