Query:
Can I create a dialog on run time?
Answer:
/// This is a class to create dynamic dialog on the fly
///
///
/// Usage
/*
static void testDynamicDialog(Args _args)
{
CustomDialog diag;
List types = new List(Types::Integer); // typeId is an integer
List fields;
ListEnumerator enum;
DialogField field;
;
// the dialog shall contain fields for the following types
types.addEnd(typeId(EmplId));
types.addEnd(typeId(Itemid));
types.addEnd(typeId(ProdId));
types.addEnd(typeId(CustAccount));
// crate and show
diag = new CustomDialog(types,"Dynamic Dialog");
diag.run();
// show values in the Infolog
fields = diag.parmFieldList();
enum = fields.getEnumerator();
while(enum.moveNext())
{
field = enum.current();
info(field.value());
}
} */
///
class MSTACustomDialog extends Dialog
{
List fieldList;
}
void new(List typeList, Caption _caption = '', Object _caller = null, str _parmstr = '', Form _form = new Form(formStr(Dialog)))
{
ListEnumerator enum;
;
if(typeList == null)
error("@BCS3969");
super(_caption, _caller, _parmStr, _form);
fieldList = new List(Types::Class);
enum = typeList.getEnumerator();
while(enum.moveNext())
{
fieldList.addEnd(this.addField(enum.current()));
}
}
Can I create a dialog on run time?
Answer:
Use the following class
/// /// This is a class to create dynamic dialog on the fly
///
///
/// Usage
/*
static void testDynamicDialog(Args _args)
{
CustomDialog diag;
List types = new List(Types::Integer); // typeId is an integer
List fields;
ListEnumerator enum;
DialogField field;
;
// the dialog shall contain fields for the following types
types.addEnd(typeId(EmplId));
types.addEnd(typeId(Itemid));
types.addEnd(typeId(ProdId));
types.addEnd(typeId(CustAccount));
// crate and show
diag = new CustomDialog(types,"Dynamic Dialog");
diag.run();
// show values in the Infolog
fields = diag.parmFieldList();
enum = fields.getEnumerator();
while(enum.moveNext())
{
field = enum.current();
info(field.value());
}
} */
///
class MSTACustomDialog extends Dialog
{
List fieldList;
}
public List parmFieldList()
{
return fieldList;
}
{
return fieldList;
}
{
ListEnumerator enum;
;
if(typeList == null)
error("@BCS3969");
super(_caption, _caller, _parmStr, _form);
fieldList = new List(Types::Class);
enum = typeList.getEnumerator();
while(enum.moveNext())
{
fieldList.addEnd(this.addField(enum.current()));
}
}
No comments:
Post a Comment