Thursday, January 17, 2013

Re: Read Only DateBox

Just revisited this code.  Worked out that we can override the showDatePicker method to check for read only.   You're welcome IE users!  :-)

public class MyDateBox extends DateBox {
public void setReadOnly(boolean readOnly) {
getTextBox().setReadOnly(readOnly);
}
@Override
public void showDatePicker() {
if (getTextBox().isReadOnly() == false) {
super.showDatePicker();
}
}
}


On Friday, 18 January 2013 09:19:38 UTC+11, Craig Mitchell wrote:
Unfortunately, .getTextBox().setReadOnly(true) doesn't work, as the DatePicker still shows when clicking on the field.

However, I now realise that doing setEnabled(false) and setting some CSS, it's only IE that ignores the CSS and shows the nasty, hard to read, shadowed text.  But I say, bad luck to IE users, they should just switch to a different browser!  :-)


On Thursday, 17 January 2013 14:59:01 UTC+11, 彭振友 wrote:
.getTextBox().setReadOnly(true);
hope that help you。

On Monday, February 20, 2012 1:01:17 PM UTC+8, Craig Mitchell wrote:
Hi,

A DateBox can be set to setEnabled(false), however, it does not have a
setReadOnly(true).  And calling dateBox.getTextBox().setReadOnly(true)
does not work.

This is annoying, as browsers do nasty things to the text color when
you disable the field (which CSS doesn't seem to be able to override).

Does anyone has a nice solution to having a disabled or read only
DateBox, that can have any text colour?

Thanks.

PS:  As a work around, I have a DateBox and a TextBox.  When I want to
disabled the DateBox, I just hide it and show the read only TextBox,
copying in the the value across like this
myTextBox.setValue(myDateDateBox.getTextBox().getValue());

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/yjZQBjRkYkcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate