Lookup On Enum

I found a problem in creating a mandatory field out of an enum. Lets say we have an enum like this:
Enum:

  • 0 - ' ' =>None
  • 1 - 'Val1'
  • 2 - 'Val2'

...there is no way (that i found) to make the dropdown field based of the Enum mandatory, because even the blank value is a value based of the Enum. Here is what i did.
1. Overwrite the lookup method on a StringEdit field on the form.
public void lookup()
{
DictEnum e;
int i;
TmpEnum tempEnum;
// Instantiate sysTableLookup object using table which will provide the visible fields
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(TmpEnum), this);
;

e = new DictEnum(enumName2Id('enumElement'));

if (e)
{
for (i=0; i < e.values(); i++)
{
tempEnum.EnumId = i;
tempEnum.EnumName = e.index2Label(i);
tempEnum.doInsert();
}
}
sysTableLookup.parmTmpBuffer(tempEnum);
sysTableLookup.addLookupfield(fieldNum(TmpEnum, EnumName));

// Perform the lookup
sysTableLookup.performFormLookup();

}

Now you have a temp table that you can reuse.