[flexcoders] Re: auto close popups

2010-02-06 Thread Glenn Jones
Thanks for the suggestions

Looking through some of the mx:controls, I found MOUSE_DOWN_OUTSIDE - seems
to be the way to go.

On Thu, Feb 4, 2010 at 4:02 PM, Glenn Jones tgjone...@gmail.com wrote:

 I have a popup that's opened in the usual way with the popup manager.  It's
 not modal.
 Sometimes the controls within the popup are enabled so that the user can
 interact with them,
 and sometimes the controls are disabled because the contents are read-only.

 As soon as the user clicks anywhere else in the application, I'd like to
 close the popup.

 Is there an easy way to do that?

 Based on what I've read, the popup should have it's own instance of
 FocusManager, and that
 FocusManager should receive a deactive() call if the user clicks somewhere
 else. So I thought
 about extending the FocusManager with some new class designed to close the
 parent form
 on deactivate.  But was hoping there was a better way.

 Thanks,
 Glenn



[flexcoders] auto close popups

2010-02-04 Thread Glenn Jones
I have a popup that's opened in the usual way with the popup manager.  It's
not modal.
Sometimes the controls within the popup are enabled so that the user can
interact with them,
and sometimes the controls are disabled because the contents are read-only.

As soon as the user clicks anywhere else in the application, I'd like to
close the popup.

Is there an easy way to do that?

Based on what I've read, the popup should have it's own instance of
FocusManager, and that
FocusManager should receive a deactive() call if the user clicks somewhere
else. So I thought
about extending the FocusManager with some new class designed to close the
parent form
on deactivate.  But was hoping there was a better way.

Thanks,
Glenn


[flexcoders] using system fonts in Flex

2009-12-08 Thread Glenn Jones
AFAIK, any fonts used in Flex have to be compiled into the SWF.

Is there some way to use system fonts that are already installed on a
customer machine?

Specifically, I'd like to build an app that uses Microsoft's new Segoi UI
font (included
with Vista and Office 2007) without compiling a TTF into my SWF.

Thanks,
Glenn


Re: [flexcoders] using system fonts in Flex

2009-12-08 Thread Glenn Jones
Thanks for all of the helpful responses.

I don't need to rotate the text or do anything exotic with it - just render
basic labels.
I'm actually trying to avoid embedding fonts in the SWF as I don't have a
license to redistribute my preferred font.

If I can specify a list of fonts that includes one or more fonts which are
already installed on Windows,
then that will work fine for my case.

Given a use-case involving Flash running in IE7 on a Windows OS, is it safe
to assume that device fonts in the context of this thread refers to any
font installed on the Windows client machine?

Thanks,
Glenn

On Tue, Dec 8, 2009 at 6:18 PM, Gordon Smith gosm...@adobe.com wrote:



   Out of curiosity, why *can't* Flash do things like rotate text unless
 the corresponding font is embedded?

  Couldn't it just embed the necessary glyphs from the local font on an
 as-needed basis?



 For one thing, you don't generally know at compile time (i.e., when the SWF
 is being created) what text you're going to render at runtime (i.e., when
 the SWF is being executed). The data to display often comes from outside, or
 gets calculated in some way. And even if all the text was set explicitly in
 MXML or AS, the compiler doesn't understand what those assignment statements
 are actually doing, as opposed to c = a + b.



 For another thing, I think with device fonts the Player doesn't just grab
 glyphs and render them… I think it uses the OS to render them. So if the OS
 doesn't have rotation APIs, it can't rotate them.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Guy Morton
 *Sent:* Tuesday, December 08, 2009 3:55 PM

 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] using system fonts in Flex





 Yes, the original post didn't state why he thought embedding was required,
 so you may be right and the requirement may have been to do something you
 can only do with an embedded font. In which case, neither of us has provided
 a useful answer, other that yes you need to embed the font in a swf
 file... :-)



 Out of curiosity, why *can't* Flash do things like rotate text unless the
 corresponding font is embedded? Couldn't it just embed the necessary glyphs
 from the local font on an as-needed basis?



 Guy









 On 09/12/2009, at 10:16 AM, Alex Harui wrote:





 It will if he wants to use device fonts.  I just assumed he wanted to use
 embedded fonts for various rendering effects.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcoders@ flexcoders@yahoog!
 roups.com] *On Behalf Of *Guy Morton

 *Sent:* Tuesday, December 08, 2009 2:55 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] using system fonts in Flex





 Are you sure it won't pick up locally available fonts? I'm fairly sure it
 will. If you use CSS to define the font to use you can specify a list of
 fonts to degrade to, so if ! your preferred font is unavailable the next one
 on the list wi! ll be us ed.



 Have you tried that?



 Guy





 On 09/12/2009, at 7:12 AM, Glenn Jones wrote:




AFAIK, any fonts used in Flex ha! ve to be compiled into the SWF.

 Is there some way to use system fonts that are already installed on a
 customer machine?

 Specifically, I'd like to build an app that uses Microsoft's new Segoi UI
 font (included
 with Vista and Office 2007) without compiling a TTF into my SWF.

 Thanks,
 Glenn







   



[flexcoders] passing flashvars from the command line

2009-04-27 Thread Glenn Jones
Hi,

I have a test scenario where I need to invoke a SWF programmatically from
the command line.

Starting and running the SWF from the command line works fine. My problem is
that I can't figure out a way to
specify the equivalent of flashvars when starting the Flash Player from the
command line.

Is there a way to specify parameters on command line when starting the Flash
Player such that those parameters
can be accessed at runtime via Application.application.parameters?


Re: [flexcoders] passing flashvars from the command line

2009-04-27 Thread Glenn Jones
Yes - I'm running the standalone player outside of a browser in order to run
automated unit-tests from the command line.


