Question Status

Verified
Eitan Mizrahi asked a question on 7 Mar 2013 1:05 AM

Hello.

For AX 2009.

I want to add lookup to dialogfield (built on a class).

The lookup is dynamics and should related to some fields on the dynamic dialog I create.

class MyClass extends RunBase
{
    DialogField             myDialogField1;
    DialogField             myDialogField2;
    DialogField             myDialogField3;
}

protected Object dialog()
{
    Dialog dialog;
    DialogTabPage tabParameters;
    ;
    dialog = super();

    tabParameters      = dialog.addTabPage("File");
    myDialogField1     = dialog.addField(typeid(Name), "Field 1");
    myDialogField2     = dialog.addField(typeid(Name), "Field 2");
    myDialogField3     = dialog.addField(typeid(Name), "Field 3");
}


   I want to add lookup on myDialogField3, but the lookup is dynamics, and related to the values that on field1+field2

i.e  myDialogField3 shows currencies, and the currencies are limits to specific currencies according to myDialogField1   + myDialogField2.

 

Thanks :)

Reply
Verified Answer
Martin Dráb responded on 7 Mar 2013 4:27 AM

I don't think it will work without "controlMethodOverload" - the methods won't be called. About lookups, I would expect you to override the lookup() method.

But if you have such troubles in this phase, you should use a normal form, it will be easier for you. See Tutorial_RunbaseForm class and form for an example.

Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

Reply
Suggested Answer
Mukesh Hirwani responded on 7 Mar 2013 2:21 AM

myDialogField3 = dialog.addFieldValue(extendedTypeStr(<edt>), <object>);

   myDialogField3 .registerOverrideMethod(

       methodStr(FormStringControl, lookup),

       methodStr(<Object name>, <methodName>),

       this);

Mukesh Hirwani
http://mukesh-ax.blogspot.in/ 

   

Reply
Suggested Answer
Mukesh Hirwani responded on 7 Mar 2013 2:21 AM

myDialogField3 = dialog.addFieldValue(extendedTypeStr(<edt>), <object>);

   myDialogField3 .registerOverrideMethod(

       methodStr(FormStringControl, lookup),

       methodStr(<Object name>, <methodName>),

       this);

Mukesh Hirwani
http://mukesh-ax.blogspot.in/ 

   

Reply
Martin Dráb responded on 7 Mar 2013 2:26 AM

You could use controlMethodOverload() (see example here), but it's often easier to simply create a normal form.

Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

Reply
Eitan Mizrahi responded on 7 Mar 2013 4:01 AM

Ok, Martin.

I have done as you sugested.

1. for dialogPostRun - I didn't use that, but things work (I have a class when there is a dialog on the class)

The class extends runBase.

I did :

dialog dialog;

dialog = super();

dialog.allowUpdateOnSelectCtrl(true);

2. I think that fld_1_1_modified should call orignal modified method (since, I cannot see the modification on specific field).

3. I don't know how to add the list of values (which are looked up).

If I implement as sugested on blogs.msdn.com/.../434146.aspx, I can see that fld_2_1_lookup is unreachable.

Thanks :)

Reply
Verified Answer
Martin Dráb responded on 7 Mar 2013 4:27 AM

I don't think it will work without "controlMethodOverload" - the methods won't be called. About lookups, I would expect you to override the lookup() method.

But if you have such troubles in this phase, you should use a normal form, it will be easier for you. See Tutorial_RunbaseForm class and form for an example.

Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

Reply
Eitan Mizrahi responded on 7 Mar 2013 5:00 AM

Well, there was a problem on the example you gaved.

I should put:

boolean fld2_1_modified()

{

   FormStringControl c = dialog.formrun().controlCallingMethod();

   boolean ret;

   ;

   ret = c.modified(); // Super() Call the FormControl ->modified

   return ret;

}

Now things work fine, but I want also to use the lookup.

How can I fill the lookup field?

Thanks :)

Reply
Eitan Mizrahi responded on 7 Mar 2013 7:32 AM

Ok. I succeed doing lookup on dialogfield.

This is not trivial.

Also, I did custimized lookup of my own (which I passed the relevant parameters on lookup).

Thanks :)

Reply