Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Win32:GUI ::Textfield Clear()

by hennesse (Beadle)
on Nov 21, 2011 at 15:07 UTC ( [id://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

    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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2026-01-14 03:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.