Thanks lars,

The use of a (default) construct method is something I cheer!
For now I think I will follow your advise and combine the two
classes. It is easier to use and it will save me some headaches.

Do you also have an idee for the (consequently) second question?
About knowing when a specific dialogfield has the focus?

/b




--- In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:
> Hi Byteway,


> In e.g. Java, it's important to keep a low coupling and high
cohesion - to assign responsibilities. That's correct. However, in
Axapta RunBase classes, the dialog is programmed in the same class as
where the "application" is, unless you use a form in the dialog
method. In Java this is often done in another way. A good pattern of
OO development is the GRASP patterns. Look at
http://www.onr.com/user/loeffler/java/grasp.html
<http://www.onr.com/user/loeffler/java/grasp.html>  for a brief
description.

> But these things are not all applied in Axapta in my opinion.
Therefore: Follow the best practice in Axapta (look at existing
RunBase / RunBaseBatch classes). :o)

> And no - don't add extra arguments in the main method. This is not
best practice. Instead, consider creating a construct method.


> //Lars

>
> -----Original Message-----
> From: byteway_so [mailto:[EMAIL PROTECTED]
> Sent: 27. juli 2004 11:08
> To: [EMAIL PROTECTED]
> Subject: [development-axapta] Re: Passing Args
>
>
> The reason for creating a seperate class is because of the
different
> usage for the objects (read: object responsability). So now I have
a
> myNewClass that can be run by itself, or it can be started through
a
> dialog (that builds an instance of the class). I think it is best
> practise to keep the implementation in line with the genral OO
spirit.
> I have looked over the tutorial form but it can't provide me the
> knowledge I need...
> I also know that the args can be used to pas 1 variable, or a
couple
> of variables (when passed from a 'normal' form) or when given a
class
> object. (what is the idee behind this sollution???)
>
> But that's not the question.
>
> What I meant to ask is: [answer yes or no] Is it according best
> practise to alter the main method so that it takes a different
> parameter: instead of the default Args, it could be some xString
and
> a xDate variable.
>
>
> Another thing that comes to mind is the (no) way axapta allows the
> programmer to reassign methods, or override them at runtime. The
idee
> is to invoke the "dialogSelectCtrl"-method only when a specic
> formcontrol is selected.
> For example:
> - Create a dialog at runtime
> - add a combobox field
> - add a radiobuttonfield
>
> Now there is a method 'enter' which applies to both the radiobutton
> as well as the combobox. But I can't get a handle of this method.
> Try this:
> //declare
> FormBuildRadioControl r;
> //use it
> r = radiobuttonfield.fieldControl();
> //now try and determine if this control has got the focus
> //if r.gotfocus -> does not work
> //if r.enter -> is not reachable
>
> Thanks for you input so far, I hope you can help me a bit more;-)
>
> /b
>
>
>
>
>
>
>
>
>
> --- In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:
> > Hi Byteway,
> > 
> > 
> > Why do you want to use a separate class to display a dialog?
> Perhaps you should consider to inherite your class from RunBase or
> RunBaseBatch and use the dialog method instead. Have a look at the
> nice called tutorial Tutorial_RunbaseBatch.
> > 
> > You can parse an object with args like this:
> > 
> > Args args = new Args();
> > MyClass class = new Class();
> > MyNewClass newClass;
> > 
> > args.parmObject(class);
> > newClass = MyNewClass::main(args);
> > 
> > Args also enables you to parse e.g. strings and enums, like this:
> > 
> >     args = new args();
> >     args.parmEnumType(enumnum(NoYes));
> >     args.parmEnum(NoYes::Yes);
> >     args.parm("Test");
> >
> > //Lars
> > 
> > 
> > 
> >
> >  -----Original Message-----
> > From: byteway_so [mailto:[EMAIL PROTECTED]
> > Sent: 26. juli 2004 13:44
> > To: [EMAIL PROTECTED]
> > Subject: [development-axapta] Re: Passing Args
> >
> >
> >
> > But what do you do when you want to solve it using the Axapta
best
> > practise? In this case I have a dialog that runs a NewMyClass().
> >
> > In the main-method of the dialog I would have something like:
> > //...
> > Args myArgs;
> > MyNewClass myNewClass;
> > ;
> >
> >   if(dlg.prompt())
> >   {
> >     dlg.run();
> >
> >     //I need something to pass the values
> >     myArgs = new Args("aFileName", "date", "amount");//->does not
> > compile
> >
> >     //Then I would like to create an instance of MyNewClass using
> >     myNewClass = MyNewClass::main(myArgs);
> >
> > }
> >
> > So the initial question asked before is still valid.
> > How to solve this (design) problem?
> > That is: how to pass variables from a dialog to a (new) class
> object?
> >
> > * Should I create a newMyClass with a main method that contains a
> > container instead of the Args object? Or is there a better (best
> > practise) way?
> >
> > like:
> >
> > static void main(container _container)
> > {
> >   //...
> > }
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor     
> >
> > ADVERTISEMENT
> > 
> <
http://us.ard.yahoo.com/SIG=129uqajp5/M=295196.4901138.6071305.300117
<http://us.ard.yahoo.com/SIG=129uqajp5/M=295196.4901138.6071305.300117
>
>
6/D=groups/S=1705006764:HM/EXP=1090931858/A=2128215/R=0/SIG=10se96mf6/
> * http://companion.yahoo.com <http://companion.yahoo.com> > click
here     
> >   < http://us.adserver.yahoo.com/l?
<http://us.adserver.yahoo.com/l?>
>
M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=2705234
> 72>      
> >
> >
> >   _____ 
> >
> > Yahoo! Groups Links
> >
> >
> > *      To visit your group on the web, go to:
> > http://groups.yahoo.com/group/development-axapta/
<http://groups.yahoo.com/group/development-axapta/
> < http://groups.yahoo.com/group/development-axapta/
<http://groups.yahoo.com/group/development-axapta/> >
> >  
> >
> > *      To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
<mailto:development-
> [EMAIL PROTECTED]>
> >  
> >
> > *      Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> Service < http://docs.yahoo.com/info/terms/
<http://docs.yahoo.com/info/terms/> > .
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
>
>
>
> Yahoo! Groups Sponsor     
>
> ADVERTISEMENT

<http://us.ard.yahoo.com/SIG=129u3e4hv/M=295196.4901138.6071305.300117
6/D=groups/S=1705006764:HM/EXP=1091005883/A=2128215/R=0/SIG=10se96mf6/
*http://companion.yahoo.com> click here     
>   <http://us.adserver.yahoo.com/l?
M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=9646278
90>      
>
>
>   _____ 
>
> Yahoo! Groups Links
>
>
> *      To visit your group on the web, go to:
> http://groups.yahoo.com/group/development-axapta/
<http://groups.yahoo.com/group/development-axapta/>
>  
>
> *      To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED] <mailto:development-
[EMAIL PROTECTED]>
>  
>
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .
>
>
>
>
> [Non-text portions of this message have been removed]


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to