realbasic-nug
[Top] [All Lists]

Re: The SuperClass already implemented the event???

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: The SuperClass already implemented the event???
From: William Shank <trochoid@gmail.com>
Date: Thu, 26 Feb 2009 16:32:46 -0800
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com; dkim=neutral (body hash did not verify) header.i=@gmail.com
Delivered-to: listarchive@realsoftware.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=LNt4G1vuAopnR4wyXd4chZU7vZx/qWGPvm9f+zFzVsc=; b=jwePNIu8WFnOfGBPC+JM8E+wl2U3uA6t4FEbLa6ukbpRW5rLAvqIksGH6DDEGTmXYt ooP+9FjLSTaDBy9yqg+2PmxRyuHN5oOoDKsHsuKy7CUVy8e6YpQXKU8f/pQRVupPgord xuEQ4aAhc85GFk6Tyxv0pOMG6cpU7+29RRtw8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=xsQq8DAbKF8MfVsBqoSZ9Hh4OPSuSStm71hqWlL7D1cOKIIw1SJG3wk5YyegNTOarQ UTTltG6R+F31N5JLatKrBXU1FqIiR1Oet0GwTR71OX40mrfGBBxi/ZUbI3yZhfrWUho6 aJBUNLJIYbzILjlO88qPceNauK9SRoozXStHA=
In-reply-to: <23974611.43218.1235655739076.JavaMail.www@wwinf2227>
References: <23974611.43218.1235655739076.JavaMail.www@wwinf2227>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Thu, Feb 26, 2009 at 5:42 AM, emile.a.schwarz
<emile.a.schwarz@wanadoo.fr> wrote:
> on  implements the event "Down," but its SuperClass already implemented the 
> event.
....
> The last time I have this kind of error, I removed the code and lost the 
> events (and my code is no more in the project).

I've run into this before and it seems to be that RB doesn't like
overridden events. That's why if you implement a classes event then
make a subclass, the subclass doesn't have that event. But you can
trick it by implementing the subclasses event _first_ then go to the
super and the event is still there and you can enter code. When both
super and sub have the same event coded, notice that the subclasses
event is now in italic. There's two situations I've seen this, with
different behaviors.

1) create Class1, a subclass of Canvas
create Class2, a subclass of Class1
in class2.mouseDown put: MsgBox "2"
now in class1.mouseDown put: MsgBox "1"

mouseDown in class2 is now italic. But you can use these classes, they
compile and msgbox the correct number.

2) create Class1, a subclass of Canvas
put instance of Class1 on a window, name it myWidget
in myWidget.mouseDown put something
now in Class1.mouseDown put something

mouseDown in myWidget is italic. This situation gives your error.

In both situations, removing the code from the italic event makes that
event disappear (because the super is handling it) and undoing doesn't
bring it back, it just goes away. So look for italic events!

What you probably want to do is add a new event 'Down' to your
superclass. In the superclasses Down event call the new Down event.
Now the subclass has a Down event but it actually comes from the new
event of the super.
This page might explain it better http://www.applelinks.com/rbu/091/
scroll down to 'deleting objects'.           hth -w

ps. I find it weird that situation 1) does compile and overrides as expected.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>