Jump to content

Set field to be all caps


designerspressinc

Recommended Posts

There is a GUI based rule for that. Just Click New Rule and scroll down to "Choose Text Case" and choose the option your looking for.

 

or you could use this...

 

// Rule converted from XML Template "Choose Text Case":

// Please specify a field and choose the appropriate case.

// Begin XML Template selections //

var Var1 = "Header"; // "Choose a field for the conversion to appropriate case." (Required): FieldList

var CaseSelection = "allcaps"; // "Choose case.": PickList ["allcaps" (ALL CAPS), "smallcaps" (small caps), "propercase" (Proper Case or Title Case), "lowercase" (lower case)]

// End XML Template selections //

 

if(CaseSelection == "allcaps")

return ToUpper(Field(Var1));

 

if(CaseSelection == "smallcaps")

return "<smallcap>" + Field(Var1) + "</smallcap>";

 

if(CaseSelection == "propercase")

return ToTitleCase(Field(Var1));

 

if(CaseSelection == "lowercase")

return ToLower(Field(Var1));

Link to comment
Share on other sites

  • 5 years later...
22 hours ago, bwaddle1976 said:

Is there a way to employ the "uppercase" function in an empty text rule so it can be applied to specific text frames?

As Fellsway noted:

On 2/6/2019 at 10:46 AM, Fellsway said:

There is a GUI based rule for that. Just Click New Rule and scroll down to "Choose Text Case" and choose the option your looking for.

Or you can use the "Format Field or Rule" rule.  Then you can use rule in whatever specific text frames you need the uppercase applied.

If you want to apply the capitalization in every text frame, you can either do what I specified earlier here:

On 2/6/2019 at 10:38 AM, Dan Korn said:

In OnRecordStart:

FusionPro.Composition.AddVariable("Header", Field("Header").toUpperCase());

Or you can create the "Global Replace Text" rule (from the Event tab of the New Rule dialog).

Link to comment
Share on other sites

52 minutes ago, ThomasLewis said:

I've always wondered why this isn't part of the Variable Text Editor. You have underline and superscript which follow the tags method, why not add an Uppercase button that add the <uppercase> tags?

That's not a terrible idea.  But let me ask you this: What about <lowercase>?  Or <smallcap>?  Or "Title Case"?  Or any of a myriad of other markup tags?  How many buttons should there be?

Part of it is technical limitations in the number of attributes that can be applied to the text in underlying edit control, especially the intersection of the controls on Windows and Mac.

But mostly, this is a version of a question that we often ask ourselves about the user interface.  Do we add every possible option to the UI, making it look like a 747 cockpit with dozens of switches and knobs?  Or do we try to keep it simple for basic operations, and, if so, what functionality is considered basic vs. advanced?  How can we satisfy everyone?

We've talked about making the controls configurable, or customizable, which is a big effort to get right, but it's under consideration.  Maybe something like InDesign's idea of different "modes," such as Essentials and Typography.

Another idea in the works for the Text Editor is to make it easier to modify the formatting of variable text without writing rules, including case changes (upper, lower, title, small caps), as well as number, currency, date, and phone number formatting.  We're looking to centralize these options into a pop-up or fly-out dialog so that they don't make the main dialog more complex.  Hopefully something like this will be available in a version later this year.

Link to comment
Share on other sites

I get the concern in overcomplicating things but I think there would be a strong argument that if you are just going for most commonly needed things, uppercase would probably beat strikeout by a mile. Either way I'm really excited to hear about future improvements.

If you guys do move forward with more complex editing like you mentioned, please consider giving us a "view source" button just like what's in the resource editor for formatted text. It's extremely helpful for diagnosing issues as they come up. I don't know how many times I've had to copy stuff from the variable text editor and paste it into the resource editor to see what's going on.

Link to comment
Share on other sites

3 hours ago, ThomasLewis said:

I get the concern in overcomplicating things but I think there would be a strong argument that if you are just going for most commonly needed things, uppercase would probably beat strikeout by a mile.

I would say that strikethrough is a character style, while uppercase is a character conversion/formatting.  Also, strikethrough, like other character styles, is natively supported by the underlying rich text control on both Windows and Mac, which uppercase is not.

But as I said, we're working on an easier way to implement character conversion/formatting for variables in the Text Editor without rules.

3 hours ago, ThomasLewis said:

If you guys do move forward with more complex editing like you mentioned, please consider giving us a "view source" button just like what's in the resource editor for formatted text. It's extremely helpful for diagnosing issues as they come up. I don't know how many times I've had to copy stuff from the variable text editor and paste it into the resource editor to see what's going on.

The problem is that the markup generated by the Text Editor for a text flow and a Formatted Text Resource are not quite the same.  A text flow uses <para> and </para> tag pairs, while resources use standalone <p> tags.  You can always see the markup of a text flow in the .dif (format) file that gets generated when you compose or collect.  And the markup of a Formatted Text Resource is in the .def (data definition) file.

That said, we could consider a View Source button for the Text Frame mode of the Text Editor that would generate the markup as if it were a resource.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...