EQUATEs - usage question

Hi All,

I have modified equates.clw to include a few more COLOR: equates for text and panels (regions) etc.

Is the flow of values from an EQUATE uni-directional? For example:

I created a new equate in equates.clw - COLOR:InfoText EQUATE(0AE5F16H)
I then assign the color of a string property to be COLOR:InfoText

So far so good, the string changes color as expected.

I modify the the color in equates.clw thus - COLOR:InfoText EQUATE(0F9F9F9H)

I close Clarion, start it up and open the app but the string has retained the original color, it no longer has the EQUATE name COLOR:InfoText in the color property, it has 0AE5F16H instead. If I type in COLOR:InfoText it changes to the new color.

I assume then that the color property in the STRING control ‘looks up’ the EQUATE to try and match it, otherwise it uses the value it has stored somewhere. Is that correct?

It was my intention to have the color of ‘informational text’ EQUATEd to a particular value. If I needed/wanted to change it all I needed to do was change the value of the EQUATE and recompile. This doesn’t seem to be the case.

Is that the correct method or have I misunderstood the purpose of an EQUATE?

Is there a better method to achieve my objective?

Cheers,

Well, changing equates.clw isn’t a good idea because it will be overwritten with every update of Clarion.

Having a colors.clw file that you can include into any app would be a better option.

I don’t know when the equate values are applied, obviously when the equate is used, but I suspect the value will also be applied on a recompile of your app?

1 Like

An EQUATE is just a label assignment. The value is “substituted” at compile time and does not use run-time memory.

Instead of altering the shipping equate file, it is recommended practice to create one or several categorized equate files that can be included as needed. For instance, one might have something like ProgramColors, AppIcons, or ClientConstants as equate files.

Thanks PurpleEdge2214 and totalhip.
I understand the perils of modifying a shipped file - I will create a dedicated file and include() it somewhere.

totalhip, you state ‘An EQUATE is just a label assignment. The value is “substituted” at compile time and does not use run-time memory.’ This doesn’t seem to be happening.

I expected that when I changed the value of the EQUATE that the string control, in this case, would ‘inherit’ the new value. It doesn’t, instead it retains the original value of the EQUATE. This behaviour I did not expect.

When you recompile, the new equate value will be used. For your string control, make sure all or the relevant app file is recompiled.

I stand corrected.

I’m sure I tested my theory thoroughly yesterday - but you are right. Changing the value and compiling DOES use the new value.

Viewing the properties of the control after changing the EQUATE shows old values.

My bad - apologies for any confusion caused

1 Like

No problem. We’ve all have been there before.

1 Like