Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Feature UI hack help

Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
What's a cleaner way to do this? The feature is here.

For the UI of the Part Name feature, I want the ability to switch segments between a string or formula, but I don't want to make the feature super long with boolean boxes. I've kind of hacked it by using the OPPOSITE_DIRECTION booleans, which gives me a much cleaner and brief layout, but it feels kinda hackey because it is.


Evan Reese / Principal and Industrial Designer with Ovyl
Website: ovyl.io

Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    I thought you could use custom icon, but seems like it can't be used with boolean parameter. Though I like your solution, it's compact and intuitive.
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    oh! I'd love to use a custom icon if I could
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    If you're okay with the name not changing, you should be able to use DISPLAY_SHORT to have a named checkbox and an unnamed quantity/string in the same row. Like your solution, but with a checkbox.

    annotation {"Name" : "Visible name", "UIHint" : [ "DISPLAY_SHORT", "FIRST_IN_ROW" ] }
            definition.isExpression is boolean;
    
            if (definition.isExpression)
            {
                annotation {"Name" : "Expression", "UIHint" : UIHint.DISPLAY_SHORT }
                isLength(definition.expression, LENGTH_BOUNDS);
            }
            else
            {
                annotation {"Name" : "String", "UIHint" : UIHint.DISPLAY_SHORT }
                definition.string is string;
            }
            

    Up to you if you like checkboxes better than flip buttons.
  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    Thanks, Kevin, since it's not otherwise labeled, I'd like the text to change to clue the user into what's happening. It would be nice in this case if we could do an unnamed checkbox and named qty/string fields instead. I like the word "expression" more than "formula" so thanks for that. I've updated it.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
Sign In or Register to comment.