Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print field in color in labels

Status
Not open for further replies.

SitesMasstec

Programmer
Sep 26, 2010
523
Brasil
Hello colleagues!

I made a form in which the user will print some labels.
The user can choose the color of one of the field. The color od the field is defined as MyColor.
I need to print labels with the color the user chose:

Label1_ikxonz.jpg


Label2_hlc4fy.jpg


Let's suppose the user chose the color RGB(184,20,0). The form the user selected his color, it was defined as:
Code:
MyColor="RGB('&UserColor')"

How to tell the Label Designer the color it has to print? In "Field Properties", "Advanced"? If so, what to code?



Thank you,
SitesMasstec
 
I think for that you will need to have multiple labels with different colours and use the 'print when' to decide which is visible.

Or you could 'hack' the underlying label file (.lbx) and change the colour programmatically, there is a dynamics tab on a labels
properties you could perhaps use, but I suspect it would be as clumsy as my first suggestion.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
It really depends how many possible colours you want to offer. If the user only chooses between, say, three different colours, you can go with Griff's suggestion. Create three identical fields, giving each one a different colour. Place them all in exactly the same place. Then, in the Print When box (Field Properties -> Print When), place an expression to determine whether that particular field will be visible (for example, [tt]MyField = RGB(255,255,0)[/tt]).

But that would be impractical if you want to let the user choose from a large number of colours.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi,

Suppose you have the scenario in which you present the user with a prompt to select the by the user wanted colour. Than save that colourvalue to a (public)report icolvalue.
Running your report you set the colourvalue of your label to the icolvalue.

I notice you are printing the washsymbols, is this a font or are you using picture values?

What is your OS(), your VFPversion and are you using FoxyPreviewer?

Regards,
Koen
 
Koen said:
Running your report you set the colourvalue of your label to the icolvalue.

Yes, but the question is: How do you do that? A field in a report is not like a control on a form. It doesn't have properties that you can set programmatically.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Koen, you asked about the wash symbols. There is something called an M54 font which includes these symbols. If you are googling for it, you might do better with "care symbols" rather than "wash symbols" as the search term.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello colleagues!

Before my post I had already used whar Griff and Mike has said (use 3 labels with different colors) to have work done. But I have more colors the user can choose... so I need to change the color of the first field programmatically.

Griff also said:
Or you could 'hack' the underlying label file (.lbx) and change the colour programmatically, there is a dynamics tab on a labels
properties you could perhaps use
but I have never used dynamic tab, I will try.

Koen asked:
I notice you are printing the washsymbols, is this a font or are you using picture values?
I am using a font. My VFP is version 9, running on Windows 10.
The first field of the label uses the font Harlow Solid Italic.

It seems, as Mike noted, the label cannot be changed programmatically, like a control in a form...



Thank you,
SitesMasstec
 
Mike,
you are ofcourse completely correct. Apparantly I was having a wrong spiral of thought. Mr. SitesMasstec, please forget about my remark.
Koen
 
If you're doing this with the Report Designer (rather than the Label Designer), take a look at the Dynamics tab of the Field dialog. You can set up rules to determine things about how the field prints. So if you can find a way to put the color information into your data, you should be able to do this.

Tamar
 
Tamar:
I am using the Label Designer, It has a Dynamics tab, but I have never used it (by the way, I will have to learn about using it).

Thank you,
SitesMasstec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top