On Mon, Apr 27, 2009 at 1:27 PM, Tracy Spratt tr...@nts3rd.com wrote:



  You are talking about the stand-alone Flash Player?



 Tracy Spratt,

 Lariat Services, development services available
   --

 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Glenn Jones
 *Sent:* Monday, April 27, 2009 2:11 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] passing flashvars from the command line






  Hi,

 I have a test scenario where I need to invoke a SWF programmatically from
 the command line.

 Starting and running the SWF from the command line works fine. My problem
 is that I can't figure out a way to
 specify the equivalent of flashvars when starting the Flash Player from the
 command line.

 Is there a way to specify parameters on command line when starting the
 Flash Player such that those parameters
 can be accessed at runtime via Application.application.parameters?

   



[flexcoders] using mxmlc/compc with 64-bit, 1.6 JVM

2009-03-18 Thread Glenn Jones
I'm having problems trying to run the mxmlc/compc compilers with a 64-bit
version of the 1.6 JVM.

Has anyone else tried that kind of configuration?

Does Flex support use of 64-bit JVM for compilation purposes?

PS. I've only tried on Windows XP-64 so far, but would like to use 64-bit
compile on Linux also


Re: [flexcoders] using mxmlc/compc with 64-bit, 1.6 JVM

2009-03-18 Thread Glenn Jones
It just hangs

On Wed, Mar 18, 2009 at 11:23 AM, Maciek Sakrejda msakre...@truviso.comwrote:

   What kind of problems are you seeing. Perhaps this is the JVM segfault a
 co-worker ran into on a 64-bit JVM on OS X?


 -Original Message-
 From: Glenn Jones tgjone...@gmail.com tgjonestx%40gmail.com
 Reply-to: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: [flexcoders] using mxmlc/compc with 64-bit, 1.6 JVM
 Date: Wed, 18 Mar 2009 09:10:05 -0500

 I'm having problems trying to run the mxmlc/compc compilers with a
 64-bit version of the 1.6 JVM.

 Has anyone else tried that kind of configuration?

 Does Flex support use of 64-bit JVM for compilation purposes?

 PS. I've only tried on Windows XP-64 so far, but would like to use
 64-bit compile on Linux also

  



Re: [flexcoders] DataGrid selectAll problem

2009-01-12 Thread Glenn Jones
I've tried setting just selectedIndices - same result

In my CheckBoxDataGrid.selectAll() method, I tried calling
invalidateProperties/invalidateList/validateNow - same result.

In my CheckBoxHeaderRenderer.clickHandler, I tried using callLater to
execute CheckBoxDataGrid.selectAll() - same result.

I repeated the callLater test after removing
invalidateProperties/invalidateList/validateNow - same result.

Any suggestions on which operations I should use for callLater()?

As a workaround, I added an event listener for itemEditBeginning on the
checkboxdatagrid. If the selected item count was  1,
then I called event.preventDefault().  This actually triggers a crash
sometime later in mx:DataGrid (line 3889 - itemEditorInstance is null).



On Mon, Jan 12, 2009 at 10:07 AM, Alex Harui aha...@adobe.com wrote:

I would not set  both selectedItems and selectedIndices.  Probably just
 selectedIndices because it should be faster.



 I don't think selectItem will be called if the item is already selected.
 Due to the way invalidation works, maybe it hasn't been de-selected yet.
 Sometimes, callLater can help in these situations.



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Glenn Jones
 *Sent:* Saturday, January 10, 2009 4:52 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] DataGrid selectAll problem



 I started with the example from your blog dated Feb 2008
 (CheckBoxListAndDataGrid).

 To deselect the other rows, the checkbox column header renderer calls a
 'selectAll()' method on the CheckBoxDataGrid
 with  a flag of false.  That method builds two arrays - one for all items
 in the collection and one for all indices in the collection.
 It then replaces mx:DataGrid.selectedItems and selectedIndices with new
 arrays. In the deselect case, the new arrays are empty.
 In the select all case then have all items/indices.

 Visually, selectAll true/false seems to work when it's called. But in the
 use-case I describe below I'm counting on the
 mx:DataGrid.selectItem() to be called in order to deselect rows in the case
 that a single row is selected.
 Based on trace statements, I know that mx:DataGrid.selectItem() is never
 called when the problem occurs

 Is there something about the way I'm selecting things which causes the
 selectItem() to not be called?

 I tried replacing just selectedItemds or just selectedIndicies or both. it
 doesn't seem.

 Thanks,
 Glenn

 On Fri, Jan 9, 2009 at 1:11 AM, Alex Harui aha...@adobe.com wrote:

 Which example did you start with?  Which event do you use to deselect the
 other rows, and what does that code look like?



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Glenn Jones
 *Sent:* Thursday, January 08, 2009 9:49 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] DataGrid selectAll problem



 Hi,

 I'm using Flex 3.2 and I have a DataGrid which implements a column of
 checkboxes to select rows.  I started with Alex' example.
 Then I added a header renderer on the checkbox column such that if check
 the header, then all rows are selected.
 To implement the select all behavior, I'm creating an array of indices for
 [0..n] and assigning that array to mx:DataGrid.selectedIndices.

 For the most part this works fine.

 But if the DataGrid is editable, then I sometimes have a problem. The
 problem is that if all rows are selected, and you click on
 an editable cell, sometimes the cell becomes editable without deselecting
 all of the other rows. The behavior I want is that
 if you start editing a cell, then just that row becomes selected. This
 happens some of time, but not all of the time.

 If the grid is non-editable, then I can't reproduce the problem.

 I overrode mx:DataGrid.selectItem() in order to clear the checkbox in the
 header renderer any time a single item is selected.  I've
 noticed that when the problem behavior occurs, the mx:DataGrid.selectItem()
 method is never called.

 It's almost like there's some race condition between selecting an item and
 starting a cell edit.

 Any ideas on how I could work around this?

 Thanks,
 Glenn



   



Re: [flexcoders] DataGrid selectAll problem

