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

Modifying the textcolor of text objects in DW 1

Status
Not open for further replies.

BBO007

Programmer
Jun 11, 2009
18
GB
Hello All,
I would like to be able to change the properties (like the textcolor or the textbackcolor) of the text objects that are in a datawindow.

I know how to retrieve the list of all objects in the DW by using the next script part:
ls_objectlist = dw_1.Object.DataWindow.Objects
This gives me a tab (~t) separated string with the name of the objects. I am able to split the string to get the name of the objects.

Now I am looking for the way to check the type of the objects. I want to do this in a loop.
Then for the text objects, I need to change the property textcolor. I would like to use the . notation.

Can you give me some advices on how I can do this ?
Thanks
BBO007
 
Try:

dw_control.Object.controlname.Type

Matt

"Nature forges everything on the anvil of time
 
Hi Matt,

Thank you.
But how can I dynamically change the value for the <controlname> in the loop ?
I need to replace the <controlname> with the name of the object, they are for the moment in array of strings.

BBO007
 
After you test for the object's type, just use a simple .Modify( ) statement...

dw_1.Modify( "text_object.TextColor = 255" ) // set text color of the object 'text_object' to red

dw_1.Modify( "text_object.BackColor = 0" ) // set text color of the object 'text_object' to black

But, since you're wanting to dynamically change the item in a loop, you'll have to build the modify string.

String ls_obj[]
String ls_type
Long ll_cnt, ll_back, ll_text

// assign colors here
ll_back = 0 // black
ll_text = 255 // red


/* >> assign the object names to an array here << */


// now, loop through those objects
FOR ll_cnt = 1 TO UpperBound( ls_obj )
ls_type = dw_1.Describe( ls_obj[ ll_cnt ] ) + '.Type' )

// check object's type
IF Lower( ls_type ) = 'text' THEN
dw_1.Modify( ls_obj[ ll_cnt ] + '.BackColor = ' + String( ll_back ) )
dw_1.Modify( ls_obj[ ll_cnt ] + '.TextColor = ' + String( ll_text ) )
END IF
NEXT
 
Thanks theklOwn,

this is working fine now !

BBO007
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top