[ https://issues.apache.org/jira/browse/FLEX-24257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13686666#comment-13686666 ]
Maurice Amsellem edited comment on FLEX-24257 at 6/18/13 12:59 PM: ------------------------------------------------------------------- Trying the fix on my side: Since I don't know how (& don't have time) to download and compile the develop branch, I subclassed DateField and overridden measure() with the fixed code (see code below). Unfortunately, the scrolling still occurs on my environment. Note: maxWidth is set to 62 at the end of the loop, and bigDate width was also 62 pixels prior to the fix. What do you think ? {code} package controls { import mx.controls.DateField; import mx.core.mx_internal; use namespace mx_internal; public class DateFieldExt extends DateField { public function DateFieldExt() { } override protected function measure():void { // skip base class, we do our own calculation here // super.measure(); var buttonWidth:Number = downArrowButton.getExplicitOrMeasuredWidth(); var buttonHeight:Number = downArrowButton.getExplicitOrMeasuredHeight(); // copied from sdk develop branch var bigDate:Date; var txt:String; var textWidth:Number; var maxWidth:Number = 0; // Width may vary based on date format for (var month:int = 0; month < 12; month++) { bigDate = new Date(2000, month, 28); // day 28 exist in all months txt = (labelFunction != null) ? labelFunction(bigDate) : dateToString(bigDate, formatString); textWidth = measureText(txt).width; if (textWidth > maxWidth) { maxWidth = textWidth; } } measuredMinWidth = measuredWidth = maxWidth + 8 + 2 + buttonWidth; measuredMinWidth = measuredWidth += getStyle("paddingLeft") + getStyle("paddingRight"); measuredMinHeight = measuredHeight = textInput.getExplicitOrMeasuredHeight(); } {code} was (Author: mamsellem): Double-testing the fix: Since I don't know how (& don't have time) to download and compile the develop branch, I subclassed DateField and overridden measure() with the fixed code (see code below). Unfortunately, the scrolling still occurs on my environment. Note: maxWidth is set to 62 at the end of the loop, and bigDate width was also 62 pixels prior to the fix. What do you think ? {code} package controls { import mx.controls.DateField; import mx.core.mx_internal; use namespace mx_internal; public class DateFieldExt extends DateField { public function DateFieldExt() { } override protected function measure():void { // skip base class, we do our own calculation here // super.measure(); var buttonWidth:Number = downArrowButton.getExplicitOrMeasuredWidth(); var buttonHeight:Number = downArrowButton.getExplicitOrMeasuredHeight(); // copied from sdk develop branch var bigDate:Date; var txt:String; var textWidth:Number; var maxWidth:Number = 0; // Width may vary based on date format for (var month:int = 0; month < 12; month++) { bigDate = new Date(2000, month, 28); // day 28 exist in all months txt = (labelFunction != null) ? labelFunction(bigDate) : dateToString(bigDate, formatString); textWidth = measureText(txt).width; if (textWidth > maxWidth) { maxWidth = textWidth; } } measuredMinWidth = measuredWidth = maxWidth + 8 + 2 + buttonWidth; measuredMinWidth = measuredWidth += getStyle("paddingLeft") + getStyle("paddingRight"); measuredMinHeight = measuredHeight = textInput.getExplicitOrMeasuredHeight(); } {code} > DateField text scrolled when pressing DateField calendar button > --------------------------------------------------------------- > > Key: FLEX-24257 > URL: https://issues.apache.org/jira/browse/FLEX-24257 > Project: Apache Flex > Issue Type: Bug > Components: mx: DateField > Affects Versions: Adobe Flex SDK 3.2 (Release) > Environment: Affected OS(s): Windows > Affected OS(s): Windows 7 > Browser: Internet Explorer 8.x > Language Found: English > Reporter: Adobe JIRA > Assignee: Justin Mclean > Fix For: Apache Flex 4.10.0 > > Attachments: screenshot-1.jpg > > > Steps to reproduce: > 1. Click on an editable DateField's calendar button when the DateField > doesn't currently have focus. > 2. Observe the text in the DateField's textinput area. > > Actual Results: > The text is automatically highlighted and scrolled to the left such that the > beginning part of the date text isn't visible. > > Expected Results: > The text should not be highlighted or scrolled at all. > > Workaround (if any): > Click in the textinput area before pressing the button. > > Sample app: > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> > <mx:DateField editable="true"/> > </mx:Application> > I see this on Flex SDK 3.2, 3.4 and 4.0. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira