I have some custom code in PurchTable "Register" menuitem's clicked method, Now I need to run the Register command from code after a buttons function has been perfomed.
My question is that how can I call the Register command from code ?
I see that you're actually trying to execute the clicked() method, but if you want to execute a Menu Item through code, you can do the following:
new MenuFunction(menuItemDisplayStr(MyDisplayMenuItem), MenuItemType::Display).run();
Of course the code above may be changed to execute different kinds of Menu Items, for example, the code below runs an Output Menu Item:
new MenuFunction(menuItemOutputStr(MyOutputMenuItem), MenuItemType::Output).run();
And if you need any argument on the Menu Item you're trying to execute, you can pass it with the Args class:
Args args = new Args();
args.record(myArgumentRecord);
args.caller(this);
new MenuFunction(menuItemOutputStr(MyOutputMenuItem), MenuItemType::Output).run(args);