cancel
Showing results for 
Search instead for 
Did you mean: 

Question about Usgae of RadioButtonGroupByIndex

Former Member
0 Kudos

Hi All,

I am trying to use a RadioButtonGroupByIndex. In doing so, I have bound the "texts" property to the corresponding node/element in my context.

Now, the RadioButtonGroupByIndex only shows one element... not suprising since the node/element does only have one value.

I guess the texts property actually has to be bound to something like an array... But how??

Anybody out there who can help me??

Thanks, Johannes

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Example:


Colors (node, cardinality=0:n)
- name (string)

Fill the context node with values:


String[] colors = { "red", "green", "blue" };
for (int i = 0; i < colors.length; ++i)
{
  IColorsElement e = wdContext.createAndAddColorsElement();
  e.setName(colors<i>);
}

Bind the "texts" property to attribute "Colors/@name" and you will get a radio button group with 3 buttons. To select the first button, set the lead selection of node "Colors" to 0.

Armin

Former Member
0 Kudos

As easy as can be if you how to do it... Thanks, bro!

Former Member
0 Kudos

Maybe you can help me out finding the current selected element for further processing? Thanks.

Former Member
0 Kudos

There must be a way to access the curretly selected element!?

I saw the property "state" which probably allows to determine the curretly selected element, yet do I not know how to implement it...

Thanks..

Former Member
0 Kudos
wdContext.currentColorsElement()

Armin

Former Member
0 Kudos
	  // at this point the user has selected an InfoObject.
	  // this has to be put into the context to be know in the following view
	  wdContext.currentInfoObjectsElement().setSelectedInfoObject(*->Value<-*);

Ok, but where do I get the value from?? Thanks, Johannes

Former Member
0 Kudos

I don't understand the question. How does your context looks like and what do you want to achieve?

Armin

Former Member
0 Kudos

I have a RadioButton from which the user chooses one entry.

What I need to to know is the entry, the user has chosen.

The RadioButtonGroupByIndex UI Element has a couple of properties e.g. STATE, but there is no "currentlySelectedElement" or the like.

There may be the Event onSelect... Yet do I need to know the currently selected element...

What I mean is means that tell me the actually selected element, e.g.

element 1

-> element 2 //users choice

element 3

then in coding:

wdContext.createAndAddInfoObjectsElement().setSelectedInfoObject( 
RadioButtonGroupByIndex.currentlySelectedElement ); 
// currentlySelectedElement should have the value 'element 2' right now... 

I hope this points it out...

Thanks, Johannes

Former Member
0 Kudos

The selected radio button corresponds to the lead-selected element in the context node that contains the "texts" attribute.

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

Yes, indeed. The following code provides the value and binds it to a context element:

	  int leadSelection = wdContext.nodeInfoObjects().getLeadSelection();
	  IInfoObjectsElement myIInfoObjectsElement = wdContext.nodeInfoObjects().
                               getInfoObjectsElementAt(leadSelection);
	  String name = myIInfoObjectsElement.getName();
	  wdContext.currentInfoObjectsElement().setSelectedInfoObject(name);
	  wdContext.currentZ_Read_Infoobject_InputElement().setI_Infoobject(name);

So long, Johannes

Former Member
0 Kudos

As written in the other thread, this code is not needed. It should be just


String selectedName = wdContext.currentInfoObjectsElement().getName();
wdContext.currentZ_Read_Infoobject_InputElement().setI_Infoobject(selectedName);

Armin

Former Member
0 Kudos

You're right, thanks.