Cannot Update Text Styled with EDC in a Label

Original Created Oct 25, 2017 | Regeneration Apr 22, 2026

I'm following up on a previous post (link unavailable) about styling text with EDC. After applying EDC styles to a label, I need to update the text programmatically. However, when I keep the text attribute in the EDC component, subsequent changes are ignored. If I remove the text attribute, nothing is displayed.

I've tried using elm_object_item_part_text_set with various part names ("custom", "label2", "default"), but nothing changes.

Here's my EDC file:

collections {
   group { 
      name: "elm/label/base/custom";
      parts {
         text { "label2";
            scale: 1;
            desc { "default";
               color: 0 0 255 254;
               color2: 255 0 0 255;
               visible: 1;
               text {
                  size: 50;
                  font: "Sans";
                  text: "TEXT";
                  align: 0.5 0.5;
                  min: 0 0;
               }
               align: 0.5 0.5;
               rel1.relative: 0.25 0.25;
               rel2.relative: 0.75 0.75;
               map {
                  on: 1;
                  rotation.z: 180;
                  perspective_on: 1;
                  backface_cull: 1;
               }
            }
         }  
      }
   }
}

How can I update this styled text programmatically?

Problem Understanding

The issue occurs when trying to update text that has been styled using EDC. The main problems are:

  1. The text doesn't update when the text attribute is kept in EDC
  2. The text disappears when the text attribute is removed from EDC
  3. Using elm_object_item_part_text_set with common part names doesn't work

Solution Methods

  1. Add an identifier to the text block:

    • The text block in EDC needs a name attribute for programmatic access
    • Example modification:
      text { 
         name: "label_test";
         scale: 1;
         desc { "default";
            color: 0 0 255 254;
            // ... rest of the styling
         }
      }
      
  2. Use the correct function with the proper part name:

    • Instead of elm_object_item_part_text_set, use elm_object_part_text_set
    • The part name should match the name you gave in the EDC file

Code Examples

Here's how to update the text programmatically:

elm_object_part_text_set(label_widget, "label_test", "New Text");

Where:

  • label_widget is your label object
  • "label_test" is the name you defined in EDC
  • "New Text" is the text you want to display

Additional Tips

  • Ensure the part name in your code matches exactly with the name in EDC (case-sensitive)
  • If you're using multiple styled labels, give each one a unique name in EDC
  • Remember that this solution works for labels styled with EDC, not regular labels

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.