Hi Christian,

the code looks like it should work. However I wasn't able to get it to 
work, too. I've added some "qx.ui.core.queue.Manager.flush();" forcing 
the ui to render and the dom elements to create but it didn't help.

BTW removing the event from the widget has no effect because they are 
only attached to the qx.hml.Element. You will have to get the DOM 
elements of the widget and move the events registered there.

e.g.
qx.ui.core.queue.Manager.flush(); // force element creation
var containerEl = button1.getContainerElement().getDomElement();

var listeners =
qx.event.Registration.getManager(containerEl).serializeListeners(containerEl);
qx.event.Registration.getManager(containerEl).removeAllListeners(containerEl);


You will have to do the same for the contentElement.

Best Fabian


> I am keeping on experimenting... Next attempt for the trunk playground:
>
> var win = new qx.bom.Window.open(); 
> win.document.write("<html><body /></html>"); 
> win.document.close(); 
>
> var root = new qx.ui.root.Application(win.document); 
>
> // Create a button 
> var button1 = new qx.ui.form.Button("First Button",
> "icon/22/apps/internet-web-browser.png"); 
>
> // Add button to document at fixed coordinates 
> root.add(button1, 
> { 
>   left : 100, 
>   top  : 50 
> }); 
>
> // Add an event listener 
> button1.addListener("execute", function(e) { 
>   alert("Hello World!"); 
> }); 
>
> // the event manager for the button is still attached
> // to the main window
> this.info( qx.event.Registration.getManager(button1) 
>            == qx.event.Registration.getManager(root) );
> // result: true
>
>
> // get listeners and remove them
> var listeners =
> qx.event.Registration.getManager(button1).serializeListeners(button1);
> qx.event.Registration.getManager(button1).removeAllListeners(button1);
>
> // import them to the manager of the new window
> // doesn't work
> qx.event.Registration.getManager(win).importListeners(button1,listeners);
>
> I get an error "There is no event handler for the event 'undefined' on
> target 'qx.ui.form.Button'!"
>
> Is there a way of switching the event manager for an individual widget? 
>
> Thanks,
>
> Christian
>
>
>
>
> panyasan wrote:
>   
>> Hi Thomas,
>>
>> it's here: 
>>
>> http://bugzilla.qooxdoo.org/show_bug.cgi?id=1157
>>
>> I am adding a link to this thread there.
>>
>> Thanks,
>>
>> Christian
>>
>>
>> thron7-2 wrote:
>>     
>>> Just a remark: Nothing much happens in core development without a bug. 
>>> Did you create a bug for this issue, or is there an existing bug?!
>>>
>>> T.
>>>
>>> panyasan wrote:
>>>       
>>>> Hi Fabian,
>>>>
>>>>
>>>> panyasan wrote:
>>>>   
>>>>         
>>>>> I've done some experimenting but have to admit that I don't know enough
>>>>> about the event dispatch process in order to create patches that would
>>>>> allow remapping the events to the new window. Would it be possible to
>>>>> explain in a few sentences or maybe even a small graph how the current
>>>>> system of abstracting the "real" browser events works? I guess any
>>>>> solution that does not imply rewriting the event system from scratch
>>>>> must
>>>>> be based on unregistering the attached events from one window and
>>>>> reattaching them in the context of the new window.
>>>>>
>>>>>     
>>>>>           
>>>> I know this has low priority for the qx devs, but I'd humbly like to ask
>>>> if
>>>> you would see a chance of implementing native window support as I
>>>> outlined.
>>>> I know about
>>>>
>>>> http://qooxdoo.org/documentation/0.8/event_layer_impl
>>>>
>>>> but this document doesn't really help me solve the issue. Would there be
>>>> a
>>>> way withhin the current Framework to remap events to a different
>>>> document? I
>>>> am thinking of the follwoing pseudo-code
>>>>
>>>> qx.event.Manager.getAllListeners().forEach( function( el, type,
>>>> listener,
>>>> useCapture ) {
>>>>   if ( x.y.getWindow(el) === nativeWindow ){
>>>>     // removing and re-adding should fix the listeners that have been
>>>> attached to the
>>>>    // main window before the widget elements were added to the DOM of
>>>> the
>>>> new native
>>>>    // window
>>>>     eventManager.removeListener( el, type, listener, useCapture )
>>>>     eventManager.addListener( el, type, listener, useCapture );
>>>> },this);
>>>>
>>>> Do you think somthing like this might work?
>>>>
>>>> Cheers,
>>>>
>>>> Christian 
>>>>
>>>>   
>>>>         
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day 
>>> trial. Simplify your report design, integration and deployment - and
>>> focus on 
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> qooxdoo-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>>       
>>     
>
>   


-- 
Fabian Jakobs
JavaScript Framework Developer

1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
Telefon: +49 721 91374-6784
fabian.jak...@1und1.de

Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas 
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver 
Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to