Changing Color via Formula

Changing an object color via formula doesn’t seem to be working, although it did.

For example, the Image Display Object in the Gradient Workshop only changes to the new colors if put into Graphics Mode and moved. The same is true of the HTML Color in the Graphic Editor Demos.

In my experience, changing of object colors (and other object properties) is working well when the form that contains those objects is the active window while the code is executed. So I activate the form in my procedure and then make my object changes. Example:

openform "FormName"
changeobject "ObjectName","color",htmlcolor("007FF8")

When using changeobject it HAS to be the active window – there is currently no way to modify object properties on a non-active window.

I think @JamesCook is actually talking about changing the color of an Image Display object in particular, using the formula in that object as described on this help page.

I recently noticed a problem similar to what @JamesCook is describing, I thought it was something that had gotten broken in the Apple Silicon transition. Perhaps it goes back farther than that. I will investigate.

Update: Looks like this is a problem with recent versions of macOS. It fails on Big Sur, works on Sierra. I think this may be the same issue that caused problems in the data sheet when moving left/right in a row.

What I’m trying to do is to change the color of a rectangle on a form, but not by using a procedure to do it. The rectangle can be an Image Display as in the cited demos or a simple Rectangle. that doesn’t matter so long as I can embed a formula to have its color respond to conditions.

Only the Image Display object can have a formula embedded to specify the color. For all other types of objects, including Rectangles, the color can only be changed with the changeobject statement.

Hmm, shape objects don’t actually use the formula option, so a possible future enhancement would be to allow a color/gradient formula to be used…

On one hand I love it when I give you an idea for some enhancement we can all enjoy.

On the other hand, I hate to give you anything more for your to-do list

1 Like