Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Writing to a Win32::GUI RichEdit

by jpavel (Sexton)
on May 30, 2009 at 14:17 UTC ( [id://767037]=perlquestion: print w/replies, xml ) Need Help??

jpavel has asked for the wisdom of the Perl Monks concerning the following question:

G'day, good monks: My code for this portion of a project I'm working on is a mess - I can provide snippets if it'll help, but I think my problem lies in overall orchestration and comprehension.

I'm trying to write to a Win32::GUI RichEdit field with a highlighted word. The script scrapes output from another function and prints it out. I was originally using a Textfield, but that does not allow for variations in text. I know I need to write a prolog at initialization, then have my script print the lines with the word highlighted. There is no user interaction for this portion.

The problem I'm running into is that either my \'s get printed literally (so \fs20 is \\fs20 in the raw document) or they get completely misinterpreted and get turned into funky characters that I have no explanation for.

So - anybody ever print out rtf strings to a Win32::GUI Richedit window before? I don't mind including other modules; I've been fiddling with RTF::Writer's new_to_string with no success. Thanks again!

Replies are listed 'Best First'.
Re: Writing to a Win32::GUI RichEdit
by jpavel (Sexton) on Jun 02, 2009 at 13:49 UTC
    For anyone coming back here in the future, here's my solution:
    if ($ltext =~ m/^(.*)($searchvalue)(.*)$/igm) { $matches->Select(1e9, 1e9); $matches->ReplaceSel("$server: $1"); $matches->Select(1e9, 1e9); $matches->SetCharFormat( -bold =>1, -height =>260, -color =>0xFF0000 ); $matches->ReplaceSel($2); $matches->Select(1e9, 1e9); $matches->SetCharFormat( -bold =>0, -height =>170, -color =>0x000000 ); $matches->ReplaceSel("$3\r\n\r\n"); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://767037]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-16 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found