On Jan 15, 2006, at 9:28 AM, John McKernon wrote:

You could set ListIndex to -1 when your dialog closes. That will
"clear" the popup of any selection, putting it back to an initial
state. Now any selection, even a repeat, will fire the Change event.
If you are using ShowModal for opening your dialog from your main
window just do:

MyDialogWindow.ShowModal      // shows dialog
self.PopUpMenu1.ListIndex = -1 // executes when dialog closes or hides

If you are not using ShowModal, just put the following in the Close
event of the dialog:

MyMainWindow.PopUpMenu1.ListIndex = -1   // be wary of implicit
instantiaton


The problem with this is that it keeps the PopUp from showing the current
selection, which is important.


This is an example of where "new event" could come in handy.>



   Create a custom Subclass of popupmenu.
   Give it a property: lastTxt As String
   Give it a new "Change" event: Change (txt As String)



In the custom class's Change event:



   lastTxt = Me.Text
   Change lastTxt // passes lastTxt to the instance's change event.



In the custom class's 'MouseUp' event:


I tried Phil's "new event" suggestion, which is pretty cool (and I learned something from it), but has a fatal flaw: The MouseUp event doesn't fire unless you pass True to the MouseDown event, and when you do that RB assumes
you're handling the whole shebang and nothing pops up at all.

I also tried a Combo box, which isn't really suitable as my categories are fixed and therefore prone to user error (not to mention extra mouse clicks). Oddly enough, a Combo box returns a Changed event even when the user chooses the same category again. Odd, because it's super is PopUpMenu and I would
have expected them to behave similarly.

Any further suggestions?



Yes, indicate the current selection in an adjacent field(textbox, for example) along with my earlier suggestion of reseting the popup, or use a listbox. The listbox has much more event/property/method capability than the popup.

Jack
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to