TabNavigator: Adding Tab Dynamic

Hi,
I would like to create an application that is using a
TabNavigator to show different information (tabs) when user press
different buttons. I create a button and call a function to add a
tab into tabnavigator to show a custom control (base on Panel). I
try it and the program can add the tab and show the correct
information. But I don't know how to add the label on the created
tab. Also, can it be any simple method to check it the information
is shown already in tabnavigator?
The function is listed below:
private function addUserRequest():void {
var ur:DisplayObject = tabControl.addChild(new userRequest);
var tabNdx:int; // Tab Index
tabNdx = tabControl.getChildIndex(ur);
tabControl.selectedIndex = tabControl.getChildIndex(ur);
return;
//end of function
Thanks a lot!
Wilson

If
UserRequest is a custom component which extends
Panel, the label of the panel will be used as the label of
the tab when it's added to the
TabNavigator.
In order to do this you'll need to define
ur as a compatible type which has a label property, i.e. as
a
Panel or as a
UserRequest (or whatever it's called):
var ur:Panel = new UserRequest(); // UserRequest is subclass
of Panel so compatible.
ur.label = "A Label"; // I can set this because I am a panel
tabControl.addChild(ur);
I'm not sure I understand your last question. Do you want to
know if the tab with that label already exists?

Similar Messages

  • Adding tabs dynamically at runtime for a tab navigator control

    Hi,
    Is it possible in flex builder 2 to dynamically add the tabs
    at runtime to the tab navigator control, if we can add plz tell the
    procedure to do that
    thanks in advance

    Given that you had a tab navigator declared in mxml like
    this:
    <mx:TabNavigator id="myTabber" selectedIndex="0">
    </mx:TabNavigator>
    you should just be able to call the addChild method, passing
    the child tab containers. So for example, in some ActionScript
    event handler:
    var newTab:Canvas = new Canvas();
    myTabber.addChild(newTab);
    bear in mind I haven't done this by adding tabs, but have
    done tons with adding controls to an application at runtime using
    this method (DataGrids, Grid, GridItems, etc...)
    Jason

  • Af:showOneTab : adding tabs dynamically

    Morning,
    I'm trying to add tabs to my af:showOneTab dynamically.
    So I added a HashMap in my backing bean and I created CoreShowDetailItem items that i add into my Map.
    Then on my jspx page I'm trying a af:forEach like this :
    <af:showOneTab position="above">
    <af:forEach var="tab" items="#{tabsBean.tabs}">
    <af:showDetailItem text="#{tab.text}"/>
    </af:forEach>
    </af:showOneTab>
    But JDeveloper says me that forEach can't be the parent tag of CoreShowDetailItem.
    Is there another solution to perform what I'm trying to do?
    Thanks in advance for your help!

    Hi,
    in fact this is the case and the visual designer would have told you so (and the source code editor should give wranings, so I don't know if it does).
    Here's a code from a managed bean that does it instead
    public class ShowDetailBean {
        private CoreShowOneTab tabs;
        public ShowDetailBean() {
        public void setTabs(CoreShowOneTab tabs) {
            this.tabs = tabs;
        public CoreShowOneTab getTabs() {
            return tabs;
        public String commandButton_action() {
            CoreShowDetailItem csd = new CoreShowDetailItem();
            csd.setText("Hello");
            tabs.getChildren().add(csd);
            return null;
    }In this example I built a Binding reference from teh ShowOneTab component to the managed bean. On button press a new tab is created
    Frank

  • TabNavigator's tab dynamic visibility handling problem.

    Hello All,
    I am facing problem in TabNavigator component.
    My application has one tabnavigator with 4 tabs. (T1,T2,T3,T4)
    Tabs visibility is depend on data which are load in those tabs.
    If data is getting Null from database for T2, T2 tab will not displayed. Only other 3 are displayed.
    I have tried this....
    myTabNavigator.getTabAt(myTabNavigator.getChildIndex(myT2tab)).visible = false;
    myTabNavigator.getTabAt(myTabNavigator.getChildIndex(myT2tab)).includeInLayout = false;
    but problem is if once tab is hide by above code, will not visible again by setting visibile & includeInLayout property to true.
    Anyone else noticed this, have any suggestions?
    Thank you.

    Hi Tejas S Patel,
    I dont see any such kind of problem...I have run a test...it works perfectly fine.
    Below is the sample test I have done..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:TabNavigator width="103" id="tabone">
      <mx:Canvas label="First Canvas" width="100%" height="100%">
       <mx:Label text="First Canvas"/>
      </mx:Canvas>
      <mx:Canvas label="Second Canvas" width="100%" height="100%">
       <mx:Label text="Second Canvas"/>
      </mx:Canvas>
      <mx:Canvas label="Third Canvas" width="100%" height="100%">
       <mx:Label text="Third Canvas"/>
      </mx:Canvas>
    </mx:TabNavigator>
    <mx:HBox top="100">
      <mx:Button id="btn1" label="HIDE SECOND TAB" click="tabone.getTabAt(1).visible=false;tabone.getTabAt(1).includeInLayout=false;"/>
      <mx:Button id="btn2" label="SHOW SECOND TAB" click="tabone.getTabAt(1).visible=true;tabone.getTabAt(1).includeInLayout=true;"/>
    </mx:HBox>
    </mx:Application>
    Thanks,
    Bhasker Chari

  • Flex 3 TabNavigator getting tab name when tab clicked

    Hi All, I am using Flex 3.
    I have <mx:TabNavigator  id="dbtabs" width="100%" height="100%" click="changeTabs()"  />
    I am also adding tabs dynamically. 
    In the grand scheme of things, I want to let a user add tabs as needed and chose what content is on the tab.  This is saved data, so when they come back I need to reload their saved settings.
    What I am trying to do is find out how to get the index of the tab when it is clicked. Right now I have to click the tab then click in the vbox to get the selectedIndex.  Is there a way to get the selectedIndex as soon as the tab is clicked?
    Thanks.

    private function handleTabClick(evt:IndexChangedEvent):void
           var i:int = evt.newIndex;
    <mx:TabNavigator change="handleTabClick(event)">
            <mx:Canvas width="200" height="200" label="Tab 1"/>
            <mx:Canvas width="200" height="200" label="Tab 2"/>
    </mx:TabNavigator>
    Dany

  • Adding and removing tabs dynamically as in explorer

    adding and removing tabs dynamically as in explorer or firefox

    Think about how many translations are required to move your avatar, then think how many translations are required to move everything else in the entire world. Depending on whether there is more to translate in your avatar or in the rest of the world, you have your solution.
    Not knowing how your system works I can't really suggest anything further but could the collision avoidance be interacting with everything in the world as well? That would increase the workload somewhat.

  • Adding tab in tabstrip control dynamically..........

    Hi ,
        I am using TabStrip control of PDK .NET. I want to add tab dynamically in tabstrip control.
    But I am getting error for any postback when I switch in between tabs.
    Error description is :
    <b>"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"</b>
    <b>Stack Trace:
    [ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index]
       System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) +2382545
       SAP.Web.UI.Controls.TabCollection.get_Item(Int32 index) +6
       SAP.Web.UI.Controls.TabStrip.LoadPostData(String sPostData, NameValueCollection oPostCollection) +92
       System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +674
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2965</b>
    Any help appreciated?
    Regards,
    Prashant

    Hi Prashant,,
    your index is less than zero, the postback will not store it unless you explicitly save it using 'enable view state' for the tree control, if it is already enabled and still not working: here is the work around :-
    you can store it in a hidden input field, so that it can be retrived when you do a postback, and then reassign the current index
    it should be a relatively simple fix
    please let me know how you get along...
    with respect,
    amit

  • TabNavigator ALL tabs unselected

    I am having a problem with the tab navigator. When I clear it
    and repopulated it programmatically, it shows all of the tabs as
    unselected even though it is showing the contexts of the 1st tab.
    I've mocked up a sample that reproduces the issue (see
    below). Open the page and click the Rebuild button. Notice that
    both tabs are showing as unselected. Also note that clicking sel1st
    which sets the selectedIndex to 0 on the tab navigator has no
    effect. It is interesting to note that clicking selLast does work
    and once that is done sel1st also works.
    The problem appears to be caused by removing all of the
    children and the later (after the navigator has redrawn?) adding
    tabs.
    Has anyone seen this problem? Am I missing something?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.containers.Canvas;
    private var num:int = 0;
    private function rebuildTN():void{
    tn.removeAllChildren();
    callLater(addChildren);
    private function addChildren():void{
    var child:Canvas;
    for(var i:int = 0; i < 2; i++){
    child = new Canvas();
    child.label = num.toString();
    num++;
    tn.addChild(child);
    ]]>
    </mx:Script>
    <mx:TabNavigator id="tn" x="88" y="48" width="377"
    height="255">
    <mx:Canvas label="Tab 1" width="100%" height="100%">
    </mx:Canvas>
    </mx:TabNavigator>
    <mx:Button x="253" y="320" label="Rebuild"
    click="rebuildTN();"/>
    <mx:Button x="216" y="350" label="sel1st"
    click="tn.selectedIndex=0;"/>
    <mx:Button x="284" y="350" label="selLast"
    click="tn.selectedIndex=tn.numChildren-1"/>
    </mx:Application>

    How do you close those tabs?
    Firefox 4 and later versions save the previous session automatically, so there is no longer need for the dialog asking if you want to save the current session.<br />
    Use "File > Exit" or "Firefox > Exit" (Mac: "Firefox > Quit Firefox") if you want to restore multiple windows.<br />
    You can use "History > Restore Previous Session" to get the previous session at any time.<br />
    You may need to click the orange/gray Firefox button to see History.<br />
    There is also a "Restore Previous Session" button on the default <b>about:home</b> Home page.<br />

  • Hiding a Tab Dynamically in FPM

    Hi,
    Can you please let me know how to hide the tab dynamically in FPM. I tried to implement the interface IF_FPM_TABBED_CONF_EXIT in the SAP standard webdynpro, but I get a error " Web Dynpro comp./intf. "IF_FPM_TABBED_CONF_EXIT already exists". Even though I get this message I am not able to find the interface IF_FPM_TABBED_CONF_EXIT in the implemented list of interface.
    Regards,
    Arun

    Hi Aliaksandr,
    Thanks for the reply.
    Actually I am not able to implement the interface controller  IF_FPM_TABBED_CONF_EXIT in the SAP standard webdynpro, I get an error " Web Dynpro comp./intf. "IF_FPM_TABBED_CONF_EXIT already exists".
    Even though I get this message I am not able to find the interface IF_FPM_TABBED_CONF_EXIT in the implemented list of interface.
    Regards,
    Arun

  • Adding column dynamically

    Hi all
    I have a requirement of adding the columns to a Classic Table at run time.. the number of columns are not fixed. the number of The data in there columns will be dispaled from the view initialized at run time.
    I tried searching out threads on adding column dynamically but didtn get one..
    pls help me out ..
    naveen

    Of course you can add columns dynamically, but this always needs to be from the same VO, a OA table cannot be based on more than one VO.
    So if it all the columns are from the same VO, why take the pain of adding and removing columns, why not just either render it or hide it.
    Thanks
    Tapash

  • WHY IS THE JUST ADDED TAB STILL NOT ON iTUNES!!???

         Okay so alot of people including myself are wondering why the just added tab in itunes keeps disappearing. I don't understand it because that is where I find most of my music that are new and coming in for that week. I don't understand why they simply just can't put it back on there and let people use it! It's bad enough that we have to pay 1.29 per song when I remember it being that I could have gotten 15 songs worth 15 dollars at .99 cents per song. Nowadays I can get like 11 or 12!!!! YOU GUYS NEED TO SERIOUSLY FIX IT!!!!!!!!!!!!!

    yes it is working for the majority there are a small number of customers who are having problems
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Adding Tab page in to  Item Master Data

    Dear,
    In this momento I can do application external through SDK to SBO. but How can I do adding Tab Tag Page in to Item Master Data,
    Can you explain me How I do?
    Very thanks.
    Regards

    Hi!
    You need add one tabPage in Item Form rigth?
    You can used the function:
    public void AddTab(string formID, string tabName, string tabNum, string tabCaption)
                try
                    Form oForm = oApp.Forms.GetForm(formID, 0);
                        Item oItPosition = oForm.Items.Item(tabNum);
                        Item oItTbTest = oForm.Items.Add(tabName, BoFormItemTypes.it_FOLDER);
                        oItTbTest.Top = oItPosition.Top;
                        oItTbTest.Height = oItPosition.Height;
                        oItTbTest.Width = oItPosition.Width;
                        oItTbTest.Left = (oItPosition.Left + oItPosition.Width) + 20;
                        oItTbTest.AffectsFormMode = true;
                        Folder oTbTest = (Folder)oItTbTest.Specific;
                        oTbTest.Caption = tabCaption;
                        oTbTest.ValOff = "0";
                        oTbTest.ValOn = "1";
                        oTbTest.GroupWith(tabNum);
                catch (Exception e)
                    oApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Medium, BoStatusBarMessageType.smt_Error);

  • JTabbedPane - not selecting newly added tabs

    Is there a way to make it so that newly added tabs in a JTabbedPane are not automatically selected as they are added?
    Thanks,
    Adam

    I don't understand what you mean! It's just the normal behavior addTab and insertTab have! So what do you mean? insertTab remembers the currently selected tab and after adding the new tab tries selecting that one again. Maybe you select the new component after adding it.
    --Rasta                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Removal and adding tabs in user interface

    Hi,can anybody provide me solution for customizing the user interface page menu tabs in SUN Identity Manager.
    My requirement is,i need to remove and add main menu and sub menus in the user interface page in SUN Identity Manager.
    Thanks in advance.
    Edited by: SUNIDMDEV on Feb 21, 2008 10:52 PM

    Hello,
    Article Master and Material Master are one and the same in context (materials are referred as Articles in SAP IS Retail). Please refer the below link for creating the custom fields/adding tab pages
    adding custom tab in material master transaction
    Hope this helps
    Regards
    Shiva

  • Adding tabs at the header

    Hi Experts,
    I have added some tabs at the header  for Order,Order from Template and Order Template. Problem I am facing is when I am clicking on those tabs it is working fine everywhere except when I am in catalog page.
    Has anybody faced the similar issue. Please advice on this.
    Thanks in anticipation.
    Regards
    Harshmeet Singh

    Hi,
    I have added tabs for Order,Order from template and OrderTemplate in header.jsp which are in the form of links in welcome.jsp. I am not able to go back to any of the pages from catalog page. It is giving an error at the bottom of the page saying location is null or not an object.But the same links are working if I am in any other part of the web shop.
    @Arshi
    Thanks for your input. Will work on it and will let you know if I still face any issues.

Maybe you are looking for

  • Notifications not working at times- is there a ...

    OSX 10.10.2 with  Version 7.2 (412) Bounce Nofiications  do not work for new messages at times ---- This means  that the   skype icon  is not  bouncing when I come back to  mac. Does it have a time out period ? 1. when   I  tested  it,  going to anot

  • IChat over Bounjour doesn't work

    Whenever I sign in Bonjour on my computer, I am able to see the other Mac in my network also. However, IM messages do not get through and audio/video chat doesn't seem to work either. Any idea what's wrong?

  • Content Server Explorer is not available after sucessful installation of Plumtree Portal

    Content Server Explorer is not available after sucessful installation of Plumtree Portal. Please reply us.

  • Ibook doesn't see printer

    I have an ibook G4 and it has been printing by connecting wirelessly through airport to my imac that has an HP5500 printer connected to the imac. For an unknown reason, it suddenly doesn't list that printer. I can still print if I carry the ibook to

  • Decipher my crash log

    Thu Jul 31 00:16:54 2014 panic(cpu 1 caller 0xffffff800cedc24e): Kernel trap at 0x00007fff0ced693b, type 13=general protection, registers: CR0: 0x000000008001003b, CR2: 0x000000013062b000, CR3: 0x00000000356c1026, CR4: 0x00000000001606e0 RAX: 0xfffff