You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by gi...@git.apache.org on 2017/10/13 05:38:02 UTC

[GitHub] justinmclean opened a new issue #27: Unable to change DateChooser controller without errors

justinmclean opened a new issue #27: Unable to change DateChooser controller without errors
URL: https://github.com/apache/royale-asjs/issues/27
 
 
   
   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?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services