Populating popup/combobox on-the-fly

I am populating a combobox from the file system. I would like the combobox contents to change when files are added and removed. Ideally, when the user clicks on the combo to reveal the list contained, the combo will be populated. I realize there could be a delay, but given the performance I am getting on my Mac, I think it should be fine.

But it doesn’t seem that there is an event that fits the bill. Does someone know what events would fire when the list is revealed, and which or these would be most suitable to populate the list?

Thx

OK answering my own question. DOH. Put a Beep into the GetFocus event, and based upon the result, it looks to be workable. While that is not the list revealing, nevertheless, it seems to be a pretty good choice.

You might want to do either the GetFocus or MouseDown event. Depending upon the OS you might not get the GetFocus event if a Mac user presses the dropdown widget. Only testing will tell for sure.

I’ve made it work with GotFocus, and with a list of about a dozen things, the load time is imperceivable. So that part is great.

The problem with GotFocus is that the focus needs to leave the combo in order for it to reload. That is, if the combo has focus, and the filesystem changes (a file is added or delete), then revealing the list does not update it. You need to tab out to another control, THEN click on the list (causing GotFocus event) in order to reload.

This is weird, I put a Beep in MouseUp and returned False. Clicking away on the thing and nothing. No beep.

Put Return True in mouseDown

I put true in mouseDown, so now it generates mouseUp. But it won’t reveal the list.
It looks as if returning True in MouseDown has the effect of cancelling the list reveal.
I’ve tried both returning true and false in MouseUp. The event happens (the beep occurs).

This does not take into account accessibility features, which do not go through either of those two events.

Got it. MouseDown. MouseDown is only generated when revealing the list. Clicking on a list item doesn’t trigger MouseDown.
Thanks.

Correct. That would be handled by the popupmenu.Change event