Oh, to be a little bit more to the point. You can have all your own
event types to piggyback special types of data, but I never found the
need.

The two most important event types, the no-data event and the
some-data event, are trivial:

object.fireEvent('myEventThatNeedsNodata')

And the data-events are created like:

object.fireDataEvent('myEventWithData', "This is the data")

What is important is that tell qooxdoo that you will be sending these
types of events. That is this part of the example:

 
},events:{///////////////////////////////////////////////////////////////////////

  'cancel':qx.event.type.Event,
  'answer':qx.event.type.DataEvent

In your class-construction map. This tells him what events (cancel and
answer) you will send and which type there are. (cancel is a simple
event, answer is a data event)





2008/12/29 Ralf Nieuwenhuijsen <[email protected]>:
> Alright, I assume you want to do something like this in your application:
>
>  var inputWindow = new myApp.myModelWindow();
>  inputWindow.addListener('answer', function( e ){
>    alert( 'You answered: ' + e.getValue() );
>  }, this);
>  inputWindow.addListener('cancel', function(){
>    alert('You choose cancel!');
>  }, this);
>
> Below i've put an example class in that spirit.
> A nice touch is that it disables the ok-button until there is actually
> _some answer_
>
> This class throws, besides all the events of a normal window, also the
> 'answer' and the 'cancel' event.
>
> qx.Class.define("myApp.myModelWindow",{
> ////////////////////////////////////////////////////////////////
> extend:qx.ui.window.Window,
> construct:function(){
>
>  this.base( arguments, 'My modal input window, yahoo!' );
>  this.setModal( true );
>
>  var cancelButton = new qx.ui.form.Button('Cancel');
>  var okButton = new qx.ui.form.Button('Ok')
>  okButton.setEnabled( false );
>
>  // you might need to setup a layout handler or something; i'm
> assuming canvas here
>
>  this.add(okButton, {bottom: 10, right: 10});
>  this.add(cancelButton, {bottom: 10, left: 10});
>
>  // code that adds the input buttons and sets up
>  // event listeners that put the current value in the answer property
>
>  this.addListener('changeAnswer', function( e ){
>        okButton.setEnabled( e.getValue() != null );
>  }, this);
>
>  cancelButton.addListener('execute', function(){
>    this.fireEvent('cancel');
>  }, this);
>
>  okButton.addListener('execute', function(){
>    this.fireDataEvent('answer', this.getAnswer());
>  }, this);
>
>
> },events:{///////////////////////////////////////////////////////////////////////
>
>  'cancel':qx.event.type.Event,
>  'answer':qx.event.type.DataEvent
>
> },properties:{///////////////////////////////////////////////////////////////////
>
>  answer:{ nullable:true, check:'String', event:'changeAnswer' }
>
> },members:{//////////////////////////////////////////////////////////////////////
> },statics:{//////////////////////////////////////////////////////////////////////
> }});/////////////////////////////////////////////////////////////////////////////
>
> Sorry for the formatting, but it's what makes me lazy .. (my editor
> generates them)
>
> Cheers..
>
> 2008/12/29 Larry Blische <[email protected]>:
>> My app will have a few modal windows which will collect info from the
>> user. The user will have the option of a CANCEL or an OK button to end
>> his input. At this time the modal window will close and the root
>> window will be unblocked.
>>
>> In my first attempt at this I am using a numeric keypad (using the
>> calculator demo for guidance) to collect a sequence of digits (this
>> app is touchscreen based and there will be no keyboard). I have
>> implemented the keypad in a qooxdoo class. I am able to create the
>> modal window from the main app, blocking the root widget and collect
>> the digits from the keypad. I am looking for some way to return the
>> string of digits back to the main app class.
>>
>> I am thinking that I want to listen for an event in the main app and
>> generate an event in the keypad class. I have looked at (and attempted
>> using) qx.event.Registration.fireEvent() but I cannot find any
>> examples of this in my searches. The 3rd and 4th arguments of
>> fireEvent() mystify me too.
>>
>> First of all, does this sound like a reasonable way of doing this?
>>
>> Second, if this is reasonable, can anyone give pointers or examples?
>>
>> Thanks,
>> Larry Blische
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to