2009-01-10 Thread Glenn Jones
I started with the example from your blog dated Feb 2008
(CheckBoxListAndDataGrid).

To deselect the other rows, the checkbox column header renderer calls a
'selectAll()' method on the CheckBoxDataGrid
with  a flag of false.  That method builds two arrays - one for all items in
the collection and one for all indices in the collection.
It then replaces mx:DataGrid.selectedItems and selectedIndices with new
arrays. In the deselect case, the new arrays are empty.
In the select all case then have all items/indices.

Visually, selectAll true/false seems to work when it's called. But in the
use-case I describe below I'm counting on the
mx:DataGrid.selectItem() to be called in order to deselect rows in the case
that a single row is selected.
Based on trace statements, I know that mx:DataGrid.selectItem() is never
called when the problem occurs

Is there something about the way I'm selecting things which causes the
selectItem() to not be called?

I tried replacing just selectedItemds or just selectedIndicies or both. it
doesn't seem.

Thanks,
Glenn

On Fri, Jan 9, 2009 at 1:11 AM, Alex Harui aha...@adobe.com wrote:

Which example did you start with?  Which event do you use to deselect
 the other rows, and what does that code look like?



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Glenn Jones
 *Sent:* Thursday, January 08, 2009 9:49 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] DataGrid selectAll problem



 Hi,

 I'm using Flex 3.2 and I have a DataGrid which implements a column of
 checkboxes to select rows.  I started with Alex' example.
 Then I added a header renderer on the checkbox column such that if check
 the header, then all rows are selected.
 To implement the select all behavior, I'm creating an array of indices for
 [0..n] and assigning that array to mx:DataGrid.selectedIndices.

 For the most part this works fine.

 But if the DataGrid is editable, then I sometimes have a problem. The
 problem is that if all rows are selected, and you click on
 an editable cell, sometimes the cell becomes editable without deselecting
 all of the other rows. The behavior I want is that
 if you start editing a cell, then just that row becomes selected. This
 happens some of time, but not all of the time.

 If the grid is non-editable, then I can't reproduce the problem.

 I overrode mx:DataGrid.selectItem() in order to clear the checkbox in the
 header renderer any time a single item is selected.  I've
 noticed that when the problem behavior occurs, the mx:DataGrid.selectItem()
 method is never called.

 It's almost like there's some race condition between selecting an item and
 starting a cell edit.

 Any ideas on how I could work around this?

 Thanks,
 Glenn

   



[flexcoders] Re: DataGrid renderering issue - Porting from Flex 2 to Flex 3

2009-01-08 Thread Glenn Jones
FYI - I found the problem - thought I would pass the info along for
posterity.

My issue was caused by custom header renderers - if every column used a
custom renderer, then I would get this problem.  Turns out my custom
renderers
were not setting explicitHeight or measuredHeight, so the
mx:DataGrid.calculateHeaderHeight() would end up with a value of 0.  Setting
a value for measuredHeight
on my custom renderer fixed the problem.  In the cases where I had some
grids that worked correctly, it turns out that they had at least on header
renderer that
extended mx:Checkbox or mx:DataGridItemRenderer. Apparently those classes
return something for measuredHeight.

Not sure what changed between Flex 2 and Flex 3.2 to cause this - some bug
fix I guess.

I've read the excellent blog on item renderers (
http://blogs.adobe.com/aharui/item_renderers/) and other sources about the
component lifecycle, but I haven't found a
discussion about requirements for custom renderers to set measuredHeight or
measuredwidth - can anyonne elaborate on that topic?

Thanks

On Wed, Jan 7, 2009 at 10:18 AM, Glenn Jones tgjone...@gmail.com wrote:

 I recently upgraded from Flex 2.0.1 to 3.2. I have a class that extends
 mx:DataGrid. In Flex 3.2, some instances of this grid class are rendered
 just fine, but some instances (about half maybe) are drawn incorrectly - the
 first row of data values is drawn on top of the column header row. At least,
 that's the visual result.

 So far I haven't been able to isolate a root-cause or even a good clue to
 separate instances that work right from those that don't.

 Has anyone else seen something like this?

 I've reviewed the issues noted here:

 http://learn.adobe.com/wiki/display/Flex/Backwards+Compatibility+Issues
 http://butterfliesandbugs.wordpress.com/page/2/

 But I don't **think** any of them are related to this issue:

 - my flex2 code did not use/override DataGrid.drawHeaderBackground
 - I've tried to locate and correct all of the changes for decreasing
 rowIndex and rowCount/lockedRowCount by 1

 Any suggestions are much appreciated.

 Thanks,
 - Glenn



[flexcoders] DataGrid selectAll problem

2009-01-08 Thread Glenn Jones
Hi,

I'm using Flex 3.2 and I have a DataGrid which implements a column of
checkboxes to select rows.  I started with Alex' example.
Then I added a header renderer on the checkbox column such that if check the
header, then all rows are selected.
To implement the select all behavior, I'm creating an array of indices for
[0..n] and assigning that array to mx:DataGrid.selectedIndices.

For the most part this works fine.

But if the DataGrid is editable, then I sometimes have a problem. The
problem is that if all rows are selected, and you click on
an editable cell, sometimes the cell becomes editable without deselecting
all of the other rows. The behavior I want is that
if you start editing a cell, then just that row becomes selected. This
happens some of time, but not all of the time.

If the grid is non-editable, then I can't reproduce the problem.

I overrode mx:DataGrid.selectItem() in order to clear the checkbox in the
header renderer any time a single item is selected.  I've
noticed that when the problem behavior occurs, the mx:DataGrid.selectItem()
method is never called.

It's almost like there's some race condition between selecting an item and
starting a cell edit.

Any ideas on how I could work around this?

Thanks,
Glenn


[flexcoders] DataGrid renderering issue - Porting from Flex 2 to Flex 3

