Post Reply 
Omitting arguments in commands
05-24-2020, 11:30 AM
Post: #1
Omitting arguments in commands
I'm a bit confused...

I'm trying to use the TEXTOUT_P command (but it's just an example, I want to find a general rule). TEXTOUT_P accepts several arguments, but I need only some of them.
Example:

TEXTOUT_P (STRING(C), 100, 120, 4, RGB(255,255,255), RGB(0,20,0))

don't give me a syntax error, but when I execute the program I have an "Invalid input" error, I think because the compiler interpret the sixth argument (RGB (0,20,0) as the argument "width", that wants only a number.

But if I use

TEXTOUT_P (STRING(C), 100, 120, 4, RGB(255,255,255),, RGB(0,20,0))

using double commas to "jump" the "width" argument, I have a syntax error.

Ant in this particular situation, all seems to me more complicated because I have omitted the second argument [G] without any error.

What is the correct procedure if I want to use a command but not all their arguments? More in general: where can I find these syntax rules for HP PPL? There is a doc?
Find all posts by this user
Quote this message in a reply
05-24-2020, 10:17 PM (This post was last modified: 05-24-2020 10:21 PM by pinkman.)
Post: #2
RE: Omitting arguments in commands
If you need the last argument (background color), because colors and width are integers, you need to provide the intermediate arguments (ie width).
But I don’t see why it should be a problem, because whatever the width you provide (equals or less than 320), TEXTOUT_P will print the text as needed, and will return the next position if you need to print something else.
If you give an insuffisant width value the text will be truncated, that’s why the easiest method is to set width to 320, and the clean method is to set width to (320-x).

Other functions with optional arguments behave the same: the compiler matches the arguments according to the types. There is no syntax (like “,,”) to bypass an argument.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)