Updating already opened Form from Codeunit possible?

polaris
Member Posts: 2
I am trying to update an already opened Form from code in other object (like Codeunit or Report).
The form is run when opening company and remains open unless user decides to close it, however some user actions might change data which is displayed inside that form.
I have tried several ways of doing that so far:
1. Use timer inside a form. It works, but it causes unnecessary queries to the database and I have to close a form when I need to debug something, because debugger picks up timer events.
2. In a Codeunit with "SingleInstance" property enabled I have created a funtion to open and a function to update data in a form (by calling a custom function inside a form). The form itself was stored as a global variable. But it does not seem to pick up the already opened form, because I get a message telling me that i need to run a form before making changes to data inside it.
So anybody knows better way of doing this or timer is everything I can do in this situation?
The form is run when opening company and remains open unless user decides to close it, however some user actions might change data which is displayed inside that form.
I have tried several ways of doing that so far:
1. Use timer inside a form. It works, but it causes unnecessary queries to the database and I have to close a form when I need to debug something, because debugger picks up timer events.
2. In a Codeunit with "SingleInstance" property enabled I have created a funtion to open and a function to update data in a form (by calling a custom function inside a form). The form itself was stored as a global variable. But it does not seem to pick up the already opened form, because I get a message telling me that i need to run a form before making changes to data inside it.
So anybody knows better way of doing this or timer is everything I can do in this situation?
0
Comments
-
I think that the second way should work. If it is not, than may be there is some bug in the process.0
-
You need to combine the 2.
Your form needs the ontimer to regularly check the singleinstance codeunit if there is some new value for it. If there is, the form needs to take it and apply it (=show, filter or something else) and notify the singleinstance codeunit that it has taken it so the next time the ontimer is triggered it does not do something for the same value.
And you need the singleinstance codeunit to be able to send messages from 1 object to the other if they are not connected in any other way.
I have done it multiple times and it just works fine.
(I even use the singleinstance codeunit to send extra parameters to a function in case of standard functions so to avoid adding parameters to standard functions).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions