RE: [flexcoders] dynamic context menu problem

2009-01-30 Thread Gregor Kiddie
The solution I put in place for a similar problem...

Add some javascript to eat the right click event (so the default menu
isn't shown), and have it dispatch an event to the application.

The application then dispatches a RIGHT_CLICK event having it bubble.

Any UI component listening for that event captures is and prevents it
from bubbling further (You want to let it get to the topmost point in
the display list, and catch it on the way back down).

That UI component opens up the menu you've set up for it.

 

Gk.

Gregor Kiddie
Senior Developer
INPS

Tel:   01382 564343

Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ

Registered Number: 1788577

Registered in the UK

Visit our Internet Web site at www.inps.co.uk
blocked::http://www.inps.co.uk/ 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact is.helpd...@inps.co.uk



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Michael Pelz-Sherman
Sent: 29 January 2009 19:53
To: flexcoders@yahoogroups.com
Subject: [flexcoders] dynamic context menu problem

 

I'm struggling to find an elegant solution to this problem:

 

I have a Flex app that has a dynamic context (right-click) menu.

 

The menu contains different items depending on whether various objects
are selected.

 

Ideally, I'd like to re-generate the menu options right when the user
right-clicks, but I haven't found a reasonable way to do this.

 

So instead I'm re-generating the menus every time the user (left)
clicks, which is kind of expensive and is having unwanted side-effects.

 

Unfortunately, MouseEvent.RIGHT_CLICK is AIR-only.

 

Any suggestions would be most appreciated!

 

- Michael

 



Re: [flexcoders] dynamic context menu problem

2009-01-30 Thread Michael Pelz-Sherman
Thanks Gregor! This is slightly more elegant than the solution I've come up 
with.

I *think* I follow you up to the last sentence.

How do you force the UI component to display its context menu? The display() 
method is AIR-only... right?

Is this an actual ContextMenu instance or a UI component masquerading as a 
ContextMenu?

- Michael




From: Gregor Kiddie gkid...@inpses.co.uk
To: flexcoders@yahoogroups.com
Sent: Friday, January 30, 2009 5:22:20 AM
Subject: RE: [flexcoders] dynamic context menu problem


The solution I put in place for a similar
problem…
Add some javascript to eat the right click
event (so the default menu isn’t shown), and have it dispatch an event to
the application.
The application then dispatches a “RIGHT_CLICK”
event having it bubble.
Any UI component listening for that event
captures is and prevents it from bubbling further (You want to let it get to
the topmost point in the display list, and catch it on the way back down).
That UI component opens up the menu you’ve
set up for it.
 
Gk.
Gregor Kiddie
Senior Developer
INPS
Tel:   01382
564343
Registered address: The Bread Factory, 1a Broughton Street, LondonSW8 3QJ
Registered Number: 1788577
Registered in the UK
Visit our Internet Web site at www.inps.co. uk
The information in this internet email is confidential and
is intended solely for the addressee. Access, copying or re-use of information
in it by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of INPS or
any of its affiliates. If you are not the intended recipient please contact
is.helpdesk@ inps.co.uk


 
From:flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf
Of Michael Pelz-Sherman
Sent: 29 January 2009 19:53
To: flexcod...@yahoogro ups.com
Subject: [flexcoders] dynamic
context menu problem
 
I'm struggling to find an elegant solution to this problem:
 
I have a Flex app that has a dynamic context (right-click)
menu.
 
The menu contains different items depending on whether
various objects are selected.
 
Ideally, I'd like to re-generate the menu options right when
the user right-clicks, but I haven't found a reasonable way to do this.
 
So instead I'm re-generating the menus every time the user
(left) clicks, which is kind of expensive and is having unwanted side-effects.
 
Unfortunately, MouseEvent.RIGHT_ CLICK is AIR-only.
 
Any suggestions would be most appreciated!
 
- Michael 

RE: [flexcoders] dynamic context menu problem

2009-01-30 Thread Gregor Kiddie
I wrote a routine that all my UIComponents can link into which uses the
standard Flex Menu in place of throwing up the context menu.

 

Gk.

Gregor Kiddie
Senior Developer
INPS

Tel:   01382 564343

Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ

Registered Number: 1788577

Registered in the UK

Visit our Internet Web site at www.inps.co.uk
blocked::http://www.inps.co.uk/ 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact is.helpd...@inps.co.uk



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Michael Pelz-Sherman
Sent: 30 January 2009 15:44
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] dynamic context menu problem

 

Thanks Gregor! This is slightly more elegant than the solution I've come
up with.

 

I *think* I follow you up to the last sentence.

 

How do you force the UI component to display its context menu? The
display() method is AIR-only... right?

 

Is this an actual ContextMenu instance or a UI component masquerading as
a ContextMenu?

 

- Michael

 



From: Gregor Kiddie gkid...@inpses.co.uk
To: flexcoders@yahoogroups.com
Sent: Friday, January 30, 2009 5:22:20 AM
Subject: RE: [flexcoders] dynamic context menu problem

