Hi Isomorphic,
SmartGWT version: v5.0p_2016-03-19/EnterpriseEdition
Browser: Safari Version 9.0.2, Chrome 50.0.2661.102 m
Refer to the Showcase: http://www.smartclient.com/smartgwt/.../#form_masking
When we Tab from the [Phone No] field into the [Date] field (DateItem with setUseMask=true), and if there is a value in the [Date] field, currently the cursor position will always go to the end of the date, May I know is there any way to allocate the cursor in front of the date?
for previous build (v5.0p_2015-05-15/EnterpriseEdition), the cursor position is default to be in front of the date when we tab-into the DateItem field with mask. After update the version to v5.0p_2016-03-19/EnterpriseEdition, the cursor change to be back of the date.
I did try the following but no luck too:
1) deselectValue: start - By default the text insertion cursor will be moved to the end of the current value - pass in this parameter to move to the start instead
Coding: ( i tried both of focus and editor enter event)
DateItem dateField = new DateItem("dateItem", "Date");
dateField.setUseTextField(true);
dateField.setUseMask(true); dateField.addFocusHandler(new FocusHandler(){
@Override
public void onFocus(FocusEvent event) {
dateField.deselectValue(true);
}
});
dateField.addEditorEnterHandler(new EditorEnterHandler(){
@Override
public void onEditorEnter(EditorEnterEvent event) {
dateField.deselectValue(true);
}
});
2) setSelectionRange
Coding: ( i tried both of focus and editor enter event)
DateItem dateField = new DateItem("dateItem", "Date");
dateField.setUseTextField(true);
dateField.setUseMask(true); dateField.addFocusHandler(new FocusHandler(){
@Override
public void onFocus(FocusEvent event) {
dateField.setSelectionRange(0,1);
}
});
dateField.addEditorEnterHandler(new EditorEnterHandler(){
@Override
public void onEditorEnter(EditorEnterEvent event) {
dateField.setSelectionRange(0,1);
}
});
3)
Coding: (tried to see whether can default select the whole date)
DateItem dateField = new DateItem("dateItem", "Date");
dateField.setUseTextField(true);
dateField.setUseMask(true);
dateField.setSelectOnClick(true);
dateField.setSelectOnFocus(true);
SmartGWT version: v5.0p_2016-03-19/EnterpriseEdition
Browser: Safari Version 9.0.2, Chrome 50.0.2661.102 m
Refer to the Showcase: http://www.smartclient.com/smartgwt/.../#form_masking
When we Tab from the [Phone No] field into the [Date] field (DateItem with setUseMask=true), and if there is a value in the [Date] field, currently the cursor position will always go to the end of the date, May I know is there any way to allocate the cursor in front of the date?
for previous build (v5.0p_2015-05-15/EnterpriseEdition), the cursor position is default to be in front of the date when we tab-into the DateItem field with mask. After update the version to v5.0p_2016-03-19/EnterpriseEdition, the cursor change to be back of the date.
I did try the following but no luck too:
1) deselectValue: start - By default the text insertion cursor will be moved to the end of the current value - pass in this parameter to move to the start instead
Coding: ( i tried both of focus and editor enter event)
DateItem dateField = new DateItem("dateItem", "Date");
dateField.setUseTextField(true);
dateField.setUseMask(true); dateField.addFocusHandler(new FocusHandler(){
@Override
public void onFocus(FocusEvent event) {
dateField.deselectValue(true);
}
});
dateField.addEditorEnterHandler(new EditorEnterHandler(){
@Override
public void onEditorEnter(EditorEnterEvent event) {
dateField.deselectValue(true);
}
});
2) setSelectionRange
Coding: ( i tried both of focus and editor enter event)
DateItem dateField = new DateItem("dateItem", "Date");
dateField.setUseTextField(true);
dateField.setUseMask(true); dateField.addFocusHandler(new FocusHandler(){
@Override
public void onFocus(FocusEvent event) {
dateField.setSelectionRange(0,1);
}
});
dateField.addEditorEnterHandler(new EditorEnterHandler(){
@Override
public void onEditorEnter(EditorEnterEvent event) {
dateField.setSelectionRange(0,1);
}
});
3)
Coding: (tried to see whether can default select the whole date)
DateItem dateField = new DateItem("dateItem", "Date");
dateField.setUseTextField(true);
dateField.setUseMask(true);
dateField.setSelectOnClick(true);
dateField.setSelectOnFocus(true);
Comment