Kyri33
Kyri33

Reputation: 599

Issue with Tabs setSwipeActivated.

I have a Tabs container in my form with 2 tabs. The first tab has a list and when a list item is clicked the second tab is scrolled to using setSelectedIndex. At first the tabs are not scrollable. However when the second tab is swiped to. I want the tabs to become scrollable in order to allow the user to go back using the swipe gesture. So I set the swipeActivated to false initially and then when the list item is clicked I try to setSwipeActivated to true and then revalidate the form however this does not activate the swipe gesture when I run the app. Here is my code.

Called as the app is opened:

public void setUpMainPage() {
    mainForm = (Form) u.createContainer(theme, "MainPage");
    Tabs mainTabs = (Tabs) u.findByName("MainTabs", mainForm);
    mainTabs.setAnimateTabSelection(false);
    mainTabs.setSwipeActivated(false);
    findContainer = (Container) u.findByName("GridContainer",     
mainForm);

    setUpFindContainer();
    setUpMibrand();
    setUpVouchers();
    setUpHomePage();

    findTabs = (Tabs) u.findByName("FindTabs", mainForm);
    findTabs.hideTabs();
    findTabs.setSwipeActivated(false);

    insideTabs = (Tabs) u.findByName("InsideTabs", mainForm);
    insideTabs.hideTabs();
    insideTabs.setSwipeActivated(false);

    homeTabs = (Tabs) u.findByName("HomeTabs", mainForm);
    homeTabs.hideTabs();
    homeTabs.setSwipeActivated(false);

    mainForm.show();
}

The ActionListener for the list items:

class findActionListener implements ActionListener {

    String[] categoryList = {"Shopping Malls", "Food & Dining", "Clothing & Accessories", "Grocery Stores",
        "Nightlife & Drinks", "Electronics", "Fitness & Health", "Travel & Hotels",
        "Activities & Events", "Sports Gear", "House & Home", "Baby & Kids", "Beauty & Spa", "Motoring", "Liquor Stores", "More"};

    int index;
    Label categoryLabel;
    public findActionListener(int i, Label catLabel) {
        index = i;
        categoryLabel = catLabel;
    }

    public void actionPerformed(ActionEvent evt) {
        findTabs.setSelectedIndex(1, true);
        //I set the swipe activated to true on click. Before I switch
        //tabs
        findTabs.setSwipeActivated(true);
        categoryLabel.setText(categoryList[index]);
        setUpFindList(categoryList[index]);
        mainForm.revalidate();
    }

}

Is there something I'm doing wrong or is what I want to achieve not possible?

Upvotes: 1

Views: 63

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

Check that swipeActivated is unchecked in the GUI builder UI for the tabs.

Also make sure that any code where you invoke setSwipeActivated true isn't reached.

Upvotes: 0

Related Questions