Added uiEntryOnChanged() and added it to the test program. This will be necessary for testing readonly entries.

This commit is contained in:
Pietro Gagliardi 2015-05-06 19:54:42 -04:00
parent 5b65c58715
commit fba7450da3
2 changed files with 18 additions and 0 deletions

View File

@ -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;
}

1
ui.idl
View File

@ -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;