Writing a file different if form docked/undocked  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Writing a file different if form docked/undocked

Postby DannyC » Tue Oct 14, 2014 4:35 pm

Hi,

I've written a plugin which writes a file to disk when a sales order is processed.
The code works fine when the form is undocked, but if it is docked it displays an error.

Can you assist to fix up the code so it works if the sales order form is both docked and undocked?

Thanks

Danny
Attachments
Export XML on SO Process.xml
(28.17 KiB) Downloaded 159 times
User avatar
DannyC
Senpai
Senpai
 
Posts: 658
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Writing a file different if form docked/undocked  Topic is solved

Postby Mike.Sheen » Wed Oct 15, 2014 9:41 am

Hi Danny,

Attached is a modified version of your plugin which works.
Plugin Export XML on SO Process.xml
Revised plugin
(33.06 KiB) Downloaded 416 times


The problem was your use of the shared ActiveForm property. When a form is docked the ActiveForm is the MDI parent form. When undocked, it would always be the sales order form with the focus. You seem to have used ActiveForm simply to get access to the sales order business logic. The Processed event you were hooking into does receive a sender argument - which is the sales order business logic. So in this case you don't need the form - you actually need the business logic. The modifications I made to your plugin do exactly that.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2488
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 770

Re: Writing a file different if form docked/undocked

Postby DannyC » Thu Oct 16, 2014 11:44 am

As a non-programmer, I think I get it!
Thanks Mike - great help as always.

Cheers

Danny
User avatar
DannyC
Senpai
Senpai
 
Posts: 658
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests