onOpen on programmatically opened Popup

asked 2011-07-15 04:02:02 +0800

cvarona gravatar image cvarona
554 1 6

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

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2011-07-15 09:01:38 +0800

cvarona gravatar image cvarona
554 1 6

Rather surprisingly programmatingly opening a menupopup triggers an onOpen event, whereas doing the same with a plain popup does not:

	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();'/>
	<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();'/>

link publish delete flag offensive edit

answered 2011-07-15 09:03:42 +0800

cvarona gravatar image cvarona
554 1 6

All the same, popup.close() does not trigger any onOpen event whereas menupopup.close() does.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2011-07-15 04:02:02 +0800

Seen: 401 times

Last updated: Jul 15 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More