Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Just another Perl shrine
 
PerlMonks  

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

Comment on Win32:GUI ::Textfield Clear()
Download Code
Re: Win32:GUI ::Textfield Clear()
by Anonymous Monk on Nov 21, 2011 at 15:29 UTC

    Lets see

    http://search.cpan.org/grep?cpanid=ROBERTMAY&release=Win32-GUI-1.06&string=Clear&i=1&n=1&C=1

    samples/Notepad.pl 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!

      Dave

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-04-20 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (487 votes), past polls