PopupMenu selectedRow misleading

the IDE tells me I should use popupMenu.selectedRow to get selected text.
There is also a method called popupMenu.selected RowValue which can’t be used BUT that would be the right method in my opinion. method popupMenu.SelectedRow is totally misused, because SelectedRow should return selected row as the name says.

Hi,

which version of Xojo are you using ? That will tell whether it’s API 1 or API 2. Regarding 2020 r2.1, there is one property named SelectedRow that returns the text of the selected row, and the method name is SelectRowWithValue which is used to select a row, the fisrt one that matches the provided value, not return it’s value (text).

I’m using 2020 r2

not sure why someone thinks selectedRow returns a text ???

1 Like

:thinking: Where he’s right he’s right … :wink:

Though SelectedRowValue shouldn’t be text either as a row has a RowTag and can contain a LOT more than just text. So I guess it should be

SelectedRow.Text

:grin:

Referring to API2

I guess because the documentation says that:

StringValue = aPopupMenu .SelectedRow

:smiley:

If you want a number instead of the text, you can use

IntegerValue = aPopupMenu .SelectedRowIndex

It is possible to use SelectedRowValue which it seems you find preferable. It is deprecated in 2020r2 but it still works. It is equivalent to SelectedRow.

StringValue = aPopupMenu .SelectedRowValue

As to which is better, that would seem to be a matter of taste so there is no way to have an undisputed answer. I, for one, am happy with the SelectedRow syntax.

thank’s all

one of those changes I can’t follow !!!

1 Like

xojo should think about explaining the methods at mouse over …

how about just .Text
and .SelectedText and SelectedRowText
everybody find intuitive then.

I think Xojo should give us back method SelectedRowValue … or SelectedRowText … which ever get’s more votes …

comparing with a textbox and a button that open a window with a list where the selected go back into textbox
.Text comes near in my mind.

for me, I’m more used to deal with real methods instead of method properties

  • SelectedRowValue as a method
  • SelectedRow.Text with a method property

so SelectedRowValue was OK for me !!! and made sense !!! at the end, if the property is called ‘text’ or ‘value’ so what … than you need a setter for the text/value property as well … sure …

another example from the listbox is:

  • .selectedIndex
  • .selectedLast Index
  • .lastaddedIndex
  • .selected whatever index

I don’t want to know about indexes,
all I want is the selected Row number of a listbox !!!

if Xojo give us a method SelectedRow to get the listbox row number, that’s how I see it

does it make sense ???

I have a feedback ticket about this: 63244 - API 2.0 PopupMenu.SelectedRow could be SelectedRowText for consistency

2 Likes

that would be great,
thanks Tim

Just extend it for now …

Yup, thanks! To get it changed in the framework, I made a ticket :slight_smile:

1 Like