Jump to content
fractal

ghTextedit + gwinSetText

Recommended Posts

Hi everyone,

I have been playing around with a ugfx gui for a bit and it has been working well. Now I found the need to rewrite the text of several Textedit-widgets at runtime and ran into some problems: the text is written correctly first, but when I place the cursor in the widget to edit the newly loaded text, an unrelated text shows up. The text which shows up seems to be some buffer garbage, stuff I wrote to labels at some point. I changed the buffer involved in the writing of the textedit (now short_buffer, used for nothing else) and the text is the same (or similar).

 

Is this a bug or am I using the system wrong? I suppose using dynamic text could provide a workaround, but I thought I would ask before trying too many things.

I am working with a recent git version of ugfx and Chibios 18.2. 

Thank you for any help,

Thomas

 

The code for writing the textedit: (works fine for labels)

// write the desired to text to a buffer using a chibios print function
chsnprintf(short_buffer, 8, "%.1f", TCU.CE->T_max);
// write buffer to textedit
gwinSetText(ghTextedit_max_temperature, short_buffer, FALSE);

 

Share this post


Link to post
Share on other sites

I am working with a recent git version of ugfx and Chibios 18.2. 

How recent is recent? There has been a text edit fix two months ago:  https://git.ugfx.io/uGFX/uGFX/commit/509fc7501e7bd30b1b314fc0d4838d7cdf6ac621 

 

I'm currently on the road so I can't dive into this right now. But can you reproduce it with the most minimal test case? Eg. using gwinSetText() with a simple string parameter (no runtime buffer stuff) and setting the last argument to TRUE?
So I guess the response to your "I suppose using dynamic text could provide a workaround, but I thought I would ask before trying too many things." statement is pretty much: That's exactly what I'd recommend you to try to track down the problem.

Share this post


Link to post
Share on other sites

Hi Joel,

thank you for the quick answer. I actually checked the changelog the other day and did not find that fix. I now updated ugfx and - after fiddling with types and definitions for a while to get it to play nice with my chibios and the STM-HAL I use for the 469-disco-board - I found it doesnt change anything. Once I have time I will try dynamic text.

Best,

Thomas

Share this post


Link to post
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.

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...