cancel
Showing results for 
Search instead for 
Did you mean: 

How to Change ICON Image dynamically ?

Former Member
0 Kudos

Hii all

In WDP Image, I want to store ICON dynamically. So I am storing the icon path (as a string )at context – attributes at run time. Then I am mapping that attributes to the source. My code is like

If <<condition>>

[context]-[attributs] = ‘~Icon/CheckedOk’

Else

[context]-[attributs] = ‘~Icon/Empty’

Endif.

But the path is not working properly. so the image is not coming in position. Can you tell me , whats the problem ?? IF you have any idea how to store path or change the icon image dynamically or any code example please post here.

Regards

Satra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Satrajit,

To which property are you binding this string? I had problems with some elements. I currently bind the imageSource property of a Caption UI Element to the attribute in context structure. It works fine.

Also, make usre you have created at least one element for teh respective context node in your context where you can store these values for the attributes.

Regards,

Neha

Former Member
0 Kudos

Hi Neha,

thanks for your reply, In My case I am taking a Attributes String type. Then I am storing the path at that attributes. Then I am binding that attributes imageSource property of a Iamge.. And the path is ‘‘~Icon/CheckedOk’’. But I am not getting that image.

Is there any problem in my procedure ?

Regards

Satra

Former Member
0 Kudos

Try working with a Caption UI Element if it does not hinder any other thing in your application.

Former Member
0 Kudos

Hi neha,

Is that path what i am giving is Ok ??

Regards

satra

Former Member
0 Kudos

Hi Satrajit

Yes it is ok. I used 'Icon/GreenLed' and 'Icon/RedLed' in my application. They were working fine using Caption.

Regards,

Neha

Former Member
0 Kudos

Hi Neha,

Thanks. It’s working. Thanks a lot for your nice co-operation, and sorry for late reply.

Ragards

Satrajit

Answers (1)

Answers (1)

former_member182190
Active Participant
0 Kudos

Hi ,

I guess what you have done is right. I guess u forgot to do set attribute or bind the changed structure to the context.

Please bind your Image with an element in the context node and then in your code write as follows.

get the context node

lo_node = wd_context->get_child_node( 'NODE' ).

if a > b.

l-check = '~Icon/CheckedOk'.

else

l_check = ‘~Icon/Empty’

endif.

lo_node->set_attribute( name = 'CHECK' value = l_check ).

Hope this helps.

regards,Ismail.