diff --git a/test/page2.c b/test/page2.c index 5fd488db..dd649f25 100644 --- a/test/page2.c +++ b/test/page2.c @@ -50,6 +50,15 @@ static void openAnotherWindow(uiButton *b, void *data) SHED(enable, Enable) SHED(disable, Disable) +static void setLabelText(uiEntry *e, void *data) +{ + char *text; + + text = uiEntryText(e); + uiLabelSetText(uiLabel(data), text); + uiFreeText(text); +} + uiBox *makePage2(void) { uiBox *page2; @@ -60,6 +69,8 @@ uiBox *makePage2(void) uiBox *innerhbox2; uiBox *innerhbox3; uiTab *disabledTab; + uiEntry *entry; + uiLabel *entrylabel; page2 = newVerticalBox(); @@ -141,5 +152,11 @@ uiBox *makePage2(void) uiControlDisable(uiControl(disabledTab)); uiBoxAppend(page2, uiControl(disabledTab), 1); + entry = uiNewEntry(); + entrylabel = uiNewLabel(""); + uiEntryOnChanged(entry, setLabelText, entrylabel); + uiBoxAppend(page2, uiControl(entry), 0); + uiBoxAppend(page2, uiControl(entrylabel), 0); + return page2; } diff --git a/ui.idl b/ui.idl index 205c19ab..4603616c 100644 --- a/ui.idl +++ b/ui.idl @@ -83,6 +83,7 @@ func NewVerticalBox(void) *Box; interface Entry from Control { func Text(void) *char; func SetText(text *const char); + func OnChanged(f *func(e *Entry, data *void), data *void); }; func NewEntry(void) *Entry;