Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document based example bug: selecting a tab does not implies currrent document change #1

Open
GoogleCodeExporter opened this issue Jun 1, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. create new documents (more than 1)
2. select any tab but not the last one
3. click "close current document"

What is the expected output? What do you see instead?
Current opened tab should disapear.
Instead, the last tab only is removed.

What version of the product are you using? On what operating system?
Document based example

Please provide any additional information below.
Selecting a tab does not implies currrent document change.

Solution:

MainView.mxml, added ...change="..." like this:
<TabNavigator id = "documentsContainer"
        width = "100%"
        height = "100%"
        change="{ model.selectAsCurrentDocument(documentsContainer.selectedIndex)
}"/>

MainModel.as, added the following method:
/**
 * Notifies the application that the user has selected another doc as the
the current document.
 */
public function selectAsCurrentDocument( documentIndex:int ):void
{
    var event:DocumentEvent = new DocumentEvent(DocumentEvent.SELECTED);
    var document:Document = documents[documentIndex];
    currentDocument = document;
    event.reference = document;
    dispatcher.dispatchEvent(event);
}

ApplicationEventMap.mxml, added the foolowing tag:
<EventHandlers type = "{DocumentEvent.SELECTED}">
    <MethodInvoker generator = "{ApplicationManager}"
                   method = "setCurrentDocument"
                   arguments = "{[event.reference]}"/>
</EventHandlers>

DocumentEvent.as, added the following const:
public static const SELECTED:String = "selectedDocument";


Original issue reported on code.google.com by [email protected] on 30 Nov 2009 at 10:35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant