Popup Menu List Index

Window1 has two popup menus pu(0), pu(1)
each Popup has 3 items, set via the Inspector (initial values)

sub Window1.OPEN
    pu(0).listindex=var1
    pu(1).listindex=var2
end sub
sub Window1.CLOSE
    var1=pu(0).listindex
    var2=pu(1).listindex
end sub

running the app, and clicking on either pu(0) or pu(1) shows the 3 items, but regardless of what is chosen, it immediately reverts back to LISTINDEX=0

there are no explict events added to these popup menus. the ONLY references to them in code are as shown above

they simply won’t stick to what the user chooses

Man, you’ve got some bad mojo going on today. :slight_smile:

What happens if you take them OUT of the control set?

same thing

Hhmm…I do this sort of stuff all the time. I suspect that something else is modifying the ListIndex in the Popup change event.

Sorry, just grasping at straws.

I’d agree… but I’d also assume that it would be “code”
and these menus are referenced THREE times in the code

  1. Declaration in the IDE
  2. WIndow Open event to set the Listindex
  3. Window Close event to get the Listindex

Here is something extra strange. I said there were TWO, in a control set.
I broke it apart and gave them distinct names… now ONE works, the other doesn’t

The one that doesn’t , has the original name (I deleted the old control and added it back)

Now I’m going to try and delete it, and give it a totally different name

Seems Gremlins from XOJO in days past have crept back into to Xojo of days present :frowning:

I have seen this a few times and it is frustrating.

to make matters worse… I copied the window (its a Pref window) to a new project…
and guess what … there it WORKS…

Could not reproduce the fault on Windows 7, Xojo v2014r2.1.

Did the PopupMenu show ListIndex 0 item as soon as user selected any of the displayed item from Popup? Or some other steps were also involved before ListIndex 0 item got selected on its own?

The user clicks and selects any of the 3 options, and when they release the mouse it pops back to 0
there are no other steps… the content of the popup isn’t even examined until the window closes

The fact that it worked in a different window says that something is funky on the window. I had that happen during one of the beta periods. Replacing the window with a new one seemed to do the trick.

I did find something…

If I comment out the initialzatino in the Window Open… it works…

But Window Open is ONLY called once… not every time the user clicks a control

moving it to the CONTROL open… seems to have fixed it… weird

I would try deleting the Window open event and then adding it back in to see if that resets it.

If you have Arbed then have a look at the source code in there. I remember a case where I found weird code with Arbed that could not be seen in the IDE.