Flex/AIR Mobile: TabbedViewNavigator selectedIndex not working - actionscript-3

I have a Mobile Project in FB 4.6 with a TabbedViewNavigator. I have 4 buttons at the bottom, which are ViewNavigators, and act as the Tabs. For this instance, lets say the tabs are labeled, HOME, ADD, DELETE, and ABOUT. I am running into the following situation:
User presses the ADD tab.
In the ADD screen, user clicks on several links which takes them away from the ADD tab's firstView and to a new view all together. For this instance, let's say the active view is called PlayersView.
User now clicks another tab, for example HOME.
User decides to go back to the ADD tab. However, upon pressing the ADD tab, the user is taken to the last view, which in this case was the PlayersView.
How can I have the functionality changed so that upon pressing a Tab, the user is ALWAYS taken to the firstView property of that tab. As referenced above, this is not happening. I have tried creating an IndexChangeEvent listener on the tabbedNavigator and then changing the tabbedNavigator's selectedIndex, however this doesn't work.
protected function tabbedviewnavigatorapplication1_applicationCompleteHandler(event:FlexEvent):void {
this.tabbedNavigator.addEventListener(IndexChangeEvent.CHANGE,onIndexChange);
}
protected function onIndexChange(event:IndexChangeEvent):void {
this.tabbedNavigator.selectedIndex = event.newIndex;
trace(' THIS DOESN'T WORK');
}
Any help is appreciated. Thanks, in advance.

In your code, when you set
tabbedNavigator.selectedIndex
you switch between different ViewNavigators, not between different Views inside a ViewNavigator.
As I understand it, you are trying to stay within a single ViewNavigator stack and select the first View.
Let's say you have:
<s:navigators>
<s:ViewNavigator id="addSomethingNavigator" firstView="views.AddView"/>
<s:ViewNavigator id="deleteSomethingNavigator" firstView="views.DeleteView"/>
</s:navigators>
You can pop to a specific ViewNavigator's first View like so:
addSomethingNavigator.popToFirstView();

Related

Access 2013 Web App - Why when subview data isn't saved and try to navigate to next record, Access disables controls?

I have a List view (parent), and inside of that I have a sub view that is a blank view which contains some input boxes. I also have Next/Previous buttons in the parent that use GoToRecord to navigate to the next/previous records.
If I enter some data into the subview and try to navigate away using the Next/Previous buttons, I recieve an error asking me to Save, Discard or Edit my inputs in the subview (which is fine). However, if I:
click Save: It goes to the next record (expected) but the controls on the next record do not work
click Discard: Same as above - that is, it goes to the next record but none of the controls work
click Continue Editing: It jumps to the next record and populates the subview with the data from the previous record.
Why am I encountering these issues? Is this a product issue?
Yes, this seems to be a product issue. I believe this is essentially the same type of underlying product issue you identified in your earlier post here:
MS-Access 2013 Web Apps - Why does GoToRecord break when the view contains a subview?
I talked with the product team and they are looking into this. Access seems to be swallowing the custom Action Bar buttons in this scenario with a main and Subview.

Forms calling reports in access

Step1: I open an Access form when the software opens. It acts like a switchboard manager where the user can open other forms and reports. (Popup = yes, modal = no)
Step2: Click to open a "Master Form" which also has other options. (ditto) So the original VB code called this form to be open and is still "running" in the background.
Step 3: Click to open a report based on the record selected.
So now there's 2 forms open and 1 report. User cannot toggle between them, must close one to get to the other (necessary).
On the open report, I would like to modify the rightclick commandbar. However, "Close" doesn't work because Access now shows Form1 and Form2 above as gray and Access is locked. I would like to be able to right-click to do a number of things including Close, Change to Design View, etc. But if I'm locked out like this, none of these will work.
I searched on...
1. Ending the background vba that's running - no luck
2. Setting focus on the active screen name - no luck
3. Setting focus on a control on the Form2 above - no luck
4. Tried all kinds of CommandBar things, no luck (ID choice vs. manual OnAction) and many more
I'd be happy to attach what I'm doing but it's pretty big, although I could probably cut out the sections that this applies too...
I've been searching for about 16 hours now... Anyone???
Thanks so much.
Popup = Yes in Access means two things:
The form or report stays above all other forms and reports that have Popup = No and above Access’ application window.
The form or report is not bound to the area of Access' application window and can be drawn outside of it.
You have two options:
Set Popup = No for the two forms. In this case they will be tied to the application window area.
Set Popup = Yes for the report as well, so that it can stand in front of the two forms.

incompatible type passed in as a parameter created by loading a GUI component.

I am having a problem with a UI that I am building in a Google Spreadsheet. I will First explain a little about how it works and than I will get to the problem. The UI is fairly simple program that connects to a SQL database, it allows users to create new records, Query, search, and render reports. I have created all the panels (eg the intro page, the create record) in the GUI builder. As the user navigates through the UI I swap out a Grid with the new panel that i want the user to see. For example on the intro page there is a create button when the user clicks the button the gird where there intro panel was is replaced by the create record panel. I have created two ways for the user query/search for data. The first way is to select a number range on the intro panel and click the Query button. This will than query the last 10 or so records into a GUI built Panel that I will call MainForm. The second way is to "search" for a job. On the intro page there is a search button when the user clicks with button it goes to a new page; the grid is switched to the search panel. On the new page/panel the user can put in some parameters to search for. After the user clicks the search button the program should load the search results into the MainForm in the same way as when you Query from the intro page. I have taken the whole function apart line by line, so i am sure that the issue has to do with loading the panel/Component. What i mean by that is these few lines of code.
var Component = app.loadComponent("MainForm");
var panel = app.createVerticalPanel().setSize("770px", "900px").add(Component);
app.getElementById("contentGrid").setWidget(0,0, panel);
But why would it load in one case, but not in another? Also it is not the method of loading the Component, rather it is the returning the panel/ Component.
To Summarize, When I load the Component with the query function it works, but when i load the Component in the search function I get and error: Incompatible type passed in as a parameter. Also I load the MainForm Component in two other functions as and it works most of the time, but some times I get the same error.
I think your approach is not ideal, load component is not supposed to be called multiple times. It would be far more efficient to get all your panels in the same compnent and play with visibility of each panel to show / hide them on demand. Each panel should be inserted in a vertical panel so that the "new panel" slips to its place when the "old one" hides.
An example of this approach is shown in this post to simulate tabs and could easily be adapted to your needs.
btw, this method is also very fast and responsive since the full UI is ready from the very beginning ;-)

