Subject: Re: IllegalCastException with REALbasic 2006r3
From: Neil Green <[EMAIL PROTECTED]>
Date: Sat, 15 Jul 2006 13:47:18 +0100
On 15 Jul 2006, at 13:13, Emile Schwarz wrote:
New in REALbasic 2006r3 [Mac OS X 10.4.7]
The following line gets an error in r3, but works fine in r2:
If Canvas(Self.Focus) = Me Then
but the corrected lines works OK:
Dim theCtrl As Control
// Get the Control who have the focus
theCtrl = Self.Focus
// Toogle the current Focus (value)
If Canvas(theCtrl) = Me Then
The error was IllegalCastException.
The code is in Canvas1.MouseDown...
Why ?
IllegalCast Exception follow-up
-------------------------------
REALbasic 2006r3 Commercial Pro
Mac OS X 10.4.7
The newly changed code does not works too, now, several minutes
after the previous change:
Dim theCtrl As Control
Dim ChoosedColor As Variant
// Get the Control who have the focus
theCtrl = Self.Focus
// Toogle the current Focus (value)
If Canvas(theCtrl) = Me Then
and once I have added the second Dim line (and code below the
If .../... Else If block!
What happens ?
I've made a simple change in the code:
Dim theCtrl As Control
Dim myCanvas As Canvas
Dim ChoosedColor As Variant
// Get the Control who have the focus
theCtrl = Self.Focus
// Toogle the current Focus (value)
myCanvas = Canvas(theCtrl)
If myCanvas = Me Then
How many times will that work ?
Emile
_______________________________________________
Hi Emile,
I don't know what else is on your window but Canvas(theCtrl) will
only work if a Canvas has the focus. The Mousedown event will occur
before the Canvas that you are clicking gets the focus. Perhaps the
difference is that a Canvas does not automatically get the focus in
R3 but did in R2?
Regards,
Neil.
Hi Neil,
there is only a Canvas on that Window.
My last "solution" is still working nearly a day after I implemented it.
I do not know how many times/day/Week/Month/whatever :) time it will
continue to work...
No, Canvas did not gain Focus on itself. After the window is displayed:
one click gave it Focus, every other clicks toogle the Focus (on of off
depending on the previous value).
Some other comment ?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>