Web App Popup Menu showing a default selection

I have a Countries of the World Popup Menu on my web app registration page. The Countries are loaded in the Popup Menu’s Shown Event. At the moment the initial state is blank. Can I make one of the countries a default so it is showing in the control when the page opens?

Hi Steve, if your questions are for Xojo Web is better for you to post on the Web section of the forum

Why are you loading in Shown Event? The Opening Event is not working for you?

You can use .SelectedRowIndex or .SelectedRowValue to set the popup to the Country you want.

Hi Alberto, I tried using the Opening Event but I got 219 errors, one for each entry, saying the popup menu didn’t exist. Documentation uses the Shown Event without explanation. Thanks for your suggestion. I thought SelectedRowIndex and SelectedRowValue were read-only but you are right. I have used SelectedRowValue, again in the Shown Event rather than the Opening Event, and it works fine, displaying the selected row text on the control when the page opens rather than activating the popup window. I assume the Shown Event occurs before the Opening Event for some reason.

The Shown event is too late.

1 Like

Did you try the WebPage opening event? or the WebPopup opening event?

Oh, I think it was the Popup Opening Event, but in any event, the documentation gives an example of populating the popup in the Popup Shown Event and it’s working fine for me.

A bigger problem was getting the countries list (from Encyclopaedia Britannica) and adding the me.AddRow(" and ")^p (in a Word Find and Replace). I didn’t notice that Word was using nice typographically correct quote marks and I had to replace them all in the Mac’s TextEdit.

All fine now, thanks.

1 Like

Oh, that’s right:


The control has been created and the page is opening but has not been sent to the browser yet.

The Opening event handler can be used to initialize non-visual properties and settings for controls.

In most cases, you should use the Shown event to initialize controls.

I’m not sure if that information is copied from Web 1 docs and is still valid for Web 2 controls.

I remember @Greg_O working on Web 2 and Opening should work now instead of Shown. Maybe that’s why this comment:

Good that it works for you, that’s the goal.