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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify text colour property in dynamic datawindows

Status
Not open for further replies.

froimer

Programmer
Oct 8, 2008
2
ES
Hi all!

We've a problem trying to modify dynamic datawindow's fields with several colours. We've designed a function that seeks for holydays and weekends in the first column of datawindow, then it paints each day for all the rows of the day in the painted colums. We've tryied the modify string in the background colour dialog box in its dialog box, and it works in the datawindow's preview, but when we insert it in the modify method, we've syntax errors, maybe because of using of quotes. We've checked the quotes use with the modify examples in the powerbuilder coding examples, but it doesn't works. So here is the code, i will be thankful because it's the last work of the program:

string ls_casos_color

ls_casos_color = "'case( trim(right(C1, 2)) " + &
"when 'B' then if (trim(left(C1, 2)) = 'DS' or trim(left(C1, 2 )) = 'DG', rgb(255,0,0), rgb(255,64,64)) " +&
"when 'M' then if (trim(left(C1, 2)) = 'DS' or trim(left(C1, 2 )) = 'DG', rgb(255,0,0), rgb(255,128,128)) " +&
"when 'BM' then rgb(255,0,0) "+&
"else if (trim(left(C1, 2 )) = 'DS' or trim(left(C1, 2 )) = 'DG', rgb(255,0,0), rgb(255,255,255)))'"


string ls_propiedad_color

ls_propiedad_color = ".Background.Color = '" &
+ string(ll_sincolor) + &
+ "~tif (trim(left(C1, 2)) = " + ls_ds + "," + string(ll_color_BM) +"," + string (ll_sincolor) + ")"

long idx
string ls_aux

string err

for idx = 1 to upperbound (isa_colum) + 1

ls_aux = "C" + string (idx) + ls_propiedad_color


err = dw_resesdv.modify(ls_aux)

IF err <> "" THEN

MessageBox("Status", "Change to Background Color Failed " + err + "~r" + ls_aux )

END IF

next

return 0

Thank you!!
 
Make an expression on the column in the datawindow, it's generally much easier.

Matt

"Nature forges everything on the anvil of time
 
Matt,

We've tried it, but we can't, because de datawindow is builded dinamically by a function, so we can't acces to their properties, we must modify using the modify method, so here is the problem, we've a syntax error, i think by the quotes position...

Thanks for your help by the way!
 
Just a thought.

If you created a simple dw with the same syntax as you describe in your example but as an expression on a column, then run it in an app and do a describe function to display the syntax in a messagebox (or whatever), you can then compare it to your dynamic string. Maybe it will show something?

Matt

"Nature forges everything on the anvil of time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top