Page 1 of 1

Tree Item formatting changes at runtime

Posted: Sat Jun 17, 2017 12:11 am
by atostaine
My RP sends the #PRIM_TREE to a server function to get entries added. In some cases, I want to change the style of a label at runtime.

Where do I do that? The server module just gets the fields, so it doesn't know about the labels. The Tree Item exposes a property for the label I want to change.

Is this the best way to update all the items? I'm doing this in the server module completed event.

selectList #tree
#CurrentTreeItem <= #tree.Currentitem.design *as #TreeItemRP
#currentTreeItem.pLabel2.style <= #Theme01<Text10BoldAlmostBlack>
endSelect

Thanks, Art

Re: Tree Item formatting changes at runtime

Posted: Mon Jun 26, 2017 12:37 pm
by Stewart Marshall
Hi Art

You can expose a property/method as you've already done and handle it in the component containing the Tree, or you can code it in the design instance. My personal preference is the latter, but it's really only personal taste and coding style.

The OnAdd method on the iTreeDesign interface will be executed when an entry is added, and similarly the OnUpdate method will execute when Upd_Entry is used. All field values will have been updated prior to the methods running, so you can test whatever values and code accordingly.

Regards