2009-01-07 Thread Glenn Jones
I recently upgraded from Flex 2.0.1 to 3.2. I have a class that extends
mx:DataGrid. In Flex 3.2, some instances of this grid class are rendered
just fine, but some instances (about half maybe) are drawn incorrectly - the
first row of data values is drawn on top of the column header row. At least,
that's the visual result.

So far I haven't been able to isolate a root-cause or even a good clue to
separate instances that work right from those that don't.

Has anyone else seen something like this?

I've reviewed the issues noted here:

http://learn.adobe.com/wiki/display/Flex/Backwards+Compatibility+Issues
http://butterfliesandbugs.wordpress.com/page/2/

But I don't **think** any of them are related to this issue:

- my flex2 code did not use/override DataGrid.drawHeaderBackground
- I've tried to locate and correct all of the changes for decreasing
rowIndex and rowCount/lockedRowCount by 1

Any suggestions are much appreciated.

Thanks,
- Glenn


[flexcoders] httpservice/save-as question

2008-11-07 Thread Glenn Jones
I already have working code that uses HttpService to send various requests
to the backend from my Flex client
and process the responses.

I also have a customized implementation of the flex DataGrid which
implements paging such that the flex client
only shows one page of data at a time.  The customized control has buttons
to issue page forward/backward
requests to the backend to get a different page of data.  These requests are
sent to the backend with HttpService.

I have a requirement to save all pages in CSV format on the clients desktop.

Prior to flex we had an HTML/Javascript implementation of tables which had
the same sort of feature - in that version,
the backend would retrieve all of the data, format into csv, and change the
content-type on the HTTP response header
to text/csv and then setting the content-disposition to attachment,
filename=file.csv. The net result was that the browser
itself would take care of displaying a dialog that says something like Do
you want to open or save this file?

I haven't been able to get the same sort of behavior to work with a request
generated by the Flash Player. I have my code
in the backend modify the HTTP headers in the response to my flex
export-to-csv request, but the browser neers displays
its open/save dialog - the response always gets directed back to the flash
player.

Is there a way to make this work?

Thanks,
Glenn


[flexcoders] error border on custom itemRenderer

2008-11-04 Thread Glenn Jones
I'm having a problem with red borders drawn around a cell in the DataGrid.

I have a custom itemRenderer which extends HBox and impements
IDropInListItenRenderer

In the set data() method, I set errorString based on conditions in the data.
The errorString is either set to null or a non-blank string.
In the same set data() method, I also call the super class
invalidateProperties and invalidateDisplayList methods.

For reasons, I don't understand teh parent HBox class does not draw the
border when the borderColor is set to errorColor. So I modified
the updateDisplayList() method of my custom renderer to say - if (
getStyle(borderColor) == getStyle(errorColor) ) then draw a border
myself using the errorColor (defaults to red).

So far so good.

But I have two problem symptoms:

1. If I correct the error in the underlying data, the red border remains
around the cell even though I've verified that my code is NOT drawing
it, and the borderColor style is no longer red

2. If I start scrolling around in the grid, other cells without errors are
getting a red border.

I understand that the grid recycles instances of itemRenderers for
performance reasons, so I suspect that fixing root cause of #1 will fix #2.
But I'm at a loss as to what to do about #1.

Suggestions appreciated.

Thanks,
Glenn


[flexcoders] FlexUnit, DataGrid and listItems

2008-09-10 Thread Glenn Jones
I'm using Flex 2.0.1 SDK, and I have a class that extends mx:DataGrid.

One of the methods in my class is dependent on listItems which is a map of
item renderers.

I'm trying to test my method with FlexUnit, but I can't get listItems
populated so the test can't really
check anything.

In my FlexUnit test, I'm adding the DataGrid instance to a container to get
all of it's properties
initialized. I'm also adding columns to the DG instance. I'm adding data
that maps to those columns.
I've tried calling validateNow(), invalidateList() and
invalidateDisplayList(), but nothing I've done so
far has managed to get listItems populated.

Any suggestions on what I can in FlexUnit to get the grid to create item
renderers?

Thanks,
- Glenn


Re: [flexcoders] TextArea popup editor in DataGrid

2008-08-04 Thread Glenn Jones
Getting back to this issue ...

As near as I can tell, when the DG gets an exception,
DataGrid.focusOutHandler was
never called.

Instead, calling  _popup.setFocus(); in the creationComplete handler for
my item-editor triggers a call to itemEditorFocusOutHandler, which ends up
calling mx:DataGrid.contains() event.relatedObject which is equal to the
UITextField
which is owned by the  TextField which is  owned by my Popup class which
is owned by the mx:DataGrid.

But itemEditorFocusOutHandler() doesn't call owns() or
itemRendererContains();
it just calls contains().

I tried moving the setFocus into the INITIALIZE event handler, but that's
apparently
too early to setFocus because then I get an exception trying to setFocus.

I can't use my own FOCUS_OUT event handler on the item editor to cancel the
event
when the popup is receiving focus, because FOCUS_OUT is not cancelable.

I can't override the DataGrid.itemEditorFocusOutHandler() because it's
private.

Any other suggestions?

Thanks,
Glenn

On Tue, Jul 29, 2008 at 1:20 PM, Alex Harui [EMAIL PROTECTED] wrote:

focusOutHandler should have called itemRendererContains with your
 custom class and that textfield and the owner chain should have gotten from
 the textfield to the custom class.  It shouldn't matter what the parent is,
 you want it to be the systemManager.  It should be the fifth if statement


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Tuesday, July 29, 2008 9:16 AM
 *To:* flexcoders@yahoogroups.com

 *Subject:* Re: [flexcoders] TextArea popup editor in DataGrid



 I trapped in DataGrid.itemEditorFocusOutHandler() - the chain of 'owner'
 values for event.relatedObject
 does goes back to the grid, but the chain of 'parent' values does not.

 The event.relatedObject is type UITTextField  The owner  parent of
 UITextField is an instance of TextArea.
 This is the instance managed by PopUpManager. The TextArea.owner =
 myCustomClass (the item editor instance),
 but TextArea.parent is an instance of myApp_mx_managers_SystemManager.

 I tried calling addChild() with the popup TextArea instance, but it really
 didn't lilke that - apparently PopUpManager
 likes to parent all of the popups (which makes sense).

 Any other suggestions or have I reached a dead-end with this approach?

 Thanks for your help,
 Glenn

 On Mon, Jul 28, 2008 at 11:41 PM, Alex Harui [EMAIL PROTECTED] wrote:

 Walk through the focusOutHandler on DataGrid.  In theory, if the object
 getting focus is owned by the itemeditor, it shouldn't try to end the edit
 session.


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Monday, July 28, 2008 3:41 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] TextArea popup editor in DataGrid



 I've tried using a popup TextArea but I'm having real problems trying to
 get it to work as an item editor
 within a datagrid.

 My business requirements are

 - someone can click in the DG cell to start editing. If the cell uses a
 TextArea control, they should get popup-like TA that extends across rows to
 enter longer blocks of text
 - the user can enter data in any text-based editable cell without using a
 mouse (but they can use a mouse if they want to)
 - someone can tab across a row in the DG; our DG needs to move from one
 editable cell to the next (and go to next editable row if they tab out of
 the last editable cell in a row)
 - the user can use shift-tab to go to previous editable cell
 - the user can use ENTER to finish the edit and save the row
 - the user can use ESCAPE to cancel the edit

 So I've already got all of the keyboard behavior working with a TextField
 controls. It also works if I use a simple TextArea as the item editor (but
 see if the beginning of the thread for my problem with a simple TextArea).

 However, when I open the TextArea with a PopUpManager I'm having problems.
 My custom item editor is composed of a Canvas:

 public class PopUpTextArea extends Canvas
 implements IDropInListItemRenderer, IFocusManagerComponent

 On creationComplete, the editor creates a new instance of TextArea, and
 uses PopUpManager to open it.

 _popup = new TextArea();
 _popup.width= this.width;
 _popup.height= EDIT_HEIGHT;
 _popup.text = this._text;
 _popup.owner = this;

 PopUpManager.addPopUp(_popup, this, false);
 PopUpManager.bringToFront(_popup);

 But ...

 If I try to programmatically set focus on the popup, the DG crashes.
 Apparently, it's getting wrapped around a pole somehow because setting focus
 on the popup triggers an item-edit-end.  If I click in the TA, it either
 (A) goes in a little circle - item-edit-end is called because the Canvas
 losses focus, so it
 closes the TA, but the editedItemPosition doesn't move, so

[flexcoders] datagrid crash on horizontal scroll

2008-08-04 Thread Glenn Jones
Hi,

I think I may have run into a bug in the DataGrid, but it was hard to tell
from the Adobe Issue Navigator because so many of
the items that sounded like my problem were imported such that details
aren't visible. Hoping someone can give me a workaround
or confirmation that this is a known issue (possible fixed in flex 3?)

I'm using 2.0.1 hotfix 3.  I've got two different crashes, but both have the
same sort of symptom - when scrolling to the right as result
of a TAB, if the next editable column uses a checkbox as an item renderer,
the grid will throw an exception. Both grids have locked columns. In both
cases the checkbox column is offscreen initially, but the tab from the
rightmost visible column should scroll the checkbox column into view and
then set focus on a cell in the checkbox column.

In the one case I've tried to debug, it looks like listItems has not been
updated to be in sync with horizontalScrollPosition.  I've got
3 columns of interest in this scenario: column 6 is editable text, column 7
is non-editable text, column 8 is an editable checkbox.
Initially, column 6 has focus and columns 7  8 are not visible. When I tab
out of column 6 focus moves to column 8, but
DataGrid.itemEditorInstance is not my Checkbox class - it's an instance of
DataGridItemRenderer corresponding to the non-editable
text in column 7 - as soon as I tab out of column 8, then things go south in
itemEditEnd because itemEditorInstance is not really
the item-editor.

I stepped into createItemEditor - as near as I can tell, the column index is
correct, but horizontalScrollPosition and listItems are
not in sync with each other.

Anybody seen this?

Thanks


Re: [flexcoders] TextArea popup editor in DataGrid

2008-07-29 Thread Glenn Jones
I trapped in DataGrid.itemEditorFocusOutHandler() - the chain of 'owner'
values for event.relatedObject
does goes back to the grid, but the chain of 'parent' values does not.

The event.relatedObject is type UITTextField  The owner  parent of
UITextField is an instance of TextArea.
This is the instance managed by PopUpManager. The TextArea.owner =
myCustomClass (the item editor instance),
but TextArea.parent is an instance of myApp_mx_managers_SystemManager.

I tried calling addChild() with the popup TextArea instance, but it really
didn't lilke that - apparently PopUpManager
likes to parent all of the popups (which makes sense).

Any other suggestions or have I reached a dead-end with this approach?

Thanks for your help,
Glenn

On Mon, Jul 28, 2008 at 11:41 PM, Alex Harui [EMAIL PROTECTED] wrote:

Walk through the focusOutHandler on DataGrid.  In theory, if the object
 getting focus is owned by the itemeditor, it shouldn't try to end the edit
 session.


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Monday, July 28, 2008 3:41 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] TextArea popup editor in DataGrid



 I've tried using a popup TextArea but I'm having real problems trying to
 get it to work as an item editor
 within a datagrid.

 My business requirements are

 - someone can click in the DG cell to start editing. If the cell uses a
 TextArea control, they should get popup-like TA that extends across rows to
 enter longer blocks of text
 - the user can enter data in any text-based editable cell without using a
 mouse (but they can use a mouse if they want to)
 - someone can tab across a row in the DG; our DG needs to move from one
 editable cell to the next (and go to next editable row if they tab out of
 the last editable cell in a row)
 - the user can use shift-tab to go to previous editable cell
 - the user can use ENTER to finish the edit and save the row
 - the user can use ESCAPE to cancel the edit

 So I've already got all of the keyboard behavior working with a TextField
 controls. It also works if I use a simple TextArea as the item editor (but
 see if the beginning of the thread for my problem with a simple TextArea).

 However, when I open the TextArea with a PopUpManager I'm having problems.
 My custom item editor is composed of a Canvas:

 public class PopUpTextArea extends Canvas
 implements IDropInListItemRenderer, IFocusManagerComponent

 On creationComplete, the editor creates a new instance of TextArea, and
 uses PopUpManager to open it.

 _popup = new TextArea();
 _popup.width= this.width;
 _popup.height= EDIT_HEIGHT;
 _popup.text = this._text;
 _popup.owner = this;

 PopUpManager.addPopUp(_popup, this, false);
 PopUpManager.bringToFront(_popup);

 But ...

 If I try to programmatically set focus on the popup, the DG crashes.
 Apparently, it's getting wrapped around a pole somehow because setting focus
 on the popup triggers an item-edit-end.  If I click in the TA, it either
 (A) goes in a little circle - item-edit-end is called because the Canvas
 losses focus, so it
 closes the TA, but the editedItemPosition doesn't move, so it creates a new
 instance of the editor which opens the popup, or (B) it just closes the
 item-editor
 because the item-editor lost focus

 I also tried to capture keystrokes on the Canvas and pass them to the TA,
 that didn't work either. But even if it did work, the user still needs the
 ability
 to use the mouse if they want to.

 So is it possible to use a TextArea in a PopUp as an item editor in a
 DataGrid?

  On Fri, Jul 18, 2008 at 4:42 PM, Alex Harui [EMAIL PROTECTED] wrote:

 Well, you could popup a TextArea like PopUpButton does, but it sounds like
 your real goal is to have the TA extend across rows and not be below the
 lines.  I assume you don't want the TA to fit within a single row?



 How will you handle the area at the bottom of the DG?  If I click the last
 row, should the TA extend two rows below the DG?


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Friday, July 18, 2008 11:17 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] TextArea popup editor in DataGrid



 I have a DataGrid where one of the columns is a TextArea control as the
 itemEditor.

 When I edit a cell in the column with the TextArea editor, the TextArea
 opens up to a height equivalent to
 three rows of data in the grid. The editor works fine; in fact it's been
 working this way for some time.

 But recently, we enabled horizontal and vertical grid lines on the grid.
 When the TextArea editor opens up,
 the datagrid horizontal grid lines are drawn across the top of the control.

 I've verified that the TextArea control is not inheriting

Re: [flexcoders] TextArea popup editor in DataGrid

2008-07-28 Thread Glenn Jones
I've tried using a popup TextArea but I'm having real problems trying to get
it to work as an item editor
within a datagrid.

My business requirements are

- someone can click in the DG cell to start editing. If the cell uses a
TextArea control, they should get popup-like TA that extends across rows to
enter longer blocks of text
- the user can enter data in any text-based editable cell without using a
mouse (but they can use a mouse if they want to)
- someone can tab across a row in the DG; our DG needs to move from one
editable cell to the next (and go to next editable row if they tab out of
the last editable cell in a row)
- the user can use shift-tab to go to previous editable cell
- the user can use ENTER to finish the edit and save the row
- the user can use ESCAPE to cancel the edit

So I've already got all of the keyboard behavior working with a TextField
controls. It also works if I use a simple TextArea as the item editor (but
see if the beginning of the thread for my problem with a simple TextArea).

However, when I open the TextArea with a PopUpManager I'm having problems.
My custom item editor is composed of a Canvas:

public class PopUpTextArea extends Canvas
implements IDropInListItemRenderer, IFocusManagerComponent

On creationComplete, the editor creates a new instance of TextArea, and uses
PopUpManager to open it.

_popup = new TextArea();
_popup.width= this.width;
_popup.height= EDIT_HEIGHT;
_popup.text = this._text;
_popup.owner = this;

PopUpManager.addPopUp(_popup, this, false);
PopUpManager.bringToFront(_popup);

But ...

If I try to programmatically set focus on the popup, the DG crashes.
Apparently, it's getting wrapped around a pole somehow because setting focus
on the popup triggers an item-edit-end.  If I click in the TA, it either (A)
goes in a little circle - item-edit-end is called because the Canvas losses
focus, so it
closes the TA, but the editedItemPosition doesn't move, so it creates a new
instance of the editor which opens the popup, or (B) it just closes the
item-editor
because the item-editor lost focus

I also tried to capture keystrokes on the Canvas and pass them to the TA,
that didn't work either. But even if it did work, the user still needs the
ability
to use the mouse if they want to.

So is it possible to use a TextArea in a PopUp as an item editor in a
DataGrid?


On Fri, Jul 18, 2008 at 4:42 PM, Alex Harui [EMAIL PROTECTED] wrote:

Well, you could popup a TextArea like PopUpButton does, but it sounds
 like your real goal is to have the TA extend across rows and not be below
 the lines.  I assume you don't want the TA to fit within a single row?



 How will you handle the area at the bottom of the DG?  If I click the last
 row, should the TA extend two rows below the DG?


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Friday, July 18, 2008 11:17 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] TextArea popup editor in DataGrid



 I have a DataGrid where one of the columns is a TextArea control as the
 itemEditor.

 When I edit a cell in the column with the TextArea editor, the TextArea
 opens up to a height equivalent to
 three rows of data in the grid. The editor works fine; in fact it's been
 working this way for some time.

 But recently, we enabled horizontal and vertical grid lines on the grid.
 When the TextArea editor opens up,
 the datagrid horizontal grid lines are drawn across the top of the control.

 I've verified that the TextArea control is not inheriting the styles
 related to grid lines
 I've verified that the TextArea backgroundAlpha is 1; i.e. the text on the
 rows underneath the editor is not
 showing through.

 So as near as I can tell, the grid is drawing the gridlines on top of the
 editor.

 Curiously, I also have a PopUpButton editor type - it does not have grid
 lines drawn across when the dropdown
 area that appears when the button is activated.

 Is this a known issue? Is there a workaround?

 Thanks





Re: [flexcoders] TextArea popup editor in DataGrid

2008-07-19 Thread Glenn Jones
Yes, I don't want the TA to fit within a single Row.

You're right - the case for TA at the bottom of a DG is a problem. Today,
the TA gets clipped,
so that's not good either.

The PopupButton doesn't have either problem.

How does the PopUpButton popup?

On Fri, Jul 18, 2008 at 4:42 PM, Alex Harui [EMAIL PROTECTED] wrote:

Well, you could popup a TextArea like PopUpButton does, but it sounds
 like your real goal is to have the TA extend across rows and not be below
 the lines.  I assume you don't want the TA to fit within a single row?



 How will you handle the area at the bottom of the DG?  If I click the last
 row, should the TA extend two rows below the DG?


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Friday, July 18, 2008 11:17 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] TextArea popup editor in DataGrid



 I have a DataGrid where one of the columns is a TextArea control as the
 itemEditor.

 When I edit a cell in the column with the TextArea editor, the TextArea
 opens up to a height equivalent to
 three rows of data in the grid. The editor works fine; in fact it's been
 working this way for some time.

 But recently, we enabled horizontal and vertical grid lines on the grid.
 When the TextArea editor opens up,
 the datagrid horizontal grid lines are drawn across the top of the control.

 I've verified that the TextArea control is not inheriting the styles
 related to grid lines
 I've verified that the TextArea backgroundAlpha is 1; i.e. the text on the
 rows underneath the editor is not
 showing through.

 So as near as I can tell, the grid is drawing the gridlines on top of the
 editor.

 Curiously, I also have a PopUpButton editor type - it does not have grid
 lines drawn across when the dropdown
 area that appears when the button is activated.

 Is this a known issue? Is there a workaround?

 Thanks





[flexcoders] TextArea popup editor in DataGrid

2008-07-18 Thread Glenn Jones
I have a DataGrid where one of the columns is a TextArea control as the
itemEditor.

When I edit a cell in the column with the TextArea editor, the TextArea
opens up to a height equivalent to
three rows of data in the grid. The editor works fine; in fact it's been
working this way for some time.

But recently, we enabled horizontal and vertical grid lines on the grid.
When the TextArea editor opens up,
the datagrid horizontal grid lines are drawn across the top of the control.

I've verified that the TextArea control is not inheriting the styles related
to grid lines
I've verified that the TextArea backgroundAlpha is 1; i.e. the text on the
rows underneath the editor is not
showing through.

So as near as I can tell, the grid is drawing the gridlines on top of the
editor.

Curiously, I also have a PopUpButton editor type - it does not have grid
lines drawn across when the dropdown
area that appears when the button is activated.

Is this a known issue? Is there a workaround?

Thanks


Re: [flexcoders] problem using checkbox in DataGrid

2008-07-15 Thread Glenn Jones
I'll look into that, but our app has a lot riding on item-edit-end, so
side-stepping item-edit-end
is going to be pretty difficult for me.

I was hoping to find some workaround to make sure that item-edit-begin/end
is always
started.


On Mon, Jul 14, 2008 at 6:20 PM, Alex Harui [EMAIL PROTECTED] wrote:

There are some checkbox examples on my blog (blogs.adobe.com/aharui).



 Look for other examples.  Most folks update the dataprovider when the
 checkbox sends its change event and don't wait for ITEM_EDIT_END


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Monday, July 14, 2008 1:50 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] problem using checkbox in DataGrid



 I'm having a problem using a checkbox as an item editor within a datagrid.
 It might be a bug or maybe I'm doing something wrong.
 Either way, I need to fine some resolution/workaround.

 In my DataGridColumn definition, I'm setting editable=true and
 rendererIsEditor=true for the column with the checkbox. My application
 listens for ITEM_EDIT_BEGINNING, ITEM_EDIT_BEGIN, ITEM_EDIT_END,
 ITEM_FOCUS_IN and onSelectChange events on the grid.

 The majority of times, the checkbox works fine - it displays the proper
 status for the underlying data element and it updates the element
 correctly as well.  The problem occurs, intermittenly, in the following
 scenario

 1. Click on a checkbox in row A
 - the checkbox toggles status on screen and row A is selected

 2. Click on a checkbox in row B
 - the checkbox in row B toggles status on screen, row B is selected, but
 the checkbox in row A toggles back to it's previous state.

 In other words, the checkbox change made in step 1 is lost. This happens on
 irregular basis, but is repeatable at least once
 every 5-10 trials.

 I've found that when the problem occurs, the grid never sends an
 item_edit_beggining/item_edit_begin event in step 1.  Consistent
 with no item-edit-beginning event, there is no item-edit-end event when
 focus changes to row B in step 2.
 Without the item-edit-begining/item-edit-end events, the state of the
 checkbox toggle in step #1 is not reflected back into the underlying data.
 The changing row selection in step 2 has the side-effect of updating the
 display list, at which point, the item renderer in row A redraws itself
 with the underlying data. Since the underlying data was never changed, the
 checkbox in row A flips back to it's original state.

 In the checkbox's click handler, I've confirmed that if the parent grid's
 editedItemPosition attribute is null when the checkbox is clicked,
 then the change in checkbox status will be lost if the grid is redrawn;
 i.e. editedItemPosition == null is consistent with never getting the
 item-edit-beginning event.

 If all of this is clear as mud, thanks for taking the time to read this far
 :-)

 If anyone has some suggestions (or patch ids?) for why the grid may not
 recognize that an item-edit cycle has started when a checkbox
 is selected, please let me know.

 When the checkbox edit works correctly, the sequence of events I see is

 1. Click on a checkbox in row A
   itemEditBegining for row A
   itemEditBegin for row A
   itemFocusIn for checkbox in row A
   checkbox click event for row A
 2. Click on a checkbox in row B.
   itemEditBegin for row A === correct checkbox state written back
 to underlying data
   itemEditBegining for row B
   itemEditBegin for row B
   itemFocusIn for checkbox in row B
   checkbox click event for row B

 Thanks,
 - Glenn

  



