Hi Robust,

Yesterday robust wrote:

>
> Hi there,
>
> In my test page....When the user moves his mouse over different widgets, I
> want to attach different text's related to the respective widget beside a
> label.
>
> For example: Consider my test page has two widgets say, a button and
> checkBox and at the bottom of the page there will be a label called "you are
> pointing to:"
>
> So, when the user mouseover the "button", I want to display "button" beside
> the label...So it shouls look like this
>
> you are pointing to:button
> similarly,
> when the user mouseOvers on the checkBox, I want to display something like
> this
>
> you are pointing to:CheckBox

I would subscribe the label to a 'status' message bus. Then
create your own button subclass which listens to mouseover events
and sends messages to the 'status' bus.

I used this aproach for an error popup:

/* ************************************************************************
#asset(qx/icon/Tango/32/status/dialog-error.png)
#asset(qx/icon/Oxygen/32/status/dialog-error.png)
#asset(qx/icon/Tango/16/actions/dialog-ok.png)
#asset(qx/icon/Oxygen/16/actions/dialog-ok.png)
************************************************************************
*/

qx.Class.define("demo.Error",
{
    extend : qx.ui.window.Window,

    construct: function(){
        this.base(arguments);
        // the blocker* properties should cause
        // the rest of the browsserwindow to grey
        // out while the error is displayed.
        // it does not work at the moment (2008-10-14)
        // though
        this.set({
            modal: true,
            showMinimize: false,
            showMaximize: false,
            resizable: false,
            contentPadding: 20,
            blockerColor: '#888888',
            blockerOpacity: 0.5
        });
        this.setLayout(new qx.ui.layout.VBox(10));
        var error = new qx.ui.basic.Atom(null,
        "icon/32/status/dialog-error.png");
        error.setRich(true);
        error.setGap(10);
        this.add(error);

        var box = new qx.ui.container.Composite;
        box.setLayout(new qx.ui.layout.HBox(5, "right"));
        this.add(box);

        var btn = new qx.ui.form.Button("OK", "icon/16/actions/dialog-ok.png");
        var that = this;
        btn.addListener("execute", function(e) {
            that.close();
        });
        box.add(btn);
        qx.event.message.Bus.subscribe('error', function(m){
            var data = m.getData();
            that.setCaption(data[0]);
            error.setLabel(data[1]);
            that.center();
            that.open();
        });
    }
});

In the Application.js I do:

var error_win = new demo.Error();

and then whenever there is a error condition in the rest of  the code, it
does:

 qx.event.message.Bus.dispatch('error', [
                    that.tr("Error"),
                    that.tr("You made a BAD BAD mistake.")
                 ]);


cheers
tobi

ps. gurus ? is this a good thing ?

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [EMAIL PROTECTED] ++41 62 775 9902 / sb: -9900

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to