I would have bet that there was a method to see if an object has focus, but
like you I couldn't find one. So doing what you suggest and create two event
handlers for when the table gets/losses focus and setting a variable might
work fine. At least that is the way I would do it if I was solving this
problem. There is an event for activate/deactivate that you might look into
if focus/blur don't work perfect. And you might want to add a slight delay
in your test code because the slight amount of time it takes to move the
activation from one control to another might be enough for your code to fail
if it executes too quickly.
Jim


On Fri, Mar 13, 2009 at 11:13 AM, Gene Amtower <[email protected]> wrote:

>  On Fri, 2009-03-13 at 09:28 -0700, Jim Hunter wrote:
>
> Inside the routine where you are hiding the table, make one additional
> check to see if the table has focus, and if it does not, then hide it. Then
> on the table object, when it losses focus you can hide it then. Something
> that I have done similar to your scenario, is that I pop up a window that I
> want to be displayed until something outside the window is clicked, and to
> handle this I added a click listener to the main page, and every time it is
> clicked it looks to see if my pop up is visible. If it is, it simply hides
> it. If not it does nothing.
>
>
> Jim
>
>
> Thanks, Jim.  I considered that but didn't know if I was missing something
> in my use of the Qooxdoo widgets.  How do you recommend testing for the
> focus on the table?
>
> I can't find a property for the focus state in Javascript, but I found
> something on the web about adding a custom variable to record the focus
> state of an object when it receives focus (using the focus event on that
> object).  Is there a better way using a Qooxdoo property that is
> automatically set with the focus state?  If there is, I can't find it in
> Qooxdoo either.
>
> Thanks,
>
>    Gene
>
>  On Fri, Mar 13, 2009 at 9:04 AM, Gene Amtower <[email protected]> wrote:
>
> Hello all,
>
> I'm creating popup table objects using Table.model.Simple, linked to user
> entry in a corresponding text field.  Eventually, the textfield values are
> going to cause the tables to get populated with appropriate data as the user
> types, but for now I'm just trying to get them to display and hide
> appropriately.  I'm incorporating these widgets into my page using the
> "Inline" method and corresponding DIV containers.
>
> The table is displayed correctly whenever I type in the textfield (using
> the "input" event), but it remains visible when I remove focus from the
> textfield.
>
> In the demobrowser example for popups, it uses Atom objects displayed
> through a button click event, and the popup objects disappear when the focus
> is removed from BOTH the button and the popup, but not before.  I've
> examined the js code in this demo, and I don't see anything special there to
> control the auto-hide of the popup.
>
> I finally added a "focusout" event listener on the textfield to hide the
> popup, and it works fine unless I want to click on something in the popup
> table.  In this case, the click in the table object is interpreted as a loss
> of focus on the textfield and the table closes.  I think this is because
> it's not a child of the textfield even though it's displayed by the
> textfield event.  I don't think I can add the popup table as a child of the
> textfield to prevent this because it is already added to the popup object.
> It would not make sense to "add" an object to two different containers,
> right?
>
> How do I get the tables to close whenever I click outside of the textfield
> or table, but remain as long as I'm "focused" on one of these two objects.
>
> Here's the popup code I'm using:
>
>       // Create popup order table
>       var ordertableModel = new qx.ui.table.model.Simple();
>       ordertableModel.setColumns([ "Order", "Customer", "Date" ]);
>       var ordertable = new qx.ui.table.Table(ordertableModel);
>       ordertable.set({width: 400, height: 400, decorator: null});
>
>       // Now create the popup container for ordernumbertable
>       var onpopup = new qx.ui.popup.Popup(new qx.ui.layout.Basic());
>       onpopup.add(ordertable);
>
>       // Add a popup listener
>       orderno.addListener("input", function(e) {
>         onpopup.placeToWidget(orderno, true);
>         onpopup.show();
>       }, this);
>
>       // Add a popup listener
>       orderno.addListener("focusout", function(e) {
>         onpopup.hide();
>       });
>
> BTW, I've added two different textfield/table pairs in my page, and when I
> click on the second textfield, the popup table from the first textfield
> remains visible, even when the popup table from the second textfield is
> displayed, but if I click within the second popup table, THEN the first
> popup table goes away.
>
> Am I missing something basic in the popup object settings?  Is this because
> I'm using the Inline method instead of an application method?  Or is
> something not working as it should?
>
> Thanks,
>
>   Gene Amtower
>   PC Backup
>
>
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to