I'm sure that this is a simple task, however, I just can't seem to get it right. I have a Win322::GUI::RichEdit control that is set to readonly:
$mainform->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VISIBLE|WS_VSCROLL,-multiline=>1,-text=>"",-width=>745,-height=>450,-left=>10,-top=>35,-readonly=>1);
I am trying to change it's status from readonly to editable when the user clicks a button. I have tried:
$mainform->tab->Page4->articletext->Enable();
$mainform->tab->Page4->articletext->ReadOnly(0);
$mainform->tab->Page4->articletext->ReadOnly('FALSE');
$mainform->tab->Page4->articletext(-readonly=>0);
$mainform->tab->Page4->articletext->configure(-readonly=>0); # I think
+ this one is for tk
None of which worked. I have googled for almost an hour now and found nothing. I SuperSearched PerlMonks and found only one node
Win32::GUI Chatterbox client but I couldn't find a solution to my problem there. I did notice the constant
ES_READONLY used in the style option but I can't seem to find a style constant that will set it to editable.
Do I need to create the RichEdit control in a different manner? I have tried removing the
-readonly=>1 option and using the
ES_READONLY style when I create the control:
$form->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VISIBLE
+|WS_VSCROLL|ES_READONLY,-multiline=>1,-text=>"",-width=>745,-height=>
+450,-left=>10,-top=>35);
Then use
$mainform->tab->Page4->articletext(-style=>WS_VISIBLE|WS_VSCROLL); to set it to editable but that doesn't work either.
Any help or links to good docs will be greatly appreciated.
Thanks,
Chris
Update:I was not able to figure out how to change the readonly status so I went about it another way. Granted, I don't really like this way because it slightly increases overhead but, hey, if the mountain is too tall to climb, you just have to go around it.
The
workaround:
Create two identical objects except that one is readonly and the other is not. Hide the editable object immediately after creation. When the user wants to edit the text, set the text of the editable object equal to that of the readonly object. Hide the readonly object and show the editable object. When the user is done editing and has chosen to exit the edit mode, set the text of the readonly object equal to that of the editable object. Hide the editable object and show the readonly object again. It's the long way around it, really long, but it works.
I would still like to hear of other ideas /solutions / comments anyone might have.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.