The solution I put in place for a similar problem...

Add some javascript to eat the right click event (so the default menu
isn't shown), and have it dispatch an event to the application.

The application then dispatches a RIGHT_CLICK event having it bubble.

Any UI component listening for that event captures is and prevents it
from bubbling further (You want to let it get to the topmost point in
the display list, and catch it on the way back down).

That UI component opens up the menu you've set up for it.

 

Gk.

Gregor Kiddie
Senior Developer
INPS

Tel:   01382 564343

Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ

Registered Number: 1788577

Registered in the UK

Visit our Internet Web site at www.inps.co. uk

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact is.helpdesk@ inps.co.uk



From: flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com]
On Behalf Of Michael Pelz-Sherman
Sent: 29 January 2009 19:53
To: flexcod...@yahoogro ups.com
Subject: [flexcoders] dynamic context menu problem

 

I'm struggling to find an elegant solution to this problem:

 

I have a Flex app that has a dynamic context (right-click) menu.

 

The menu contains different items depending on whether various objects
are selected.

 

Ideally, I'd like to re-generate the menu options right when the user
right-clicks, but I haven't found a reasonable way to do this.

 

So instead I'm re-generating the menus every time the user (left)
clicks, which is kind of expensive and is having unwanted side-effects.

 

Unfortunately, MouseEvent.RIGHT_ CLICK is AIR-only.

 

Any suggestions would be most appreciated!

 

- Michael

 



Re: [flexcoders] dynamic context menu problem

2009-01-30 Thread Michael Pelz-Sherman
Ah, got it. Thanks, I wish I had taken this approach from the start!




From: Gregor Kiddie gkid...@inpses.co.uk
To: flexcoders@yahoogroups.com
Sent: Friday, January 30, 2009 11:15:54 AM
Subject: RE: [flexcoders] dynamic context menu problem


I wrote a routine that all my UIComponents
can link into which uses the standard Flex Menu in place of throwing up the
context menu.
 
Gk.
Gregor Kiddie
Senior Developer
INPS
Tel:   01382
564343
Registered address: The Bread Factory, 1a Broughton Street, LondonSW8 3QJ
Registered Number: 1788577
Registered in the UK
Visit our Internet Web site at www.inps.co. uk
The information in this internet email is confidential and
is intended solely for the addressee. Access, copying or re-use of information
in it by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of INPS or
any of its affiliates. If you are not the intended recipient please contact
is.helpdesk@ inps.co.uk


 
From:flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf
Of Michael Pelz-Sherman
Sent: 30 January 2009 15:44
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] dynamic
context menu problem
 
Thanks Gregor! This is slightly more elegant than the
solution I've come up with.
 
I *think* I follow you up to the last sentence.
 
How do you force the UI component to display its context menu?
The display() method is AIR-only... right?
 
Is this an actual ContextMenu instance or a UI component
masquerading as a ContextMenu?
 
- Michael
 


 
From:Gregor
Kiddie gkid...@inpses. co.uk
To: flexcod...@yahoogro ups.com
Sent: Friday, January 30, 2009
5:22:20 AM
Subject: RE: [flexcoders] dynamic
context menu problem
The solution I put in place for a similar problem…
Add some javascript to eat the right click event (so the default
menu isn’t shown), and have it dispatch an event to the application.
The application then dispatches a “RIGHT_CLICK” event having it
bubble.
Any UI component listening for that event captures is and prevents
it from bubbling further (You want to let it get to the topmost point in the
display list, and catch it on the way back down).
That UI component opens up the menu you’ve set up for it.
 
Gk.
Gregor Kiddie
Senior Developer
INPS
Tel:   01382
564343
Registered address: The Bread Factory, 1a Broughton
Street, London SW8 3QJ
Registered Number: 1788577
Registered in the UK
Visit our Internet Web site at www.inps.co. uk
The information in this internet email is confidential and
is intended solely for the addressee. Access, copying or re-use of information
in it by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of INPS or
any of its affiliates. If you are not the intended recipient please contact
is.helpdesk@ inps.co.uk


 
From:flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On 
Behalf Of Michael Pelz-Sherman
Sent: 29 January 2009 19:53
To: flexcod...@yahoogro ups.com
Subject: [flexcoders] dynamic
context menu problem
 
I'm
struggling to find an elegant solution to this problem:
 
I have a
Flex app that has a dynamic context (right-click) menu.
 
The menu
contains different items depending on whether various objects are selected.
 
Ideally, I'd
like to re-generate the menu options right when the user right-clicks, but I
haven't found a reasonable way to do this.
 
So instead
I'm re-generating the menus every time the user (left) clicks, which is kind of
expensive and is having unwanted side-effects.
 
Unfortunately,
MouseEvent.RIGHT_ CLICK is AIR-only.
 
Any
suggestions would be most appreciated!
 
- Michael