Flex TextInput with default mobile skins automatically regains focus on callout close

I'm working on a simple auto complete function for my Flex mobile app. For that I've got a CalloutButton that triggers a Callout.
The Callout holds some lists from which the user can select items. On item select, the callout gets closed (calloutButton.closeDropDown()).
The very same behavior is done for a TextInput. The user inputs text, the callout opens and according to the entered text, the lists change. Works fine so far. Now, when the user selects an item from any of the lists, the callout closes. Also fine.
Now the issue, after the callout is closed, the TextInput automatically regains focus.
On a mobile device this is more than disturbing.
I narrowed this behavior down to the mobile TextInput skin (spark.skins.mobile.TextInputSkin) since a TextInput without this skin class doesn't show this behavior.
Now you might say just use the default skin instead but unfortunately I can't. The default skin has a bug with Android devices that doesn't pass though the enter event. That I could live with since I'n not necessarily dependent on the enter event, however, the spark mobile skin allows be to continue entering text in the TextInput even after the callout has been opened, which is desperately needed as the lists change according to the entered text.
I can't provide any code as the problem has been narrowed down to the skinClass, thus should not be in my own code. Believe me, I tried every nice and not so nice method to prevent the TextInput from getting focus again, but nothing worked.
So, totally stuck here!
Hopefully you guys have some ideas on how to solve this.
Edit:
Below the steps of my application's behaviour. (to be fair, the workflow inside the callout is a little more complex, I'm working with several lists and a SplitViewNavigator here (thus can't use the Flextras autocomplete), but that doesn't affect the TextInput focus issue I'm facing).
Enter text in TextInput
On key change a Callout with two Lists is opened.
The first List receives results according to the entered text from a webservice
User selects item from list
Second list receives results according to selection from first list from webservice
User selects item on second list
Callout closes
This all works fine, except that the TextInput receives focus after the Callout closes.
I really don't know what triggers this behavior.
Edit2: Code to further illustrate the issue.
Naturally, this is stripped down to the very basics, but it mirrors the behavior of the component and focus.
First the CalloutButton and TextInput that can both control the Callout:
<ui:SearchCallout id="detailSearch"/>
<s:TextInput id="searchInput" skinClass="spark.skins.mobile.TextInputSkin"
enter="historySearch(searchInput.text)"
focusOut="searchFocusOutEvent(event)"
focusIn="searchFocusInEvent(event)"/>
The TextInput's focus handlers don't do anything related to the callout, they just set current states of another component, so I'll leave them out here.
Function historySearch closes the CallOut (I forced it to close as it wouldn't close with the usual closeDropDown()), formats the search text, handles a searchHistory and eventually triggers the search function that passes the formatted search text to the selected component.
Here are the parts that matter for this case:
private function historySearch(val:String):void {
detailSearch.forceClose=true;
detailSearch.closeDropDown();
searchEvent(_searchSyms, true);
}
Note: 'val' (the TextInput's text) is trimmed and whatnot, eventually it will result in an array of strings, represented by '_searchSyms'.
Further eventListeners are as follows:
searchInput.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEvent);
searchInput.addEventListener(FlexEvent.VALUE_COMMIT, onKeyEvent);
searchInput.addEventListener(TextOperationEvent.CHANGE, onTextChange);
KEY_DOWN and VALUE_COMMIT don't have anything to do with the Callout, they are used to handle stuff for the searchHistory, hence I'll leave the onKeyEvent function out here.
onTextChange triggers the string search on the server and closes the Callout in case the TextInput's text is an empty string:
private function onTextChange(event:Event):void {
if(searchInput.text=="") {
if(detailSearch.isDropDownOpen) {
(detailSearch.rightView.activeView as RightView).clearDetailList();
detailSearch.isCloseable=true;
}
}
_searchManager.getRicsByChar(searchInput.text);
}
Eventually the server will respond and passes an array of responses. The Callout gets opened and it's lists are filled with the responses.
I won't paste all the Callout content's code here as it would be way too much. Basically, the user selects an item from any of the lists, the Callout is forced to close and the search function that passes the value to the component (not yet pasted here, be patient ;), is given the item's value. That basically looks like this (never mind the FlexGlobals stuff, this gets all refactored once the focus issue has been resolved):
var search:String = String(event.currentTarget.selectedItem);
FlexGlobals.topLevelApplication.detailSearch.forceClose=true;
FlexGlobals.topLevelApplication.detailSearch.closeDropDown();
FlexGlobals.topLevelApplication.searchEvent(new Array(search), true);
Allright, now the final step of the whole functionality, the searchEvent. As already said, this function basically only passes the formatted search value to the selected component. This either happened on 'Enter' of the TextInput (as the code above shows), or on selection of an item from one of the Callout's lists.
public function searchEvent(_searchSymbols:Array, setText:Boolean):void {
if(setText) {
var _searchString:String="";
for each (var _sym:String in _searchSymbols) {
_searchString += _sym + ", ";
}
searchInput.text = _searchString.substring(0, _searchString.length-2);
}
stage.focus=null;
if(selectedWindowContainer) {
// set the array of search items to the selected component here
selectedWindowContainer.setFocus();
} else
trace("[MAIN] no component selected");
}
And that is basically it. This function is the last step of my search routine, and the selected component (that will get the search items), is getting the focus.
Yet, it automatically loses focus again and the TextInput will receive it. I have no idea where and why this happens, and I need to get rid of this behavior asap!
Wow, what a post, anyone still reading this? ;) Well, I hope so.
Well, after hours of testing several ways to prevent the TextInput from automatically gaining focus, I (kinda) solved the issue, although I think it's more a dirty hack than anything else.
Setting the TextInput's focusEnabled to false works fine, even though the focus indication (border around the TextInput) won't work with this any more (an issue I can live with for now).
Still, I'd really like to know what exactly is going on here, especially in the mobile skin class.

TabView with ACtionBar

I am using tabview in my application, in which Home is default tab selected
I add three Buttons over this activity.I want that when i click on List button of MapView Activity, this
MapPinsListView Activity will start on the same frame over MapView & rest view will remains same i.e., all tabs will works as they intended to work. However, i am facing a problem while using it, When i click on list, intent will start new activity & hole view get replaced by its activiy view, whereas i want only the frame view will change by the view of called intent & when click on Map button of MapPinsListView, MapView will start. How should i proceed.
Would appreciate your help a lot!
Thanks
after having a long R&D i got the best way to do this is
1.code TabGroupActivity which extends ActivityGroup.The purpose of this Activity is to manage the activities in a tab. Note that Child Activities can handle Key Presses before they are seen here.
2.code different classes (e.g., TabGroupHome, TabGroupFavourite, TabGroupMassage & so on...) & extends TabGroupActivity.
3.finally code TabActivity which extends TabActivity & then add these TabGroupActivities(TabGroupHome, Favourite, Massage, Profile, Settings) ovew there respactive tabSpace.
finally, after completing these all different activities get managed over the same fram!
http://ericharlow.blogspot.com/2010/09/experience-multiple-android-activities.html