toolWindow alignment

6 posts, 0 answers
  1. Terry
    Terry avatar
    14 posts
    Member since:
    Feb 2018

    Posted 21 Aug 2018 Link to this post

    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

     

  2. Dimitar
    Admin
    Dimitar avatar
    2903 posts

    Posted 22 Aug 2018 Link to this post

    Hello Terry,

    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
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Terry
    Terry avatar
    14 posts
    Member since:
    Feb 2018

    Posted 24 Aug 2018 in reply to Dimitar Link to this post

    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

  4. Dimitar
    Admin
    Dimitar avatar
    2903 posts

    Posted 24 Aug 2018 Link to this post

    Hi Terry,

    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
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Terry
    Terry avatar
    14 posts
    Member since:
    Feb 2018

    Posted 27 Aug 2018 in reply to Dimitar Link to this post

    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.

  6. Dimitar
    Admin
    Dimitar avatar
    2903 posts

    Posted 28 Aug 2018 Link to this post

    Hi Terry,

    Thank you for sharing this. Do not hesitate to contact us if you have other questions.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top