Multipane Control Question
I will give a simple example of what I am trying to do:
I have a multipane control with a transparent container containing a textview nested inside. The context node structure is 1...n with a single attribute of type string; multipane and textview are bound to them respectively.
I would like, based on the value of the textview, to change a property for that textview. For example, if the value of the textview is 'ONE', I'd like to change the semantic color to '05'.
I am able to access this property of the text view with the following generic code:
FIELD-SYMBOLS <ui_element> TYPE REF TO cl_wd_uielement.
DATA v_mp TYPE REF TO cl_wd_multi_pane.
DATA v_ui TYPE REF TO cl_wd_uielement.
DATA v_tc TYPE REF TO cl_wd_transparent_container.
DATA v_tv TYPE REF TO cl_wd_text_view.
DATA v_tui TYPE cl_wd_uielement=>tt_uielement.
DATA v_text TYPE string.
v_mp ?= view->get_element( id = 'MP' ).
v_ui = v_mp->get_content( ).
v_tc ?= v_ui.
v_tui = v_tc->get_children( ).
LOOP AT v_tui ASSIGNING <ui_element>.
v_tv ?= <ui_element>.
v_text = v_tv->get_text( ).
IF v_text = 'ONE'.
v_tv->set_semantic_color( value = '05' ).
The problem is that all of the textviews are taking on the color. Obviously I am doing this wrong however I am not clear on how to access the individual textview object generated at runtime for each row in the multipane.
Is it the case that a multipane simply does not support this?
Any guidance is appreciated.
Thomas Jung replied
If you want this to work correct you are going to have to use context binding for the semantic color property. You will need to add more attributes to the context that is the data source for your multipane. You can fill then with logic that tests against your text value. You then bind the semantic color to the context that is your data source for your multipane just like you did the textView text property.