-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi there,
I need to programmatically open a certain popup (i.e., via the open() method). As the popup gets open I'd like to set the focus on one of the elements it contains. Popup.onOpen won't do because no event is raised when Popup.open() is invoked. Any idea as to how to accomplish this would be much appreciated.
With kind regards
César Varona
Rather surprisingly programmatingly opening a menupopup triggers an onOpen event, whereas doing the same with a plain popup does not:
<vbox> Right click the textbox <textbox id="tb" focus="true" context="menupopup, position=after_end" ctrlKeys="^#down" onCtrlKey='menupopup.open( self )' /> <label id="lbl" /> <menupopup id="menupopup" onOpen='if( event.isOpen() ) mi.setFocus( true ); else tb.focus(); lbl.setValue( event.isOpen()? "A": "B" );'> <menuitem id="mi" label="Some menu item" onOK='menupopup.close();' onClick='menupopup.close();'/> </menupopup> <textbox id="tb2" context="popup, position=after_end" ctrlKeys="^#down" onCtrlKey='popup.open( self )' /> <popup id="popup" onOpen='if( event.isOpen() ) tb3.setFocus( true ); else tb2.focus(); lbl.setValue( event.isOpen()? "A": "B" );'> <textbox id="tb3" onOK='popup.close();'/> </popup> </vbox>
Asked: 2011-07-15 04:02:02 +0800
Seen: 401 times
Last updated: Jul 15 '11