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
0
Comments
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.
Regards
RIS Plus, LLC
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.
thanks
RIS Plus, LLC
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.
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.
Regards
If the findrecord trigger is not called you will need to change something to the code in the onaftergetcurrrecord trigger.
Wouldn't it be better to put the actual code in functions on the table, and call them from buttons?
RIS Plus, LLC