The CustomEntry class

Less than one minute read time.

Below is some C# code that should explain how the new CustomEntry class can be used.


public class CustomEdit : UIEntry
{
private Sage.Mode _mode;
private string _value = null;
private string _defaultValue = "No Data";

public CustomEdit()
: base("input")
{
this.CloseElement = false;
this.AddAttribute("TYPE", "Text");
}

public override string Value
{
get
{
if (_value == null)
return _defaultValue;
return _value;
}

set
{
if ((value == null) || (value == ""))
_value = _defaultValue;
else
_value = value;
}
}

public override Sage.Mode Mode
{
get { return _mode; }
set { _mode = value; }
}

protected override string HtmlBody()
{
this.AddAttribute("value", this.Value);
if (_mode != Sage.Mode.Edit)
{
this.AddAttribute("READONLY", null); // ADD One single attribute without value
this.AddAttribute("STYLE", "background-color: gainsboro");
}
return "";
}
}


If this is added that to your Company Summary screen (See the example project that forms part of the SDK) and in a Company Edit screen, then you will see it render in different ways depending on the screen mode.

EntryCustom b = new EntryCustom("comp_faxNumber", new CustomEdit());
screenCompany.Add(b);