status initialiseTextItem(TextItem ti, Name name, Any val, Code msg) { CharArray str; if ( isDefault(name) ) name = getClassNameObject(ti); if ( isDefault(val) ) val = NAME_; createDialogItem(ti, name); assign(ti, message, msg); assign(ti, value_set, DEFAULT); assign(ti, value_width, DEFAULT); assign(ti, print_name, CtoString("")); assign(ti, advance, NAME_next); assign(ti, show_label, ON); assign(ti, value_text, newObject(ClassText, EAV)); assign(ti, editable, ON); assign(ti, default_value, val); assign(ti, selection, getDefaultTextItem(ti)); assign(ti, type, getSelectionTypeTextItem(ti)); assign(ti, auto_value_align, OFF); assign(ti, hor_stretch, toInt(100)); assign(ti, style, NAME_normal); if ( (str = get(ti, NAME_printNameOfValue, val, EAV)) ) valueString(ti->print_name, str); resetTextItem(ti); return requestComputeGraphical(ti, DEFAULT); }
static status initialiseButton(Button b, Name name, Message msg, Name acc) { createDialogItem(b, name); assign(b, default_button, OFF); assign(b, show_focus_border, ON); assign(b, message, msg); if ( notDefault(acc) ) assign(b, accelerator, acc); return requestComputeGraphical(b, DEFAULT); }
static status initialiseLabel(Label lb, Name name, Any selection, FontObj font) { if ( isDefault(name) ) name = NAME_reporter; if ( isDefault(selection) ) selection = NAME_; createDialogItem(lb, name); if ( notDefault(font) ) assign(lb, font, font); selectionLabel(lb, selection); assign(lb, width, DEFAULT); assign(lb, wrap, NAME_extend); return requestComputeGraphical(lb, DEFAULT); }
static status initialiseSlider(Slider s, Name name, Any low, Any high, Any def, Message msg) { createDialogItem(s, name); assign(s, label_width, DEFAULT); assign(s, show_label, ON); assign(s, show_value, ON); assign(s, low, low); assign(s, high, high); assign(s, message, msg); assign(s, width, toInt(200)); assign(s, drag, OFF); assign(s, format, DEFAULT); assign(s, default_value, def); if ( !restoreSlider(s) ) { assign(s, selection, s->low); displayedValueSlider(s, s->low); } return requestComputeGraphical(s, DEFAULT); }