problem in clearing text widget using setTextWidgetText()

ssirpatil
Posts: 7
Joined: Wed Sep 08, 2010 4:12 pm

problem in clearing text widget using setTextWidgetText()

Post by ssirpatil » Wed Feb 16, 2011 5:18 pm

Hello All,

I am manipulating text widgets using setTextWidgetText() in scripts. I am able to set text using this function. I can also clear the text using an empty string ("") as the argument for this function. The text widget gets cleared but will not be able to set text later on until LCD is rebooted.

If I put some character instead of empty string, I am able to switch between this character and my real string. This proves the framework is working but the function has trouble with empty string. I also tried to trick it with whitespace, did not help.

I really need to set/clear text widgets. I cannot use lamp gauges, this post is related to my previous post of displaying text in table form.

Can some one please confirm this behavior / suggest some solution.

Thank you in advance
mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

Re: problem in clearing text widget using setTextWidgetText

Post by mbowdich » Thu Feb 17, 2011 7:58 am

Have you tried hiding and showing the widget instead of setting it with an empty string? Since I do know scripting, I have been using this method with a state machine. Essentially, I hide whatever I need to hide and the do a screen.process to update it.

In your case, you can hide it with the old string, then when you need to display it again, you can set it with the new string before showing it again. This would avoid the the empty string issue.
jedwards
Enovation Controls Development
Enovation Controls Development
Posts: 16
Joined: Fri Jul 30, 2010 8:24 am

Re: problem in clearing text widget using setTextWidgetText

Post by jedwards » Fri Feb 18, 2011 9:08 am

The solution mbowdich provided is an adequate work around in 2.1. The problem you are experiencing is unfortunately a bug in version 2.1. This has been fixed in 2.2 which should be released soon. In 2.2 you can set the TextWidget to an empty string and back to real strings without a problem.