First issue solved : how to detect that a new tabpane is selected (see
code below). Can anybody suggest how to create dynamically a new
tabpane, instead of displaying a simple alert ?


<canvas>
        
        <!-- Alert to be displayed when the + tab is selected -->
        <alert name="myalert" width="400">
            New tab should be created now
        </alert>
        
        <!-- My own tabs bar class : it calls the onPushed method
                of the tabpane whenever a new one is selected -->
        <class name="mytabsbar" extends="tabsbar">
                <method name="select" args="item" >
                        item.tabpane.onPushed();
                        super.select(item);
                </method>
        </class>
        
        <!-- My own tabs class : it will use mytabsbar instead of the
standard tabsbar -->
        <class name="mytabs" extends="tabs" barclass="mytabsbar" />
        
        <!-- Now we will create the tabs based GUI -->
        <mytabs>
                <tabpane>
                        Tab1
                </tabpane>
                <tabpane>
                        Tab2
                </tabpane>
                <tabpane tabwidth="40">
                        <method name="onPushed">
                                canvas.myalert.open();
                        </method>
                        +
                </tabpane>
        </mytabs>
</canvas>

2009/11/11 Omar Belkhodja <[email protected]>:
> Hi all,
>
> I'm trying to create some tabpane behaviour like the one in firefox :
> the last tab is always a '+' tab. When it is pushed, a new tab is
> created dynamically. I'm trying to catch the event that is sent when
> the tabpane '+' is selected but it doesn't work. Below is a simple
> example that should display an alert, if the tabpane '+' is selected.
> Do you know what is wrong with this ?
>
> <canvas>
>        <alert id="a1">Attention: this is an alert!</alert>
>        <tabs>
>                <tabpane>
>                        Tab1
>                </tabpane>
>                <tabpane id="last" text="+">
>                        <handler name="onselected">
>                                a1.open();
>                        </handler>
>                </tabpane>
>        </tabs>
> </canvas>
>

Reply via email to