Page 1 of 1

Sample Plugin Editable List Maintenance as a ShowDialog()

PostPosted: Tue May 02, 2023 5:06 pm
by neil.interactit
Hi Mike,

I have been using your Sample Plugin Editable List Maintenance to create various lists in support of some required business logic.

I have a need to drill down into some further detail for each record in one of these lists. I made up another Sample Plugin Editable List Maintenance based form for this detail, and added a JiwaLookupButtonCellType column to the calling list which calls:
Code: Select all
                var managerForm = new RunSheet(recId);
                managerForm.ShowDialog();

The form pops up, but has no rows populated. I assume that when the Jiwa appliucation create a form it then subsequently makes a call to it to kick off the Read() process??? I have tried various approaches but keep getting "object not set" errors, so I guess I am making the call before instantiation has completed, but I can't find the correct event to hook into. Could you please advise?

As a related question ... you will notice above, the (recId) parameter passed to the constructor. This is used set set BusinessLogic.Tag, then I access base.Tag in the Read() override to set a @DeliveryRunID SQL parameter. I guess this should work (once I can get the rows displaying) but it seems a little fudgy. Is there a more correct approach to pass in a parameter to the Read() override?

Thanks,
Neil

Re: Sample Plugin Editable List Maintenance as a ShowDialog(

PostPosted: Tue May 02, 2023 5:48 pm
by Mike.Sheen
When we load dialogs we use the dialog factory to create a dialog:

Code: Select all
DebtorAllocationDialog debtorAllocationDialog = Manager.DialogFactory.CreateDialog<DebtorAllocationDialog>(new object[] { BankReceiptLine.BankReceiptLineDebtors[key], JiwaBanking.BankReceipts.BankReceipt.AllocationTypes.Discount }, this, "");
debtorAllocationDialog.ShowDialog(this);


That'll set the Manager property and invoke the do other things like initialise controls, set the icon and then invoke the Start method of the dialog. In the start method is typically where we'd read data and/or populate controls such as grids.

Do you want this form to just be a dialog, or are you wanting to make it behave only as a dialog sometimes?

Re: Sample Plugin Editable List Maintenance as a ShowDialog(

PostPosted: Tue May 02, 2023 8:48 pm
by neil.interactit
Thanks Mike,

I'll try that tomorrow.

This will only every be as a dialog - as, the row clicked to call it determines the seed parent recid used to display the correct detail rows.

Cheers,
Neil

Re: Sample Plugin Editable List Maintenance as a ShowDialog(

PostPosted: Wed May 03, 2023 10:35 am
by neil.interactit
Hi Mike,

I have had no joy. I have tried a few different approaches within the class without success.

I was able to pass in the parameter through IJiwaDialog.Start(), but the Read() is still not fired. It "feels like" the override Setup() is not being called via this ShowDialog approach (as I guess it is from a Jiwa menu firing). If I manually call Setup() within Start() I get the same "object not set" errors.

Is there any chance you could knock up a copy of Sample Plugin Editable List Maintenance that can be called via Manager.DialogFactory.CreateDialog<>.ShowDialog(this)?

Many thanks,
Neil.

Re: Sample Plugin Editable List Maintenance as a ShowDialog(  Topic is solved

PostPosted: Wed May 03, 2023 3:06 pm
by Mike.Sheen
Attached is the plugin adapted to be a dialog.

I've made it add a button the ribbon of the inventory maintenance form ,"Test Dialog" - when pressed it loads the dialog.

TestDialog.png


It currently doesn't have a cancel button - but it's easy enough to add one that simply closes the form - the code adds the Save button, so it's just programming by numbers to add another button.

Re: Sample Plugin Editable List Maintenance as a ShowDialog(

PostPosted: Wed May 03, 2023 5:54 pm
by neil.interactit
Awesome! Many thanks Mike.

I'm busy adapting based on your sample now!

Thanks again,
Neil