Passing parameters to methods 
Author Message
 Passing parameters to methods

I would like to pass a parameter to the InitDialog method, like this:

/***************************************************************************
*/
/* Copyright (C) All Rights Reserved.
*/
/***************************************************************************
*/
if Arg()>0 then parse arg inputfile   /* Adapt arg_list to fit your wishes
*/
else arg_list = "c:\test.txt"

RCfile = ".\FLATFILE.RC"
dlg = .MyDialog~new
if dlg~InitCode <> 0 then Exit
if dlg~Load(RCfile,100) > 0 then
Do
 Say "Error loading Resource file:" RCfile
 Exit
End
dlg~Execute("SHOWTOP")
dlg~deinstall
exit 0
::requires "OODIALOG.CLS"

::class MyDialog subclass UserDialog
::method InitDialog
Expose inputfile
 self~FromFile = inputfile    /* set inputfield in dialog to parameter */

However, this does not work!

Do do I do this?

Thanks,
Wim Dirks



Tue, 05 Apr 2005 21:40:47 GMT  
 Passing parameters to methods

says...

Quote:
> I would like to pass a parameter to the InitDialog method, like this:

> /***************************************************************************
> */
> /* Copyright (C) All Rights Reserved.
> */
> /***************************************************************************
> */
> if Arg()>0 then parse arg inputfile   /* Adapt arg_list to fit your wishes
> */
> else arg_list = "c:\test.txt"

> RCfile = ".\FLATFILE.RC"
> dlg = .MyDialog~new
> if dlg~InitCode <> 0 then Exit
> if dlg~Load(RCfile,100) > 0 then
> Do
>  Say "Error loading Resource file:" RCfile
>  Exit
> End
> dlg~Execute("SHOWTOP")
> dlg~deinstall
> exit 0
> ::requires "OODIALOG.CLS"

> ::class MyDialog subclass UserDialog
> ::method InitDialog
> Expose inputfile
>  self~FromFile = inputfile    /* set inputfield in dialog to parameter */

> However, this does not work!

> Do do I do this?

> Thanks,
> Wim Dirks

dlg = .MyDialog~new(inputfile)
...
...
::class MyDialog subclass UserDialog
::method init
self~Fromfile = arg(1)


Tue, 05 Apr 2005 21:59:04 GMT  
 Passing parameters to methods
Yes,
Eggs all over my face.
Thanks.
Wim Dirks



Quote:

> says...
> > I would like to pass a parameter to the InitDialog method, like this:

/***************************************************************************
Quote:
> > */
> > /* Copyright (C) All Rights Reserved.
> > */

/***************************************************************************
Quote:
> > */
> > if Arg()>0 then parse arg inputfile   /* Adapt arg_list to fit your
wishes
> > */
> > else arg_list = "c:\test.txt"

> > RCfile = ".\FLATFILE.RC"
> > dlg = .MyDialog~new
> > if dlg~InitCode <> 0 then Exit
> > if dlg~Load(RCfile,100) > 0 then
> > Do
> >  Say "Error loading Resource file:" RCfile
> >  Exit
> > End
> > dlg~Execute("SHOWTOP")
> > dlg~deinstall
> > exit 0
> > ::requires "OODIALOG.CLS"

> > ::class MyDialog subclass UserDialog
> > ::method InitDialog
> > Expose inputfile
> >  self~FromFile = inputfile    /* set inputfield in dialog to parameter
*/

> > However, this does not work!

> > Do do I do this?

> > Thanks,
> > Wim Dirks

> dlg = .MyDialog~new(inputfile)
> ...
> ...
> ::class MyDialog subclass UserDialog
> ::method init
> self~Fromfile = arg(1)



Wed, 06 Apr 2005 02:01:38 GMT  
 Passing parameters to methods
By the way, must the passed parameter be a stem variable?
Wim


Quote:
> Yes,
> Eggs all over my face.
> Thanks.
> Wim Dirks




> > says...
> > > I would like to pass a parameter to the InitDialog method, like this:

/***************************************************************************
Quote:
> > > */
> > > /* Copyright (C) All Rights Reserved.
> > > */

/***************************************************************************
Quote:
> > > */
> > > if Arg()>0 then parse arg inputfile   /* Adapt arg_list to fit your
> wishes
> > > */
> > > else arg_list = "c:\test.txt"

> > > RCfile = ".\FLATFILE.RC"
> > > dlg = .MyDialog~new
> > > if dlg~InitCode <> 0 then Exit
> > > if dlg~Load(RCfile,100) > 0 then
> > > Do
> > >  Say "Error loading Resource file:" RCfile
> > >  Exit
> > > End
> > > dlg~Execute("SHOWTOP")
> > > dlg~deinstall
> > > exit 0
> > > ::requires "OODIALOG.CLS"

> > > ::class MyDialog subclass UserDialog
> > > ::method InitDialog
> > > Expose inputfile
> > >  self~FromFile = inputfile    /* set inputfield in dialog to parameter
> */

> > > However, this does not work!

> > > Do do I do this?

> > > Thanks,
> > > Wim Dirks

> > dlg = .MyDialog~new(inputfile)
> > ...
> > ...
> > ::class MyDialog subclass UserDialog
> > ::method init
> > self~Fromfile = arg(1)



Wed, 06 Apr 2005 02:24:14 GMT  
 Passing parameters to methods


Quote:
> By the way, must the passed parameter be a stem variable?
> Wim

No, it doesn't matter.


Wed, 06 Apr 2005 02:33:37 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to pass parameters to methods invoked through Tkinter 'command' option?

2. Parameter passing to a method

3. OCXs: Parameter passing and calling method...

4. Passing Parameters to an OCX method

5. parameter passing methods

6. Retrival of parameters passed by POST method

7. Python scope and parameter passing method

8. Passing a parameter Rexx to JCL and return a parameter to JCL

9. language rules question: using a (passed in) parameter to define a parameter

10. Methods as parameters to methods?

11. Are method args pass-by-value or pass-by-reference

12. APL+Win and array parameter passing from OCX

 

 
Powered by phpBB® Forum Software