Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mixed-text doesn't update its layout

It seems to me that mixed-text components calculate their layout (ie, element sizes and positions) when first instantiated in .gui, but not dynamically in response to changes made via .js. For example, if a mixed-text is initialised in .gui with #copy/text that takes one line to display, changing the text in .js to a longer string will only display the topmost line of the new text. This is independent of the buffer-length value.

 

The reverse situation also applies: if the component is initialised with a long string which is subsequently replaced with a short one, the component leaves unnecessary blank space.

 

This makes it difficult to use a mixed-text to make a reusable popup dialog box.

 

If I'm right about this, could mixed-text please be modified to update its layout whenever any relevant attributes are changed?

Peter McLennan
Gondwana Software
Best Answer
4 REPLIES 4

You could try sending one of the events after changing the text.

 

One of these might work:

 

 

yourelement.sendEvent({ type: 'EVENT_NAME' });
yourelement.animate('EVENT_NAME');
yourelement.state = "EVENT_NAME";

Here's the list of event names: EVENT_NAME

 

activate, click, collapse, disable, enable, expand, highlight, load, mousedown, mousemove, mouseout, mouseover, mouseup, paint, reload, select, unhighlight, unload, and unselect

Best Answer

Welcome back, Jon!

 

Thanks for the suggestion. I tried all of those events on both the mixed-text and copy/text elements, but nothing triggered a re-layout.

 

Here's an example of what happens if the copy/text is changed from a one-liner to a longer string (the full sentence):

 

Slideshow-2-screenshot.png

Here's what it should look like (and DOES look like if the .gui string is three lines long):

Slideshow-2-screenshot(1).png

I feel that setting the copy/text.text in javascript should automatically trigger a re-layout.

Peter McLennan
Gondwana Software
Best Answer

A little more info on this bug: the layout IS recalculated whenever the display comes back on. As a result, the layout can vary before and after the display cycling, leading to bizarre inconsistencies—all without the execution of any app code.

 

This was a major pain to fault-find!

 

Since it's obviously possible for mixed-text components to recalculate their layouts after javascript-based changes, could I urge that this be done whenever the content changes rather than just whenever the display comes on.

Peter McLennan
Gondwana Software
Best Answer

Since the post is more than four years old I wonder if the issue still hasn't been fixed?
I am developing on a Fitbit Sense using the SDK 6.1.0 and following https://dev.fitbit.com/build/guides/user-interface/svg/#dynamic-textarea 
I have still have the same problem that the textarea is NOT resized after changing its text from JS.

Is there a workaround?

Best Answer