Author: Michael Babcock, mbabcock@kepro.org
Posted: 1999-10-08 11:44:12 Link
I have a subclassed form "frmDates". I want to use class, but slightly change
the functionality of two of its textboxes right-click event. Must I do
another DEFINE or is there a way to directly change the logic for an item for
this instance only? Examples are greatly appreciated!
'sortof' pseudo-code of what I want to accomplish:
oFrm = createobject("frmDates")
oFrm.MyTxtBox.rt-click procedure = <change of logic>
TIA,
--Mike
********************************
Michael Babcock
KePRO, Inc.
Tel: 717-564-8288
Fax: 717-564-4188
Internet Address: mbabcock@kepro.org
Home Page: http://www.kepro.org
********************************
Author: Ed Leafe, ed@leafe.com
Posted: 1999-10-08 11:59:29 Link
On 10/8/99 11:44 AM, Michael Babcock supposedly said:
>I have a subclassed form "frmDates". I want to use class, but slightly
>change
>the functionality of two of its textboxes right-click event. Must I do
>another DEFINE or is there a way to directly change the logic for an item for
>this instance only? Examples are greatly appreciated!
>
>'sortof' pseudo-code of what I want to accomplish:
> oFrm = createobject("frmDates")
> oFrm.MyTxtBox.rt-click procedure = <change of logic>
You cannot modify the code of an instance. You'll either have to
subclass, or bracket your RightClick() code to do different things based
on some form property:
DO CASE
CASE Thisform.cBehavior = "Foo"
{do 'foo' right-click stuff}
CASE Thisform.cBehavior = "Bar"
{do 'bar' right-click stuff}
ENDCASE
Then when you create your form, do the following:
oFrm = createobject("frmDates")
oFrm.cBehavior = "Bar"
oFrm.Show()
___/
/
__/
/
____/
Ed Leafe
Author: Miller, Tony, tmiller@probusiness.com
Posted: 1999-10-08 12:07:26 Link
In the subclassed item's method you want modified, you can just have you
code execute, as apposed to the inherited parents code run..
> -----Original Message-----
> From: Michael Babcock [SMTP:mbabcock@kepro.org]
> Sent: Friday, October 08, 1999 8:44 AM
> To: Multiple recipients of ProFox
> Subject: (subclassing) Modifying an existing functionality
>
> I have a subclassed form "frmDates". I want to use class, but slightly
> change
> the functionality of two of its textboxes right-click event. Must I do
> another DEFINE or is there a way to directly change the logic for an item
> for
> this instance only? Examples are greatly appreciated!
>
> 'sortof' pseudo-code of what I want to accomplish:
> oFrm = createobject("frmDates")
> oFrm.MyTxtBox.rt-click procedure = <change of logic>
>
> TIA,
> --Mike
>
> ********************************
> Michael Babcock
> KePRO, Inc.
> Tel: 717-564-8288
> Fax: 717-564-4188
> Internet Address: mbabcock@kepro.org
> Home Page: http://www.kepro.org
> ********************************
>
>
Author: Bourque, Chad, Chad@teche.net
Posted: 1999-10-08 12:08:21 Link
Mike,
You would need to subclass your frmDates and put the new login in there.
So, if your frmDates is hand-coded as opposed to a vcx, then yes, you would
have to use another DEFINE. If it is a vcx, just create a new form class
based on frmDates and put your new logic in there.
HTH
Chad Bourque
U.S. Bankruptcy Court - 11th Circuit
Alabama - Northern District - Southern Division
Chad@teche.net
----- Original Message -----
From: Michael Babcock <mbabcock@kepro.org>
To: Multiple recipients of ProFox <profox@leafe.com>
Sent: Friday, October 08, 1999 10:44 AM
Subject: (subclassing) Modifying an existing functionality
I have a subclassed form "frmDates". I want to use class, but slightly
change
the functionality of two of its textboxes right-click event. Must I do
another DEFINE or is there a way to directly change the logic for an item
for
this instance only? Examples are greatly appreciated!
'sortof' pseudo-code of what I want to accomplish:
oFrm = createobject("frmDates")
oFrm.MyTxtBox.rt-click procedure = <change of logic>
TIA,
--Mike
********************************
Michael Babcock
KePRO, Inc.
Tel: 717-564-8288
Fax: 717-564-4188
Internet Address: mbabcock@kepro.org
Home Page: http://www.kepro.org
********************************
Author: Michael Babcock, mbabcock@kepro.org
Posted: 1999-10-08 12:28:41 Link
It's from a vcx using CREATEOBJECT(), not an .scx subclassed form. (Or do I
misunderstand you?) --Mike
>>> "tmiller@probusiness.com" 10/08/99 12:19pm >>>
In the subclassed item's method you want modified, you can just have you
code execute, as apposed to the inherited parents code run..
> -----Original Message-----
> From: Michael Babcock [SMTP:mbabcock@kepro.org]
> Sent: Friday, October 08, 1999 8:44 AM
> To: Multiple recipients of ProFox
> Subject: (subclassing) Modifying an existing functionality
> > I have a subclassed form "frmDates". I want to use class, but slightly
> change
> the functionality of two of its textboxes right-click event. Must I do
> another DEFINE or is there a way to directly change the logic for an item
> for
> this instance only? Examples are greatly appreciated!
> > 'sortof' pseudo-code of what I want to accomplish:
> oFrm = createobject("frmDates")
> oFrm.MyTxtBox.rt-click procedure = <change of logic>
> > TIA,
> --Mike
> > ********************************
> Michael Babcock
> KePRO, Inc.
> Tel: 717-564-8288
> Fax: 717-564-4188
> Internet Address: mbabcock@kepro.org
> Home Page: http://www.kepro.org
> ********************************
> > ********************************
Michael Babcock
KePRO, Inc.
Tel: 717-564-8288
Fax: 717-564-4188
Internet Address: mbabcock@kepro.org
Home Page: http://www.kepro.org
********************************
Author: Paul McNett, pmcnett@pcs-blc.com
Posted: 1999-10-08 12:57:11 Link
On 8 Oct 99, at 12:28, Michael Babcock wrote:
> It's from a vcx using CREATEOBJECT(), not an .scx subclassed form. (Or do
> I misunderstand you?) --Mike
Mike, .scx's are not classes, but forms that are either subclassed
from a vcx library, or from the VFP base classes.
The fact that you have a your form in a vcx means that all you have
to do is create a new class based on frmdates, put your overriding
code in the appropriate places, and then, instead of issuing
CREATEOBJECT("frmdates"), issue CREATEOBJECT("frmnewdates").
Paul McNett
Computer Consultant / Custom Application Developer
Professional Computer Solutions
Hollister, CA 95023
mailto:pmcnett@pcs-blc.com
Author: Michael Babcock, mbabcock@kepro.org
Posted: 1999-10-08 13:52:24 Link
Paul,
That's what I kind of thought but ruled that out after reading Ed's reply. But then again, I'm not well today (sick) so I'm somewhat in the fog. I need
the weekend <g>.
So can I do this on the fly programmatically, or am I limited to having to use
the GUI development? I would think I should be able to do it in code, but the
DEFINE CLASS helpdoc makes me wonder how I alter an existing object's method. I'm not adding an object, because it's already there. So how I address this? --Mike
>>> "pmcnett@pcs-blc.com" 10/08/99 01:15pm >>>
On 8 Oct 99, at 12:28, Michael Babcock wrote:
> It's from a vcx using CREATEOBJECT(), not an .scx subclassed form. (Or do
> I misunderstand you?) --Mike
Mike, .scx's are not classes, but forms that are either subclassed from a vcx
library, or from the VFP base classes.
The fact that you have a your form in a vcx means that all you have to do is
create a new class based on frmdates, put your overriding code in the
appropriate places, and then, instead of issuing CREATEOBJECT("frmdates"),
issue CREATEOBJECT("frmnewdates").
Paul McNett
Computer Consultant / Custom Application Developer
Professional Computer Solutions
Hollister, CA 95023
mailto:pmcnett@pcs-blc.com
********************************
Michael Babcock
KePRO, Inc.
Tel: 717-564-8288
Fax: 717-564-4188
Internet Address: mbabcock@kepro.org
Home Page: http://www.kepro.org
********************************
Author: Ed Leafe, ed@leafe.com
Posted: 1999-10-08 14:09:57 Link
On 10/8/99 1:52 PM, Michael Babcock supposedly said:
>So can I do this on the fly programmatically, or am I limited to having to
>use the GUI development? I would think I should be able to do it in code,
>but the DEFINE CLASS helpdoc makes me wonder how I alter an existing
>object's method. I'm not adding an object, because it's already there. So
>how I address this?
If you are doing this in code, just re-define the method. So if you
have a textbox named "txtBlah" on your form and you want to override its
RightClick() method, you'd add a proc to your define as follows:
PROCEDURE txtBlah.RightClick
{your custom code here}
ENDPROC
If you are creating the forms using the visual tools, just open the
code editing window, select the proper control and method, and add your
code. That's it!
___/
/
__/
/
____/
Ed Leafe
Author: Allan Lindgren, allan_lindgren@starkey.com
Posted: 1999-10-08 14:39:00 Link
Michael,
a method is code and will be compiled prior to run time. You can not
write new code durring run time
the define class is a development code not a runtime code
if you make a procedure file [.prg] with a define class, then if you set
procdure to <myproc>
you can use the define clss when you do createobject(<myclass>)
HTH
Michael Babcock wrote:
>
> Paul,
>
> That's what I kind of thought but ruled that out after reading Ed's reply. But then again, I'm not well today (sick) so I'm somewhat in the fog. I need
> the weekend <g>.
>
> So can I do this on the fly programmatically, or am I limited to having to use
> the GUI development? I would think I should be able to do it in code, but the
> DEFINE CLASS helpdoc makes me wonder how I alter an existing object's method. I'm not adding an object, because it's already there. So how I address this? --Mike
>
[snip]
--
Allan Lindgren
allan_lindgren@starkey.com
If you offer me a penny for my thoughts,
and I give you my two cents worth,
Who gets the change?
Author: Michael Babcock, mbabcock@kepro.org
Posted: 1999-10-08 15:08:28 Link
Well that makes sense; I know that. Man, I'm really out of it today (sick). That's it...no more questions today....time for nappy.... <g>.
>>> "allan_lindgren@starkey.com" 10/08/99 02:55pm >>>
Michael,
a method is code and will be compiled prior to run time. You can not
write new code durring run time
the define class is a development code not a runtime code
if you make a procedure file [.prg] with a define class, then if you set
procdure to <myproc>
you can use the define clss when you do createobject(<myclass>)
HTH
Michael Babcock wrote:
> > Paul,
> > That's what I kind of thought but ruled that out after reading Ed's reply.
But then again, I'm not well today (sick) so I'm somewhat in the fog. I need
> the weekend <g>.
> > So can I do this on the fly programmatically, or am I limited to having to
use
> the GUI development? I would think I should be able to do it in code, but
the
> DEFINE CLASS helpdoc makes me wonder how I alter an existing object's
method. I'm not adding an object, because it's already there. So how I
address this? --Mike
> [snip]
-- Allan Lindgren
allan_lindgren@starkey.com
If you offer me a penny for my thoughts,
and I give you my two cents worth,
Who gets the change?
********************************
Michael Babcock
KePRO, Inc.
Tel: 717-564-8288
Fax: 717-564-4188
Internet Address: mbabcock@kepro.org
Home Page: http://www.kepro.org
********************************