on 12-14-2016 6:59 AM - last edited on 02-03-2024 7:40 PM by postmig_api_4
Hi ,
I am newbie in SAP B1 9.2 . I need to use a form as modal form. I will use it in a matrix to choose data for a cell. When user clicks to a cell , a modal form will be opened. Then user will choose data from that modal form and press "OK" button. After pressing "OK" button the modal form will be closed and the application will continue.
Too many users say "you can use this method for modal forms:
public Form LoadForm(string fileName, string formType, BoFormModality modal = BoFormModality.fm_None)
{
string contents = ReadFileContents(fileName);
string uniqueId = GenerateUniqueId();
var formDefinition = application.Create<FormCreationParams>(BoCreatableObjectType.cot_FormCreationParams);
formDefinition.XmlData = contents;
formDefinition.UniqueID = uniqueId;
formDefinition.FormType = formType;
formDefinition.Modality = modal;
return application.Forms.AddEx(formDefinition);
}<br>
But, how can i use it? Where should i use it ?Can someone give me a full example?
Thank you.
Hi Huseyin,
I understand. Note that in SAP Business One "modal forms" were notoriously hard to implement, until SAP created this feature.
If you can already open a form then it is very straightforward to make it modal. As in the above sample use the formDefinition.Modality property or in your XML in the form tag add the modality="1".
Pedro Magueija
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your answer.
But, I have already checked cathing event examples. I can open a form already. I just want to open as modal. There is not enough documentation or example about this subject. This subject ( modal form ) is one of the basic needs to application developments. I asked due to this.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Huseyin,
You'll have to catch the event GetFocus of the cell and then open your form.
I'd recommend that you read through the SDK Help Center file and have a look at the samples in the SDK directory, usually:
C:\Program Files (x86)\SAP\SAP Business One SDK\Samples
Start with: C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM UI\CSharp\02.CatchingEvents
Note that the example above is a demonstration of how to use the property Modality. You can't copy and paste it into your code without any changes and hope it works (you shouldn't do that with any code from the web).
Try it out and see how it fits into your code, try to understand what it's doing, then if you are stuck somewhere, come back and ask your questions and we will do our best to help you.
Pedro Magueija
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.