Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Win32:GUI ::Textfield Clear()

by hennesse (Sexton)
on Nov 21, 2011 at 15:07 UTC ( #939221=perlquestion: print w/replies, xml ) Need Help??
hennesse has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I'm having trouble updating a textfield. I thought this would work.

my $cwLogLevelData = $configWin->AddTextfield( -name => "cwLogLevelData", -pos => [100, 100], -width => 80, -height => 20, -background => [255,255,255], -tabstop => 1, ); $cwLogLevelData->Append("One"); $cwLogLevelData->Clear(); $cwLogLevelData->Append("Two");

I get "OneTwo". Clear() doesn't seem to do anything, or I'm using it wrong. Any ideas?

Thanks - Dave

Replies are listed 'Best First'.
Re: Win32:GUI ::Textfield Clear()
by Anonymous Monk on Nov 21, 2011 at 15:29 UTC

    Lets see

    samples/ 46- " > &Delete" => { -name => "Delete", 47: -onClick => sub { my $self = shift; + $self->Edit->Clear(); 0; } 48- },

    Right, notepad won't delete text unless you select text.

    You need  ->SelectAll;

    This would have been easier/faster to answer if your code was runnable. Short, Self Contained, Correct Examples make for effective questions

      Thank you! Thank you!


Re: Win32:GUI ::Textfield Clear()
by petecm99 (Pilgrim) on Nov 21, 2011 at 19:01 UTC
    Also can just set it to blank: $cwLogLevelData->Text('');
      Hey petecm99

      It's amazing how much functional code you can write in a short time, then get stymied for hours over some stupid little detail.

      I'm normally the he-man, DIY-er, don't ask for directions - just figger it out for yourself type.

      But I'm delving into the Win32::GUI stuff for the first time, and there are lots of stupid little details... So lately, when I spend more than 15 minutes head-scratching, I just ask the question, and go do something productive with my time.

      When I come back, some nice Monk has saved me a ton of time and frustration. What a great community!

      Thank you - Dave

        I agree - this site rocks! So many posts are in areas of Perl that I never delve into, so I love it when I see a question regarding something I actually use Perl for on a regular basis, and can answer.

        Glad I could help...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://939221]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2017-11-23 21:24 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (340 votes). Check out past polls.