Making a control editable within a non editable form.
xavigepe
Member Posts: 185
Hi. I have a non editable form, but I need one of its controls to be editable.
This is my solution:
By default the editable property in the form is set to false.
In the Onbeforeinput trigger of the control I write:
currform.editable := true;
mycontrol:=editable := true;
In the OnAfterValidate, OnInputChange and OnAfterInput triggers I wrtie:
currform.editable := false;
But if I enter the control and then leave it whithout making no change, none of the OnAfterValidate, OnInputChange and OnAfterInputChange triggers are activated and thus my form stills editable because I set its editable property a true in the OnBeforeInput trigger. How can I prevent this?.
Thanks,
This is my solution:
By default the editable property in the form is set to false.
In the Onbeforeinput trigger of the control I write:
currform.editable := true;
mycontrol:=editable := true;
In the OnAfterValidate, OnInputChange and OnAfterInput triggers I wrtie:
currform.editable := false;
But if I enter the control and then leave it whithout making no change, none of the OnAfterValidate, OnInputChange and OnAfterInputChange triggers are activated and thus my form stills editable because I set its editable property a true in the OnBeforeInput trigger. How can I prevent this?.
Thanks,
0
Comments
-
Make the form Editable=TRUE, InsertAllowed=FALSE, DeleteAllowed=FALSE.
Make all the fields, except the one you need Editable=FALSE.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
What about the OnDeactivate trigger for the control? I've not tried this, but perhaps you could test it? It should fire as soon as the control loses focus, regardless of whether or not input was made.
Post back to let me know! Ta.Kristopher Webb
Microsoft Dynamics NAV Developer0 -
Thanks for your idea Kriki, but what happens if the user decides to add new fields to the form?. Moreover, I need that for some users all the controls in the form should be editable, and for some users only one control will be editable.
And about using the OnDeactivate trigger, it's not valid because this trigger only fires when you make Control.ACTIVATE = FALSE and I'm interested in a trigger which fires when you leave a control without making any change.
Thanks for your ideas, I really apreciate them.0 -
Add a textbox with source expression a global variable. Onvalidate write you code to validate the field you want to update.0
-
-Users should not add fields! The developers should do that.xavigepe wrote:Thanks for your idea Kriki, but what happens if the user decides to add new fields to the form?. Moreover, I need that for some users all the controls in the form should be editable, and for some users only one control will be editable.
-You can create a new Role and add that to users that may edit all controls.
-In the "OnOpenForm"-trigger, you can check if a user belongs to that Role for current company (or all companies), and then make all the fields editable. Something like this (for DB-logons):recMemberOf.RESET; recMemberOf.SETCURRENTKEY("User ID","Role ID",Company); recMemberOf.SETRANGE("User ID",USERID); recMemberOf.SETRANGE("Role ID",'THE NEW ROLE'); recMemberOf.SETFILTER(Company,'%1|%2',COMPANYNAME,''); blnAllFieldsEditable := recMemberOf.FIND('-'); CurrForm."Field 1".EDITABLE(blnAllFieldsEditable); CurrForm."Field 2".EDITABLE(blnAllFieldsEditable); ... CurrForm."Field N".EDITABLE(blnAllFieldsEditable);Don't add your always editable field.
When a new field is added, you just have to add it to this list.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
