Added uiEntryReadOnly() and uiEntrySetReadOnly().

This commit is contained in:
Pietro Gagliardi 2015-05-06 22:09:10 -04:00
parent 01ff7965da
commit 372cbf044d
2 changed files with 12 additions and 6 deletions

View File

@ -50,12 +50,12 @@ static void openAnotherWindow(uiButton *b, void *data)
SHED(enable, Enable)
SHED(disable, Disable)
static void setLabelText(uiEntry *e, void *data)
static void echoReadOnlyText(uiEntry *e, void *data)
{
char *text;
text = uiEntryText(e);
uiLabelSetText(uiLabel(data), text);
uiEntrySetText(uiEntry(data), text);
uiFreeText(text);
}
@ -70,7 +70,7 @@ uiBox *makePage2(void)
uiBox *innerhbox3;
uiTab *disabledTab;
uiEntry *entry;
uiLabel *entrylabel;
uiEntry *readonly;
page2 = newVerticalBox();
@ -153,10 +153,14 @@ uiBox *makePage2(void)
uiBoxAppend(page2, uiControl(disabledTab), 1);
entry = uiNewEntry();
entrylabel = uiNewLabel("");
uiEntryOnChanged(entry, setLabelText, entrylabel);
readonly = uiNewEntry();
uiEntryOnChanged(entry, echoReadOnlyText, readonly);
uiEntrySetText(readonly, "If you can see this, uiEntryReadOnly() isn't working properly.");
uiEntrySetReadOnly(readonly), 1);
if (uiEntryReadOnly(readonly))
uiEntrySetText(readonly, "");
uiBoxAppend(page2, uiControl(entry), 0);
uiBoxAppend(page2, uiControl(entrylabel), 0);
uiBoxAppend(page2, uiControl(readonly), 0);
return page2;
}

2
ui.idl
View File

@ -84,6 +84,8 @@ interface Entry from Control {
func Text(void) *char;
func SetText(text *const char);
func OnChanged(f *func(e *Entry, data *void), data *void);
func ReadOnly(void) int;
func SetReadOnly(readonly int);
};
func NewEntry(void) *Entry;