Re: How to make TextBox read only but look normal

new topic     » goto parent     » topic index » view thread      » older message » newer message
AndyDrummond said...

OK, this works. If you have a flag - I called it ROflag - which is True to make the control RO, and false to allow RW. You intercept the w32HEvent flag, and you test ROflag. If true do a returnValue(). This stops everything. But that includes painting. So you would need to leave ROflag false until the control is painted, setting it again afterwards to make the control inviolate.

You would probably be best to save the flag value in the main window onPaint handler, clearing it to allow the text to be painted, and restoring it after to the RO or RW state.

Does this make sense? It isn't terribly hygienic but it works. You can't do ANYTHING to the text box if the w32HEvent returnValue()'s.

Now we wait for Derek to tell us how it SHOULD be done...

Andy

. smile Does seem rather..Rube Goldberg!

Derek (and Greg) did earlier suggest to Tony to make the disabled edit more "presentable", by altering the background color of the disabled edit, which probably works just fine, I just thought that making the edit readonly and then altering that style as needed was a more elegant(?) approach, but then it didn't work, & I don't see why not.

Your way, though I guess it works, seems more like using an Elephant gun to shoot a mouse smile

Dan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu