I have a combobox filled with a list of objects itemAttributes that is defined as
01 value-id pic 99999999 value 0 property as "ID".
01 attribute-value pic x(30) value spaces property as "VALUE".
im triying to find the index of the object inside the combobox by its ID property but i cant manage to figure it out.
something like this
set cbAttrib1::SelectedIndex to cbAttrib1::Items::IndexOf(valueID)
Can you please clarify what it is exactly that is in the Items collection? You have a class defined with the two properties shown above and you are adding instances of that class to the combobox?
Can you show me an example of how you are loading the combobox?
Thanks.
I have a combobox filled with a list of objects itemAttributes that is defined as
01 value-id pic 99999999 value 0 property as "ID".
01 attribute-value pic x(30) value spaces property as "VALUE".
im triying to find the index of the object inside the combobox by its ID property but i cant manage to figure it out.
something like this
set cbAttrib1::SelectedIndex to cbAttrib1::Items::IndexOf(valueID)
Yes, is class with 2 properties.
set lblAttrib1::Content to category-attributes(idx)::NAME
set cbAttrib1::ItemsSource to category-attributes(idx)::VALUES
set cbAttrib1::DisplayMemberPath to "VALUE"
set cbAttrib1::SelectedValuePath to "ID"
i want to find a specidic attribute in the combox and then set the selected value to that index.
I have a combobox filled with a list of objects itemAttributes that is defined as
01 value-id pic 99999999 value 0 property as "ID".
01 attribute-value pic x(30) value spaces property as "VALUE".
im triying to find the index of the object inside the combobox by its ID property but i cant manage to figure it out.
something like this
set cbAttrib1::SelectedIndex to cbAttrib1::Items::IndexOf(valueID)
Is this what you are looking for?
This example displays the VALUE property in the list and then allows you to set the selected item to the one that matched the ID property given.
01 entry1 type findentry.myitems value new findentry.myitems(property ID = 3, property VALUE = "TEST1").
01 entry2 type findentry.myitems value new findentry.myitems(property ID = 2, property VALUE = "TEST2").
01 entry3 type findentry.myitems value new findentry.myitems(property ID = 1, property VALUE = "TEST3").
01 mylist type ObservableCollection[Type findentry.myitems].
set mylist to new ObservableCollection[type findentry.myitems]
invoke mylist::Add(entry1)
invoke mylist::Add(entry2)
invoke mylist::Add(entry3)
set Combobox1::ItemsSource to mylist
set Combobox1::DisplayMemberPath to "VALUE"
set Combobox1::SelectedValuePath to "ID"
set Combobox1::SelectedValue to 1
end method.
end class.
class-id findentry.myitems.
working-storage section.
01 valueid pic 99999999 value 0 property as "ID".
01 attributevalue pic x(30) value spaces property as "VALUE".
end class.
I have a combobox filled with a list of objects itemAttributes that is defined as
01 value-id pic 99999999 value 0 property as "ID".
01 attribute-value pic x(30) value spaces property as "VALUE".
im triying to find the index of the object inside the combobox by its ID property but i cant manage to figure it out.
something like this
set cbAttrib1::SelectedIndex to cbAttrib1::Items::IndexOf(valueID)
basically im looking how to do
ComboBox.FindString(String) Returns the index of the first item in the ComboBox that starts with the specified string.
But I think it will be better if I use Combobox::SelectedVaue as Sugested, Just gotta change the logic in my code.