Chris__T
Posts: 339
|
| Posted: 06/21/2007, 11:00 AM |
|
This is in regards to this older topic: http://forums.codecharge.com/posts.php?post_id=48617
Dataobjx had written up some code to insert into a hidden field to change colors of rows based on a record's contents. I've tried implementing his example, and it's not working. So I have a question:
Do I have to link my hidden field to the field in the record that has the info to compare in the case statement?
His example shows comparing the data in the 'risk' field. So in Data Properties for the hidden field...data type.... would you link it to "risk" ?
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 09/25/2007, 12:24 PM |
|
I still can't get this to work. If anyone is/was familiar with that older topic, I'd appreciate any insight.
|
 |
 |
asoares
Posts: 8
|
| Posted: 09/25/2007, 1:28 PM |
|
Here are some tips based on my experience.
1 - Be sure that your field is set to show HTML and not TEXT. Otherwise nothing will happen.
2. In the field you want to change fonts (or any HTML command), create an event BEFORE SHOW where. Use custom code:
if risk.value = [condition] (where condition is a number ou text value) then
risk.value = "....some html code start..." & risk.value & "... some complementary HTML code..."
else
risk.value = "....some OTHER html code start..." & risk.value & "... some OTHER complementary HTML code..."
end if
Please note thet if risk.value is in a grid, the aboce comand has to be something like:
if GRIDNAME.risk.value = [condition] (where condition is a number ou text value) then
GRIDNAME.risk.value = "....some html code start..." & GRIDNAME.risk.value & "... some complementary HTML code..."
else
GRIDNAME.risk.value = "....some OTHER html code start..." & GRIDNAME.risk.value & "... some OTHER complementary HTML code..."
end if
I expect this tip can help you. You do not need to creade a HIDDEN variable. Just work with the control itself.
Alcides Soares FIlho 
_________________
Alcides Soares Filho
Clicks to Bricks
c2b@clickstobricks.info
Brasil |
 |
 |
wkempees
Posts: 1679
|
| Posted: 09/25/2007, 3:18 PM |
|
If not solved, read up on "attributes" in the online docs.
It is sooo easy to do this. http://forums.codecharge.com/posts.php?post_id=85962&s_...attribute+color http://forums.codecharge.com/posts.php?post_id=85395&s_...attribute+color
Searched forum for "attribute color"
Walter
(applies to CCS 3.1+)
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 09/26/2007, 10:08 AM |
|
I think I'm more confused now. I guess using "color='Red'>Attribute" is the way to go.
In BeforeShowRow event, in custom code I would put:
if ($NewRecord1->Label1->GetValue()<0) {
$NewRecord1->color='Red'>Attributes->SetValue('Color', 'Red');
}
else {
$NewRecord1->color='Red'>Attributes->SetValue('Color', 'Black');
}
BUT instead of getvalue()<0 I would put something like Risk=1 or something like that
then put this:
<td style="COLOR: {NewRecord1:Color}">{Label1}</td>
I guess label1 would be the first label in my row.
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 09/26/2007, 12:03 PM |
|
I got it to work but now date fields aren't showing up when the color changes. Just text fields turn red. Date fields disappear.
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 09/26/2007, 2:06 PM |
|
Show me the code.
Because your previous post is all wrong?
What exactly did you put in your BeforeShow.
What exactly did you call the attribute you placed in the HTML, if you did.
Is it a Form or a Grid?
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 09/27/2007, 8:36 AM |
|
In the "Before Show" event for the first field in the row, I put:
If BusinessLicense.level.value = 1 then
BusinessLicense.COMPANY_NAME.value = "<font color = RED>" & BusinessLicense.Company_Name.Value & "</font>"
BusinessLicense.CC_Address.value = "<font color = RED>" & BusinessLicense.CC_Address.Value & "</font>"
BusinessLicense.To_Dennis.value = "<font color = RED>" & BusinessLicense.To_Dennis.Value & "</font>"
BusinessLicense.Returned_To_Linda.value = "<font color = RED>" & BusinessLicense.Returned_To_Linda.Value & "</font>"
BusinessLicense.NOTES.value = "<font color = RED>" & BusinessLicense.NOTES.Value & "</font>"
end if
To_Dennis and To_Linda are the date fields.
|
 |
 |
wkempees
|
| Posted: 09/28/2007, 2:39 AM |
|
OK, so you are taking the asoares way.
You are actually changing the SQL retreived data on the fly.
Probably the reason your date fields are missing is because (asoares way)
you changed all fields to type HTML.
My solution (using attributes) is almost equal to the "alternate row" using
attributes solution.
You would have (in HTML mode) right clicked in the GRIDS <tr> marker.
Through the right-click menu, have added an attribute like special_color.
The in the BeforeShowRow You'd thest the value of BusinessLicense.level
Setting the attribute to '' or 'color="red".
Which would have worked within the 5 minute mark.
Walter
"Chris__T" <Chris__T@forum.codecharge> schreef in bericht
news:646fbce15671ef@news.codecharge.com...
> In the "Before Show" event for the first field in the row, I put:
>
> If BusinessLicense.level.value = 1 then
> BusinessLicense.COMPANY_NAME.value = "<font color = RED>" &
> BusinessLicense.Company_Name.Value & "</font>"
> BusinessLicense.CC_Address.value = "<font color = RED>" &
> BusinessLicense.CC_Address.Value & "</font>"
> BusinessLicense.To_Dennis.value = "<font color = RED>" &
> BusinessLicense.To_Dennis.Value & "</font>"
> BusinessLicense.Returned_To_Linda.value = "<font color = RED>" &
> BusinessLicense.Returned_To_Linda.Value & "</font>"
> BusinessLicense.NOTES.value = "<font color = RED>" &
> BusinessLicense.NOTES.Value & "</font>"
> end if
>
>
> To_Dennis and To_Linda are the date fields.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |