How to track the key 'Ctrl+F' and make record non editable

venkatesh
Member Posts: 51
Dear friends,
In a contact card while moving between records i am able to control the contact card's stage from editable to non editable.but,In Editable stage,when i use Ctrl+F for searching by positioning the cursor in contact number field,the record is opened in editable stage.
but,according to our requirement it should be in non editable stage.
please give me a solution.
thanks
In a contact card while moving between records i am able to control the contact card's stage from editable to non editable.but,In Editable stage,when i use Ctrl+F for searching by positioning the cursor in contact number field,the record is opened in editable stage.
but,according to our requirement it should be in non editable stage.
please give me a solution.
thanks
0
Comments
-
Hello.
If I understand you correctly, you have placed code in the OnAfterGetRecord() trigger of the form to enable/disable the form.
If you use OnAfterGetCurrRecord() you will be trigged whenever and however the record is change.
RegardsIt is impossible to make anything foolproof, because fools are so ingenious.0 -
If your Contact Card opens in non-editable state, and it turns into editable when you put your cursor in the No. field, then some code is probably doing this. What you need to do in that case, is open the Contact Card, turn on the debugger, and click the No. field. Then follow the debugger to see what happens, and make the necessary adjustments. It could be as simple as Tod says, but you could also have to modify your code.0
-
hello,
This works fine when i move from one contact to another by pressing
previous or next button.but,when the from is already in editable stage and i use Ctrl+F,in the No.field .It opens the contact in editable stage itself.
but for me it should open the contact in non editable stage.
thanks0 -
Could you paste the code in here, and tell us where (in which trigger) you put the code? Have you tried Tod's suggestion?0
-
hello,
i have pasted below the copy of my code .i have tried it as per TOD'S suggestion.please go through it .
OnAfterGetRecord:
/// (22.02.2006 eTV-Gs) M11 ... Start
IF (xRec."No."<>'') AND (xRec."No."<>"No.") AND (NOT GIsContactDelete)
AND (GOptStatus=GOptStatus::Open) THEN BEGIN
LErrorMsg:='';
IF ValidateOnNewContact(xRec,LErrorMsg) THEN BEGIN
GRecContact.RESET;
GRecContact.SETRANGE("No.",xRec."No.");
IF GRecContact.FIND('-') THEN BEGIN
GET(xRec."No.");
Rec:=xRec;
EXIT;
END;
END;
END;
/// (22.02.2006 eTV-Gs) M11 ... End
SETRANGE("No.");
/// (24.01.2006 eTV-GS) M1 ... Start
IF (NOT GIsUnBlocked) OR
((xRec."No."<>"No.") AND ("No."<>'') AND (xRec."No."<>'')) THEN BEGIN
GOptStatus:=GOptStatus::Close;
CurrForm.EDITABLE:=FALSE;
CurrForm.UPDATECONTROLS;
END ELSE IF (GIsUnBlocked) OR (GIsNewContact) THEN BEGIN
GOptStatus:=GOptStatus::Open;
CurrForm.EDITABLE:=TRUE;
CurrForm.UPDATECONTROLS;
GIsNewContact:=FALSE;
END;
IF GIsNewContact THEN BEGIN
GOptStatus:=GOptStatus::Open;
CurrForm.EDITABLE:=TRUE;
CurrForm.UPDATECONTROLS;
GIsNewContact:=FALSE;
END;
LContactJonResp.RESET;
LContactJonResp.SETRANGE(LContactJonResp."Contact No.","No.");
IF LContactJonResp.FIND('-') THEN BEGIN
REPEAT
LContactJonResp.CALCFIELDS(LContactJonResp."Job Responsibility Description");
LJobDesignation:=LJobDesignation + FORMAT(LContactJonResp."Job Responsibility Description") +';';
IF LJobDesignation=';' THEN LJobDesignation:='';
UNTIL LContactJonResp.NEXT=0;
END ELSE
LJobDesignation:='';
LJobDesignation:=DELCHR(LJobDesignation,'<>',';');
/// (24.01.2006 eTV-GS) M1 ... End
OnGetCurrRecord:
/// (22.02.2006 eTV-Gs) M11 ... Start
IF (xRec."No."<>'')
AND (GPrvOptStatus=GPrvOptStatus::Open) THEN BEGIN
LErrorMsg:='';
IF ValidateOnNewContact(xRec,LErrorMsg) THEN BEGIN
GRecContact.RESET;
GRecContact.SETRANGE("No.",xRec."No.");
IF GRecContact.FIND('-') THEN BEGIN
GET(xRec."No.");
Rec:=xRec;
EXIT;
END;
END;
END;
/// (22.02.2006 eTV-Gs) M11 ... End
OnFindRecord:
RecordFound := FIND(Which);
CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = '');
/// (22.02.2006 eTV-Gs) M11 ... Start
GPrvOptStatus:=GOptStatus;
GOptStatus:=GOptStatus::Close;
CurrForm.EDITABLE:=FALSE;
CurrForm.UPDATECONTROLS;
/// (22.02.2006 eTV-Gs) M11 ... End
EXIT(RecordFound);
thanks.0 -
Sorry to say, but for me your code is a bit too complex to even try to analyse.
My advice is to try what you want in a simpler way. F.ex. Skip the ValidateOnNewContact function, the receiving of Xrec and so on and focus on the Editable function only. You'll learn how it works and can add the functionality to your code.
RegardsIt is impossible to make anything foolproof, because fools are so ingenious.0 -
You need to try to debug the code after you've used CTRL+F. Check what piece of code is called and whether or not the findrecord trigger is called.
If the findrecord trigger is not called you will need to change something to the code in the onaftergetcurrrecord trigger.0 -
:shock: sheesh.... what are you trying to do? What is the purpose of all this code? Why are you manipulating data like that on a form? By making all these changes, you are making so that this form behaves completely differently from every other form, and you are taking the intuitiveness out of it.
Wouldn't it be better to put the actual code in functions on the table, and call them from buttons?0 -
Yep, I agree. You only want to do this if you are absolutely sure there is no other way to achieve your goal.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