How to keep the same value in popupMenu

As you know, PopupuMenu.text is a read-only.
I need to keep the current value on popup menu even though its lists are changed by other method.

For example, there are 5 items now such as A,B,C,D and E and popupMenu shows ‘B’ now.
With other method, those items are changed to A,B,C,D,E,F,G and H, at this time, popupMenu doesn’t show anything, I just need to click it to show all items.

Is there any way for me to keep ‘B’ in this case?

Read the currentValue,
delete all the values (deleteAllRows)
while adding the new ones keep the index of the item that’s equal to the originalValue (currentValue)
set the listIndex to that index

ListIndex!
Clear.


currentValue = popupmenu.text
popupmenu.deleteAllRows

-- popupmenu.addrow

For 

if (currentValue = adding_row_value)  
   tempIndex = popupmenu.listIndex 'get_index

Next

popupmenu.listIndex=tempIndex

Thank you.