Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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
[Tux]: choroba++ # pm_cb_g also signals replies to posts, something#cbstream does not
[marto]: good afternoon all
[marto]: that is a neat feature, I'll have to have a look at how it displays that
[Tux]: 14:32 Europe/Amsterdam, so good afternoon to you :)
[marto]: 13:32, sunny Glasgow :P
[Tux]: as in, some others might appreciate a good morning or goor evening
[Tux]: Glasgow, as in TPCiG-2018 !!!! :) :)
erix would rather appreciate proof of a goodmorning
[marto]: Tux so I'm told :)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2017-09-22 12:33 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (262 votes). Check out past polls.