summaryrefslogtreecommitdiff
path: root/nichrome
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-02-26 16:37:12 +1300
committerKeith Packard <keithp@keithp.com>2012-02-26 16:37:12 +1300
commite0a9d063d6b68bf3dd8492cb1ea7f074b663395a (patch)
treed04c7e18b8c0a66bd08df7ca7e85b3c915f89507 /nichrome
parent76bf56f659e1cadf668c6428582d3e10c1c7b65b (diff)
Add Nichrome::Text::set_text
Let an application set the contents of the text widget Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'nichrome')
-rw-r--r--nichrome/nichrome-text.5c7
1 files changed, 6 insertions, 1 deletions
diff --git a/nichrome/nichrome-text.5c b/nichrome/nichrome-text.5c
index 238a395..f473034 100644
--- a/nichrome/nichrome-text.5c
+++ b/nichrome/nichrome-text.5c
@@ -224,9 +224,14 @@ extend namespace Nichrome {
printf("text %s %v\n", widget.text, widget.geometry);
}
+ public void set_text(&text_t widget, string new_text) {
+ widget.text = new_text;
+ Widget::redraw(&widget);
+ }
+
public void init (&text_t widget, &nichrome_t nichrome, int num_chars) {
Widget::init (&nichrome, &widget);
- widget.text = "hello";
+ widget.text = "";
widget.num_chars = num_chars;
widget.caret = 0;
widget.font = Widget::default_font;