Re: @ operator ? Or maybe not
- From: "Tom de Neef" <tdeneef@xxxxxxxx>
- Date: Tue, 25 Oct 2005 15:10:50 +0200
"J French" <erewhon@xxxxxxxxxx> schreef in bericht
news:435e1015.98249891@xxxxxxxxxxxxxxxxxxxxxxx
> On Mon, 24 Oct 2005 23:15:47 +0200, "Tom de Neef" <tdeneef@xxxxxxxx>
> wrote:
>
>>Suppose
>
>>type
>> myClass = class
>> button : Tbutton;
>> procedure method1(Sender: TObject);
>> procedure method2(Sender: TObject);
>> end;
>
>>And somewhere I've assigned
>>myClass.button.OnClick:=myClass.method1;
>
>>How can I now verify if the OnClick is assigned to method1 or method2 ?
>>I'd like to do
>> button.enabled:=(@button.Onclick = @method1);
>
>>But that isn't valid...
>
<snip>
> I have a nasty gut feeling that what you are trying to do is seriously
> bad design - you are trying to let the Children identify their
> Parents, which is a recipe for spaghetti
>
Maybe you have a point there. But the fault in the design is then that one
button can have two purposes.
The button is labeled VIEW (on the main window). When the program starts its
function is to call up an error report about the input files. It should not
be enabled when there are no errors. During further execution VIEW is used
to view the results of a run.
For the user this one button is very intuitive.
This calls for a (button.enabled) test to see if the process behind the
button is error reporting or output viewing. I.e. what is assigned to the
OnClick handler.
I guess your suggestion of a two descendants of Tbutton will work just fine.
Tom
.
- Follow-Ups:
- Re: @ operator ? Or maybe not
- From: alanglloyd@xxxxxxx
- Re: @ operator ? Or maybe not
- References:
- @ operator ? Or maybe not
- From: Tom de Neef
- Re: @ operator ? Or maybe not
- From: J French
- @ operator ? Or maybe not
- Prev by Date: Re: Enum order in component view
- Next by Date: Re: Enum order in component view
- Previous by thread: Re: @ operator ? Or maybe not
- Next by thread: Re: @ operator ? Or maybe not
- Index(es):