My immediate thought on the delegate pattern is that it feels a little awkward. 
As a flex dev, I feel the event flow would be more familiar, but I guess we 
need to ask ourselves whether these api's will be used by old flex hats or 
whether we're appealing to a new group of developers. 

Maybe you could show some code to illustrate how it would work, for those not 
familiar with objective c and ios dev. 

In the mxml implementation it would be good to include a declarative display 
control similar to what we have in popup-wrapper. 


Espen

----- Original Message -----
From: Peter Ent [mailto:p...@adobe.com]
Sent: Friday, June 07, 2013 08:52 PM GMT Standard Time
To: flex-...@incubator.apache.org <flex-...@incubator.apache.org>
Subject: [DISCUSS] Alerts and Dialogs in FlexJS

Hi,

I'm currently working on the Alert dialog for FlexJS. Alex and I have been 
discussing options regarding event handling from the Alert dialog which could 
provide a pattern for future dialogs. We thought it would been good to get some 
opinions.

In Flex you normally post an Alert dialog using Alert.show() and pass it a 
closeFunction. The returned Alert instance can be used to listen for events for 
whatever else you want to do with it. The closeFunction is optional as you can 
also listen for events.

We thought of these possibilities:

Events: make the FlexJS Alert work the same - create an Alert instance and then 
listen for events.

Delegate pattern: register an object (probably the instance that is posting the 
Alert) as a delegate and implement one or more callbacks. This is how you would 
do it in iOS, for example.

Declare in MXML, something like this:

<fx:Declarations>
<basic:Alert id="foo" title="Panic" message="Yowza!" ok="doSomething()" 
cancel="doSomethingElse()" />
</fx:Declarations>

These are not mutually exclusive by any means.

Thoughts? Preferences?

Peter Ent
Flex SDK Team
Adobe Systems
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.

Reply via email to