www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



digitalmars.D.learn - Subclass method

↑ ↓ ← June <somewhere so.com> writes:
I want to add a methd to an instance of dwt.widgets.Text.

void setText(char[] name, char[] text){  name.setText(text);}

there is  ' setText(char[] text)  ' in the base class

each instance has a name. I cannot get this to work? 
the Tango book covers this very weakly
May 06 2008
↑ ↓ BCS <ao pathlink.com> writes:
Reply to June,

 I want to add a methd to an instance of dwt.widgets.Text.
 
 void setText(char[] name, char[] text){  name.setText(text);}
 
 there is  ' setText(char[] text)  ' in the base class
 
 each instance has a name. I cannot get this to work? the Tango book
 covers this very weakly
 

I'm not following what you want to do. Do you want to add methods to a class that inherits from dwt.widgets.Text? Do you want to add a method to a particular object at run time? (BTW this is not possible) Do you want to add method to a the dwt.widgets.Text class?
May 06 2008
↑ ↓ June <somewhere so.com> writes:
BCS Wrote:

 Reply to June,
 
 I want to add a methd to an instance of dwt.widgets.Text.
 
 void setText(char[] name, char[] text){  name.setText(text);}
 
 there is  ' setText(char[] text)  ' in the base class
 
 each instance has a name. I cannot get this to work? the Tango book
 covers this very weakly
 

I'm not following what you want to do. Do you want to add methods to a class that inherits from dwt.widgets.Text?

Yes
May 06 2008
BCS <ao pathlink.com> writes:
Reply to June,

 BCS Wrote:
 
 Reply to June,
 
 I want to add a methd to an instance of dwt.widgets.Text.
 
 void setText(char[] name, char[] text){  name.setText(text);}
 
 there is  ' setText(char[] text)  ' in the base class
 
 each instance has a name. I cannot get this to work? the Tango book
 covers this very weakly
 

Do you want to add methods to a class that inherits from dwt.widgets.Text?


class MyClass : dwt.widgets.Text { void setText(char[] name, char[] text){ name.setText(text);} } does that work for what you want?
May 06 2008
↑ ↓ → June <somewhere so.com> writes:
BCS Wrote:

 Reply to June,
 
 BCS Wrote:
 
 Reply to June,
 
 I want to add a methd to an instance of dwt.widgets.Text.
 
 void setText(char[] name, char[] text){  name.setText(text);}
 
 there is  ' setText(char[] text)  ' in the base class
 
 each instance has a name. I cannot get this to work? the Tango book
 covers this very weakly
 

Do you want to add methods to a class that inherits from dwt.widgets.Text?


class MyClass : dwt.widgets.Text { void setText(char[] name, char[] text){ name.setText(text);} } does that work for what you want?

I just want an extra method to change multiple, named , instances , one at a time by name setText(name,text)
May 06 2008
→ June <somewhere so.com> writes:
June Wrote:

 BCS Wrote:
 
 Reply to June,
 
 I want to add a methd to an instance of dwt.widgets.Text.
 
 void setText(char[] name, char[] text){  name.setText(text);}
 
 there is  ' setText(char[] text)  ' in the base class
 
 each instance has a name. I cannot get this to work? the Tango book
 covers this very weakly
 

I'm not following what you want to do. Do you want to add methods to a class that inherits from dwt.widgets.Text?

Yes

It is also this -I am using numerous text boxes each with a name . and I want to change the text on each as I create it I need a method to make the normal 'setText(text) method into setText( name,text)
May 06 2008