4 Replies Latest reply on Nov 29, 2016 7:45 PM by GSalmson

    Formatting Buttons

    GSalmson

      Hi all,

      I am working on a database at the moment. Part of it has a text field that contains a particular report. Is there a way on the layout I can create buttons that will allow formatting of the text inside. Similar to the way buttons work on any text editing program or even this very website.  I can create buttons etc, but can't see a script step or something with the purpose of "Set Selection Bold" The sort of buttons are similar to the ones you find on any word editing software.

        • 1. Re: Formatting Buttons
          philmodjunk

          It's not just a script step. You have to combine a script step with specific functions to make this work.

           

          Insert Calculated result can insert text at the insertion point and I think it can replace selected text if a section of the text in a field is currently selected. You don't specify a target field to get this result.

           

          Take a look at your get functions. Theres one that returns the active selection start and one that returns the number of selected characters. Use these values with the Middle Function and you can access the specific text currently selected.

           

          Finally you have an Add textstyle function that allows you to add style to text. By combining these functions with the insert calculated result step (there are also ways to use set field). you can produce a script that takes the text style as a script parameter and uses the above methods with that parameter in order to replace the selected text with a copy of that selected text, but with the desired text style(s) added to it.

          1 of 1 people found this helpful
          • 2. Re: Formatting Buttons
            David Moyer

            Hi,

            there are so many functions and methods you can use; and I'm certain you're about to receive a slew of them.  So, I'll point out a function that returns the current drag-selected text:

            $ActiveSelection =

            Middle(

              Get(ActiveFieldContents);

              Get(ActiveSelectionStart);

              Get(ActiveSelectionSize)

            )

            1 of 1 people found this helpful
            • 3. Re: Formatting Buttons
              flukey

              You can also use conditional formatting to set certain formatting options depending on varying criteria.

              • 4. Re: Formatting Buttons
                GSalmson

                Hi Phil and David,

                Thank you for the quick responses and pointers. That did the trick. Works like a charm.


                Cheers