Derrell Lipman wrote:
> On Fri, Nov 21, 2008 at 2:29 PM, Kenny Tilton <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     I have one search input field and several search initiation buttons,
>     each triggering a different kind of search. Normally I would have the
>     button handler find the search input field by name and get its value and
>     send that to the server. But I just spent over an hour scanning the doc
>     and cannot find anything close, or even how I would give a widget a
>     name. In HTML this is getElementById, of course, working with the ID
>     attribute.
> 
>     Another way for me to go would be to have the containing chunk of the
>     framework have an element "searchValue" and then have both the search
>     input field and buttons (a) look for the designated ascendant by type
>     (say, "SearchPanel") and then take the searchValue element from that.
>     But then I am not sure how to do that either. In other threads I learned
>     I should use getLayoutParent to navigate up the hierarchy, but neither
>     did I see a way to test an object's class.
> 
>     I will be diving into the source code, but hints are welcome.
> 
> 
> If you'll be using the same listener callback for each of the buttons, 
> you can either read the button's label in your listener, or add a user 
> data tag to each of the buttons so you can determine which button was 
> pressed.
> 
> // warning: untested code follows...
> 
> var b1 = new qx.ui.form.Button("Basic");
> b1.setUserData("search_type", "basic");
> b1.addListener("execute", this._search, b1);
> 
> var b2 = new qx.ui.form.Button("Regular Expression");
> b2.setUserData("search_type", "regexp");
> b2.addListener("execute", this._search, b2);
> 
> _search : function(e)
> {
>   this.debug("Label is " + this.getLabel());
>   this.debug("Search type is " + this.getUserData("search_type");
> }
> 

Thx, Derrell. My plan was to pass along the "regexp" in a closure (sort of):

       b2.addListener("execute"
          , function (e) { this._search(e,"regexp");}
          , b2);

What I need is a way to get at the input text field (or find a common 
parent with the element searchString, which would be cleaner).

Hmmm, I found getClass, I'll play with that. I also found getWidgetById 
but not many places -- it looks like maybe I would have to set up a 
registry for that?

cheers,

kennt




-- 
http://www.theoryyalgebra.com/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to