Re: How to make TextBox read only but look normal
- Posted by Dan_M Jul 07, 2009
- 1437 views
Quoting just a little of Dan's last message:
"In any event, I continued to post regarding the matter because the method I thought to suggest, namely altering the STYLE of the edit box between read only and editable, with removeStyle( id, style ), DIDN'T ACTUALLY WORK, and I couldn't see why not." ... Dan
I have also tried removeStyle and found that it doesn't work. However, several posts ago, Thomas indicated how the style could be removed. I have tried this and it DOES WORK. I repeat:
w32VOID = sendMessage(Ebox,EM_SETREADONLY,True,0)
When the Edit box is READONLY, it can receive focus and a portion may be selected even though the contents cannot be changed.
If you prefer it to be genuinely disabled and unable to receive focus, have you tried putting it in a Group control and disabling the Group control instead of the Edit box?
Thanks Arthur! Sorry I didn't notice Thomas' post showing how to remove the readonly style.
I think it's also possible to set readonly per your suggestion, AND make unable to receive focus, for tabbing only to fields which are supposed to be editable, by making an event for the readonly edit box, onGotFocus, & reseting focus to the NEXT appropriate field?
Dan