Added uiEntryReadOnly() and uiEntrySetReadOnly().
This commit is contained in:
parent
01ff7965da
commit
372cbf044d
16
test/page2.c
16
test/page2.c
|
@ -50,12 +50,12 @@ static void openAnotherWindow(uiButton *b, void *data)
|
||||||
SHED(enable, Enable)
|
SHED(enable, Enable)
|
||||||
SHED(disable, Disable)
|
SHED(disable, Disable)
|
||||||
|
|
||||||
static void setLabelText(uiEntry *e, void *data)
|
static void echoReadOnlyText(uiEntry *e, void *data)
|
||||||
{
|
{
|
||||||
char *text;
|
char *text;
|
||||||
|
|
||||||
text = uiEntryText(e);
|
text = uiEntryText(e);
|
||||||
uiLabelSetText(uiLabel(data), text);
|
uiEntrySetText(uiEntry(data), text);
|
||||||
uiFreeText(text);
|
uiFreeText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ uiBox *makePage2(void)
|
||||||
uiBox *innerhbox3;
|
uiBox *innerhbox3;
|
||||||
uiTab *disabledTab;
|
uiTab *disabledTab;
|
||||||
uiEntry *entry;
|
uiEntry *entry;
|
||||||
uiLabel *entrylabel;
|
uiEntry *readonly;
|
||||||
|
|
||||||
page2 = newVerticalBox();
|
page2 = newVerticalBox();
|
||||||
|
|
||||||
|
@ -153,10 +153,14 @@ uiBox *makePage2(void)
|
||||||
uiBoxAppend(page2, uiControl(disabledTab), 1);
|
uiBoxAppend(page2, uiControl(disabledTab), 1);
|
||||||
|
|
||||||
entry = uiNewEntry();
|
entry = uiNewEntry();
|
||||||
entrylabel = uiNewLabel("");
|
readonly = uiNewEntry();
|
||||||
uiEntryOnChanged(entry, setLabelText, entrylabel);
|
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(entry), 0);
|
||||||
uiBoxAppend(page2, uiControl(entrylabel), 0);
|
uiBoxAppend(page2, uiControl(readonly), 0);
|
||||||
|
|
||||||
return page2;
|
return page2;
|
||||||
}
|
}
|
||||||
|
|
2
ui.idl
2
ui.idl
|
@ -84,6 +84,8 @@ interface Entry from Control {
|
||||||
func Text(void) *char;
|
func Text(void) *char;
|
||||||
func SetText(text *const char);
|
func SetText(text *const char);
|
||||||
func OnChanged(f *func(e *Entry, data *void), data *void);
|
func OnChanged(f *func(e *Entry, data *void), data *void);
|
||||||
|
func ReadOnly(void) int;
|
||||||
|
func SetReadOnly(readonly int);
|
||||||
};
|
};
|
||||||
func NewEntry(void) *Entry;
|
func NewEntry(void) *Entry;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue