How do I align the text in the header of a ToolWindow - See attached image
I tried following the steps here https://www.telerik.com/forums/problem-by-raddock-a8623cc5b85c but I am not getting the same results.
Note that I am using Telerik with Progress for .NET
Thanks
5 Answers, 1 is accepted
The following code shows how you can set the text alignment:
var textElement = ((ToolTabStrip)
this
.toolWindow1.TabStrip).CaptionElement.FindDescendant<TextPrimitive>();
if
(textElement !=
null
)
{
textElement.TextAlignment = ContentAlignment.MiddleCenter;
}
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Thanks Dimitar,
I am developing our code using the Progress ABL, and unfortunately generics are not supported in the ABL. (https://knowledgebase.progress.com/articles/Article/000057503?q=generics&l=en_US&fs=Search&pn=1)
Is it possible to provide sample code that does not use generics?
Thanks
You can directly access the text element. Here is the code:
var textElement = ((ToolTabStrip)
this
.toolWindow1.TabStrip).CaptionElement.Children[2].Children[3]
as
TextPrimitive;
if
(textElement !=
null
)
{
textElement.TextAlignment = ContentAlignment.MiddleCenter;
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Awesome! Thanks so much it worked, This is the equivalent in the Progress ABL
DEFINE VARIABLE txtElement AS Telerik.WinControls.Primitives.TextPrimitive NO-UNDO.
txtElement = CAST(CAST(THIS-OBJECT:twHistory:TabStrip, ToolTabStrip):CaptionElement:Children[2]:Children[3], Telerik.WinControls.Primitives.TextPrimitive).
if VALID-OBJECT(txtElement) THEN
txtElement:TextAlignment = Telerik.WinControls.ContentAlignment:MiddleCenter.
Thank you for sharing this. Do not hesitate to contact us if you have other questions.
Regards,
Dimitar
Progress Telerik