[flexcoders] problem using checkbox in DataGrid

2008-07-14 Thread Glenn Jones
I'm having a problem using a checkbox as an item editor within a datagrid.
It might be a bug or maybe I'm doing something wrong.
Either way, I need to fine some resolution/workaround.

In my DataGridColumn definition, I'm setting editable=true and
rendererIsEditor=true for the column with the checkbox. My application
listens for ITEM_EDIT_BEGINNING, ITEM_EDIT_BEGIN, ITEM_EDIT_END,
ITEM_FOCUS_IN and onSelectChange events on the grid.

The majority of times, the checkbox works fine - it displays the proper
status for the underlying data element and it updates the element
correctly as well.  The problem occurs, intermittenly, in the following
scenario

1. Click on a checkbox in row A
- the checkbox toggles status on screen and row A is selected

2. Click on a checkbox in row B
- the checkbox in row B toggles status on screen, row B is selected, but the
checkbox in row A toggles back to it's previous state.

In other words, the checkbox change made in step 1 is lost. This happens on
irregular basis, but is repeatable at least once
every 5-10 trials.

I've found that when the problem occurs, the grid never sends an
item_edit_beggining/item_edit_begin event in step 1.  Consistent
with no item-edit-beginning event, there is no item-edit-end event when
focus changes to row B in step 2.
Without the item-edit-begining/item-edit-end events, the state of the
checkbox toggle in step #1 is not reflected back into the underlying data.
The changing row selection in step 2 has the side-effect of updating the
display list, at which point, the item renderer in row A redraws itself
with the underlying data. Since the underlying data was never changed, the
checkbox in row A flips back to it's original state.

In the checkbox's click handler, I've confirmed that if the parent grid's
editedItemPosition attribute is null when the checkbox is clicked,
then the change in checkbox status will be lost if the grid is redrawn; i.e.
editedItemPosition == null is consistent with never getting the
item-edit-beginning event.

If all of this is clear as mud, thanks for taking the time to read this far
:-)

If anyone has some suggestions (or patch ids?) for why the grid may not
recognize that an item-edit cycle has started when a checkbox
is selected, please let me know.

When the checkbox edit works correctly, the sequence of events I see is

1. Click on a checkbox in row A
  itemEditBegining for row A
  itemEditBegin for row A
  itemFocusIn for checkbox in row A
  checkbox click event for row A
2. Click on a checkbox in row B.
  itemEditBegin for row A === correct checkbox state written back
to underlying data
  itemEditBegining for row B
  itemEditBegin for row B
  itemFocusIn for checkbox in row B
  checkbox click event for row B

Thanks,
- Glenn


[flexcoders] focus out of the flash player

2008-06-20 Thread Glenn Jones
I have a requirement to dismiss a dialog if the flash player loses focus
(e.g. someone clicks outside of the player).
I'm using the Flex 2.0.01 SDK (hotfix 3) with IE 7 and Flash Player 9.

I've registered a FOCUS_OUT event handler on the stage. That seems to work,
but I've run into a case where the event
is ambiguous. I've been keying off of if (event.relatedObject == null)
//then assume the player's lost focus.

The problem is that if my dialog contains a DropDown and the DropDown is
opened, then I'm getting an event that
also has a null value for relatedObject. I don't want to close the dialog if
someone opens a DropDown :-)

I've also tried focus-out handlers on the root and the dialog window objects
(my dialog is subsclass of TitleWindow),
but they have a similar result.

Any suggestions?

Is there another sort of event that will tell me when the Player has lost
focus to the browser or another app?

Thanks,
Glenn


Re: [flexcoders] focus out of the flash player

2008-06-20 Thread Glenn Jones
Much better :-)

The DEACTIVATE had none of the ambiguity of the FOCUS_OUT.

I still had a problem simply closing the dialog when an item-editor was
active - seems like there were events
still queued which would NPE when they fired after the controls had been
deleted. But I worked around
that by using the deactivateHandler to raise a flag that told
focusOutHandler when it was safe to act.

Thanks,
- Glenn

On Fri, Jun 20, 2008 at 1:56 PM, Alex Harui [EMAIL PROTECTED] wrote:

DEACTIVATE event is better


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Glenn Jones
 *Sent:* Friday, June 20, 2008 6:10 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] focus out of the flash player



 I have a requirement to dismiss a dialog if the flash player loses focus
 (e.g. someone clicks outside of the player).
 I'm using the Flex 2.0.01 SDK (hotfix 3) with IE 7 and Flash Player 9.

 I've registered a FOCUS_OUT event handler on the stage. That seems to work,
 but I've run into a case where the event
 is ambiguous. I've been keying off of if (event.relatedObject == null)
 //then assume the player's lost focus.

 The problem is that if my dialog contains a DropDown and the DropDown is
 opened, then I'm getting an event that
 also has a null value for relatedObject. I don't want to close the dialog
 if someone opens a DropDown :-)

 I've also tried focus-out handlers on the root and the dialog window
 objects (my dialog is subsclass of TitleWindow),
 but they have a similar result.

 Any suggestions?

 Is there another sort of event that will tell me when the Player has lost
 focus to the browser or another app?

 Thanks,
 Glenn