RichTextEditor Ribbon translation behavior

4 posts, 0 answers
  1. Ralf
    Ralf avatar
    6 posts
    Member since:
    May 2012

    Posted 30 Jun 2015 Link to this post

    Hello Telerik,

    I tried to translate the control into german.

    How can I prevent the behavior, which is shown in the picture. (Wordwrap and cut off).

     

    Greetings

     

    PS: Yes, we used also font scaling.

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 01 Jul 2015 Link to this post

    Hello Ralf,

    Thank you for writing.

    What is the behavior you expect? If you turn off WordWrap, you will see just the initial part of the string? Alternatively if you increase the button width, you will have very wide buttons?

    I am looking forward to your reply.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ralf
    Ralf avatar
    6 posts
    Member since:
    May 2012

    Posted 01 Jul 2015 in reply to Stefan Link to this post

    Hello Telerik, 

    how can i set Wordwrap or Size of buttons from the table tab? It is generated dynamically when the focus is inside a table!

    Regards

    Ralf

  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 Jul 2015 Link to this post

    Hello Ralf,

    The structure of RadRibbonBar is as follows: RibbonTabs contain RadRibbonBarGroups, and RadRibbonBarGroups contain either the buttons (or other elements) or RadRibbonBarButtonGroup with contains the buttons (or other elements). So you need to iterate this structure to get the desired buttons.

    As the mentioned tabs are created dynamically, you can use the CommandTabSelected event of the control which will get triggered when a tab is selected. In it, we will have to verify whether table is currently clicked and from there which tab is selected. Here is how to do this for the Layout tab when a table is clicked:
    void richTextEditorRibbonBar1_CommandTabSelected(object sender, CommandTabEventArgs args)
    {
        if (IsTableClicked() && args.CommandTab.Text == "Layout")
        {
            foreach (RadRibbonBarGroup group in args.CommandTab.Items)
            {
                foreach (RadElement element in group.Items)
                {
                    if (element is RadButtonElement)
                    {
                        Console.WriteLine(((RadButtonElement)element).Text);
                        //((RadButtonElement)element).TextWrap
                        //((RadButtonElement)element).MinSize
                        //((RadButtonElement)element).MaxSize
                    }
                    else if (element is RadRibbonBarButtonGroup)
                    {
                        foreach (RadElement innerElement in ((RadRibbonBarButtonGroup)element).Items)
                        {
                            //same approach as above
                        }
                    }
                }
            }
        }
    }
     
    private bool IsTableClicked()
    {
        Telerik.WinForms.Documents.Layout.ParagraphLayoutBox pb = null;
        if (this.radRichTextEditor1.Document.Selection.IsEmpty)
        {
            pb = this.radRichTextEditor1.Document.CaretPosition.GetCurrentParagraphBox();
        }
        else
        {
            pb = this.radRichTextEditor1.Document.Selection.Ranges.First.StartPosition.GetCurrentParagraphBox();
        }
     
        if (pb == null)
        {
            return false;
        }
     
        TableCell cell = pb.AssociatedParagraph.Parent as TableCell;
        return cell != null;
    }

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top