Calling methods on a caller form
August 19th, 2010
2 comments
This is actually something small but it comes in handy from time to time !
Due to the poor design on some form I have to make changes to, I needed this thing here. I replaced a button on the form with code behind it (yes, business logic behind a button is a BAD practice !) by a MenuItemButton. The only problem was that the form had some objects (f.e. a ledgerJournalEngine object, …) that needed to be available in the class behind it…
Now, this is what I did to get the ledgerJournalEngine object from the caller form and pass it to the class I was calling :
// Get the caller form CIMVendTransInvoicePool to get the ledgerjournalengine object if(ClassIdGet(_args.caller()) == ClassNum(SysSetupFormrun) && (setupFormRun.name() == formStr(CIMVendTransInvoicePool))) { if (formHasMethod(_args.caller(), identifierStr(parmLedgerJournalEngine))) { ledgerJournalEngine = _args.caller().parmLedgerJournalEngine(); DAXCancelRegisteredInvoice.parmLedgerJournalEngine(ledgerJournalEngine); } }