an example how to convert a container to a numbered list that we will show into a dynamically built form:
class MYD_Functions
{
}
public static Notes conToBulletText(container _con)
{
TextBuffer txtb = new TextBuffer();
int i;
if (!_con)
return '';
try
{
for( i = 1; i <= conLen(_con) ; i++)
{
if (conPeek(_con, i))
txtb.appendText(strFmt('%1%2) %3', i==1 ? '' : '\n', i, conPeek(_con, i)));
}
}
catch (Exception::Error)
{
txtb.appendText('Error DFFMLIKQXM: could not translate the container to Notes');
}
return txtb.getText();
}
public static void conToBulletTextShowInForm(container _con)
{
Args args;
Form form;
FormRun formRun;
FormBuildDesign formBuildDesign;
FormBuildStringControl formBuildStringControl;
Notes notes = MYD_Functions::conToBulletText(_con);
//I need to show it in a form text, in an info box would not show the new lines
form = new Form();
formBuildDesign = form.addDesign("Design");
form.design().height(300);
form.design().caption('Notes');
formBuildStringControl =
formBuildDesign.addControl(FormControlType::StaticText, "txt");
formBuildStringControl.text(notes);
formBuildStringControl.height(200);
args = new Args();
args.object(form);
// Create the run-time form.
formRun = new FormRun(Args);
formRun.run();
formRun.detach();
}
To try we can use a job:
static void MYD_Functions_conToNotes1(Args _args)
{
container con = ['test1', 'test2'];
container con1 = ['test3', 'test4'];
MYD_Functions::conToBulletTextShowInForm(Global::conUnion(con, con1));
}
No comments:
Post a Comment