How to set EQUATE type? Trying to use in FONT

I am trying to use EQUATES in all my WIndow Declaration to get all FONT related settings the same but I am getting below error after setting the size - typeface works:

!!> ERROR(82): Value of parameter has incorrect type

Use:

FONT(APP:FONT:NAME,APP:FONT:SIZE)

Definition inside Global Map:

APP:FONT:NAME EQUATE('Segoe UI Variable Display')
APP:FONT:SIZE EQUATE(8)
APP:FONT:COLOR EQUATE(COLOR:BTNTEXT)
APP:FONT:STYLE EQUATE(FONT:regular)
APP:FONT:CHARSET EQUATE(CHARSET:DEFAULT)

Project is Clarion 11.1.13855 Legacy/Clarion (Non-ABC)

I used Global Variables with an initial value and not equates, this way, I can still alter the font settings for different users with different monitors, when required without having to recompile the program and produce a one off program for the user in question.

So Global Variables do work, but Equates don’t?

I’m surprised that you can use equates in the screen structures. Perhaps they would compile, but the screen designer wouldn’t allow that.

Instead of doing that, I would more likely use a class and template to assign them at runtime when the window is first opened.

If you go that route, note that making too many changes to the window structure between the OPEN and ACCEPT statements can cause instability. To deal with that, I will typically hide the window after it’s opened, then wait for EVENT:OpenWindow. I apply all of the changes at that point, then unhide the window.

You see Equates often in screens like
FONT(,,Color:Black, Font:Bold, CharSet:Default)

The problem is getting them in scope for the IDE to know about them. Maybe if they were in Equates.clw. So have an Equates.clw in your project folder with your extra equates plus Include the file from LibSrc so your have the standard ones. I doubt it will work but it’s worth a try.

The C7 Designer will allow equates or variables for a lot of things it does not need to render in the designer. Like you can have FROM( CreditCardCodesEquate ). You run into a problem with the Window Previewer unless you add your equates to a WindowPreviewer.INC in your project folder.

@RchdR - I tried that, but it still gives me the error - may I ask what types you used?
Currently mine are as follows:

APP:FONT:NAME   STRING('Segoe UI Variable {47}')
APP:FONT:SIZE   LONG(8)
APP:FONT:COLOR  LONG(!COLOR:BTNTEXT)
APP:FONT:STYLE  LONG(!FONT:regular)
APP:FONT:CHARSET LONG(!CHARSET:DEFAULT)
APP:FONT:NAME   STRING('Segoe UI Variable {47}')
APP:FONT:SIZE   LONG(8)
APP:FONT:COLOR  LONG(80000012H)
APP:FONT:STYLE  LONG(400)
APP:FONT:CHARSET LONG(1)

Where are you declaring the App:Font vars?

I also have my own window which has the controls to set all of the above, and it also includes a Lineheight var & spin control to set ?L1{PROP:LineHeight} = 8 for all list boxes. This way the user can spin up or down and see a list box populated with text adjust in realtime.

I am declaring them through the “Data” toolbar inside “Global Module”

I’ve just declared the below in the c6 Appgen Global Var’s part, not DCT Global Var’s…

APP:FONT:NAME   STRING('Segoe UI Variable {47}')
APP:FONT:SIZE   LONG(8)
APP:FONT:COLOR  LONG(!COLOR:BTNTEXT)
APP:FONT:STYLE  LONG(!FONT:regular)
APP:FONT:CHARSET LONG(!CHARSET:DEFAULT)

And its translated the !Equates properly as you can see in the debugger.

I also assume you ment SetFont and not Font, not that I expected it to matter.

TheDaSoft is talking about Equates that are causing Errors in the Designer not the Compiler. He showed an example:

!!> ERROR(82): Value of parameter has incorrect type

Errors that start with !!> appear in the Designer Window… Editor. TheDaSoft can you post a screen capture?

1 Like

Do you mean a screenshot of the Designer Window? Or an actual recording?

Screenshot of the Window… Editor where you see the below error:

Window ... FONT(APP:FONT:NAME,APP:FONT:SIZE) ..

!!> ERROR(82): Value of parameter has incorrect type

Here you go @CarlBarnes
afbeelding

Here you go - I only set one of the props for now:

You say you are declaring them “inside Global Map” That doesn’t sound right. Define them in the Global Data embed section. I would not use equates, but rather global variables - makes it a lot easer to change :slight_smile:

The problem is getting these Font settings in “IDE Scope” so the Designer understands them. The way it understands equates FONT:Bold = 700 and COLOR:Red = 255 and renders that.

I don’t know how to do that. I wonder if those values are in the .Net code. You see oddities like Clarion Color BtnFace is ButtonFace in Designer. It works but it must be mapping between the two enumerations.

I found Clarion was missing 8 equates added in Windows NT 4 and 95. They were added by SV in Clarion 11.

In C9 I added them to LibSrc \ Equates.Clw. I don’t recall exactly how they worked in Designer but I’m sure it was not like all the other colors. I think it translated them into RGB colors and left them that way, so I lost the “System Color” feature. E.g. Color :HotLight changed to :Blue.

As I noted above I think the first thing to try is adding the Font equates to Equates.clw and see how it works in Designer.

1 Like