I’m running this code to call another form, and sometimes my forms won’t close. I’m pretty sure it’s because it’s “waiting”, and I have to Ctrl+Alt+Del to close AX. What’s the proper way to do this and/or does anybody see what I’m doing wrong?
So, let me understand what you want to do. You have created a form, added some controls I suppose, and then you want this form to act as a RunBase dialog, is this correct? If not, can you explain me exactly what you want to achieve?
This is essentially what I want to do. I have a class that calls a custom form I created to collect a bit of information from users. When the users click “OK” on the form, the class is supposed to take the information from the form and process it. I have a menu button on the parent form that calls the class, which in turn calls the form via the dialog. Sometimes either the child or parent form will not close, and I have to Ctrl+Alt+Del out of it.
Yes, this is because you need to treat the child form in a special way. Please take a look at the Tutorial_RunbaseForm class, and also the Tutorial_RunbaseForm form, follow the same approach in your stuff and you will be able to close the form.
I see the difference seems to be:
DialogRunbase dialog = Dialog::newFormnameRunbase(formstr(tutorial_RunbaseForm),this);
How would I pass a record to the form though to initialize it. In my code above, I’m using the args to pass a specific sales table record. My code is called from a button on the Form\SalesTable, so I’m just passing the current sales order.
Would I do something on the form such as:
salesTable = element.args().caller().parmSalesTable();
Or should is there a way to pass it from the class?
This is much easier than what I was doing. How would you recommend passing back the rows entered into a temporary datasource then? Or returning data back to the class? Just the parm methods on the class? Do you pass the entire datasource?
I have the currentlist macro, classDec, etc. If I click “OK” it works fine and all of my code in the “CloseOK” method is run. That is where I call my class’s parm methods.
When I switch to the batch tab and check the batch to run in batch, the code in the “CloseOK” still runs, but somehow the variables aren’t getting passed. I created a parmInt and parmBoolean to test with some infologs and they do get passed when it’s not in batch. But when I run it in batch, those variables aren’t passed.
Are there any more methods that need to be added to the form or on the class to properly fit the framework?
My class has “server static” for the construct method. The class itself has the property “RunOn: CalledFrom”. The menu item that calls the class has “RunOn: CalledFrom” as well. It’s very strange. I changed the menu item to “RunOn: Server” and then I wasn’t able to pass the salesTable record to the form and it was worse, so I put it back.