DMarshall Posted August 3, 2011 Share Posted August 3, 2011 Hi There, I have a pending job (a couple of weeks away so a bit of time!) which I would love a bit of help with please. Our customer is after variable Lanyards for a conference. There are 6 categories which attendees can fall under. Each attendee will belong to between 1 and 6 categories. Each category is named something different and the name and a coloured box around the name is to appear in a specific order listed below each other on the lanyards. Each category is a different colour and if the attendee doesn't belong to a particular category it is to be suppressed and the following categories moved up. I immediately thought of doing these as individual text frames per category and colouring the background of the text frame, however my Java skills are almost non-existent and if this is the correct way to do it I need help. Can anybody suggest something to me please?? Thanks in advance. Dan Link to comment Share on other sites More sharing options...
Dan Korn Posted August 3, 2011 Share Posted August 3, 2011 The usual way to change the color of a text frame is to simply name the frame in the Frame Properties palette, then create the OnRecordStart callback rule and set the background color, for example: FindTextFrame("Your frame name").fillColorName = "Red";However, instead of changing the background of a single frame, it sounds like you need to have a set of text "areas," each with a name and a separate background color. This sounds more like a job for a table, where each row of the single-column table consists of a single cell with a category name and cell shading for the color. Something like this: FPTable.prototype.NewRow = function() { table.AddRows(1); return table.Rows[table.Rows.length-1]; } var table = new FPTable; var row = null; // FPTableRow table.AddColumns(10000); // width of column in hundredths of points; 7200 = one inch if (Field("Category 1") == "Yes") // if attendee belongs to category 1 { row = table.NewRow(); row.Cells[0].Content = "Category 1"; row.Cells[0].ShadeColor = "Red"; row.Cells[0].ShadePct = 100; } if (Field("Category 2") == "Yes") // if attendee belongs to category 2 { row = table.NewRow(); row.Cells[0].Content = "Category 2"; row.Cells[0].ShadeColor = "Blue"; row.Cells[0].ShadePct = 100; } // etc., etc. return table.MakeTags(); You'll need to provide the logic in the "if" statements to determine whether the attendee is in each particular category, based on something in your data; I just guessed at that part. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.