RTE bug? [was Re: "Preview screen" button]
Graham
graham.samuel at wanadoo.fr
Sun Aug 10 09:14:00 EDT 2003
On Sat, 9 Aug 2003 18:45:29 -0600, "Scott Raney" <raney at metacard.com> wrote:
>On Fri, 08 Aug 2003 Graham <graham.samuel at wanadoo.fr> wrote:
> > My comment is that this just happened to me yesterday, in a very slightly
> > different form. I had the name of an image in a variable, and this
> > statement crashed RunRev:
>
> > set the icon of btn "theGIF" of cd "Demo" to image ATgCurrentGIF of cd
> > "GIFWell"
>
> > As with John's problem, it was the token 'image' that caused the crash.
>
>I can't reproduce this. Does it depend on the image? Sure you're not just
>running out of memory or something? (your script does take all of the data
>in that image and start flinging it around, which of course is not what you
>wanted to do).
Don't think so - but I will do more tests to boil the thing down before
declaring it as a bug.
> > I found it totally repeatable - I think it's a bug in the engine. IMO,
> > **no** syntactically incorrect statement should crash RunRev, but this is
> > certainly what happens on my configuration (PC with Windows XP Home
> > Edition, French). This is all the more disturbing since logically the use
> > of the token 'image' appears to be correct - it appears to be an
> > eccentricity of the language that one **doesn't** have to put 'image' at
> > this point.
>
>Not at all: it's a *feature* that you can access the raw data in an image
>this way, by using it as a container. But the icon property take a number
>(an id), not the raw data (else, it'd be horribly inefficient because you'd
>have duplicate copies of all the image data around in each button that
>uses the icon).
Well, I see what you mean internally, but for me the issue is that as a
scripter, I would expect to refer to any object by its object type and its
name, like
image "myImage"
graphic "myGrc"
etc.
Clearly the engine just wants the ID, but it's willing to get it from the
name of the object. I never included the ID directly in my icon-setting: a
bit of code which works is
set the icon of button "myChangingButton" of cd "Display" to ATgCurrentGIF
where ATgCurrentGIF just contains the short name of a GIF (i.e. not an ID).
So from the point of view of 'syntactic sugar', the scripter expects to
have to qualify the object's name with its type. The scripter is not
apparently dealing with IDs at all.
Since writing my first message on this topic, I have found that since ID's
are not unique across stacks, a statement like
set the icon of button "myChangingButton" to "myAnimatedGIF"
doesn't always work. If the engine can find "myAnimatedGIF", it extracts
its ID and uses this to set the icon, but in fact some kind of scope rules
are operating. If "myAnimatedGIF" resides for example in a card in another
stack, and if there is a more local object with the same ID (not the same
name), it's this one's picture that will end up in the button and not the
picture from "myAnimatedGIF".
I now have to work out how to avoid this. It will be worth it because this
combination of buttons and icons (suggested on the list) does provide me
with what I need - a series of different pictures which share the same set
of custom properties and the same script.
Graham
---------------------------------------------------
Graham Samuel / The Living Fossil Co. / UK & France
More information about the use-livecode
mailing list