Skip to content

Unable to change DateChooser controller without errors #27

@justinmclean

Description

@justinmclean

Currently you can't change DateChooser controller class in MXML but assuming you could and did this then the Mouse controller gets replaced buy the keyboard controller. This seems to be by design - is this correct?

                <js:DateChooser id="chooser" width="300" click="displayDate()">
                    <js:beads>
                        <js:DateChooserKeyboardController />
                    </js:beads>
                </js:DateChooser>

So to fix it you add both controllers.

                <js:DateChooser id="chooser" width="300" click="displayDate()">
                    <js:beads>
                        <js:DateChooserMouseController />
                        <js:DateChooserKeyboardController />
                    </js:beads>
                </js:DateChooser>

This will die with a RTE in in DateChooserMouseController set strand method as getBeadByType fails to find the view (it's not in the list of beads yet) and returns null.

        var view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView;
	view.prevMonthButton.addEventListener("click", prevMonthClickHandler);
	view.nextMonthButton.addEventListener("click", nextMonthClickHandler);

Perhaps the view could be obtained from value.view which does have the correct value?

This fixes it but seem rather verbose:

                <js:DateChooser id="chooser" width="300" click="displayDate()">
                    <js:view>
                        <beads:DateChooserView />
                    </js:view>
                    <js:beads>
                        <js:DateChooserMouseController />
                        <js:DateChooserKeyboardController />
                    </js:beads>
                </js:DateChooser>

Is it more correct / in line with PAYG to fix the issue in the DateChooserMouseController set strand method? Or should the default view be added to the beads before the set strand method is called?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions