Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Win32::GUI::Textfield problems

by cormanaz (Deacon)
on Jul 20, 2004 at 13:31 UTC ( [id://376032]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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

Good day Monks. When I run the follow code,
use Win32::GUI; $dataform = Win32::GUI::Window->new( -name => 'dataform', -width => 400, -height => 600, ); $dataform->AddTextfield( -name => 'example', -text => 'Here is some text', ); $dataform->Show(); Win32::GUI::Dialog(); sub dataform_Terminate { -1; }
I get a window with nothing in it. If I add a -prompt value to the Textfield object, I get a prompt but no text. If I print $dataform->{example}->{'-text'} it prints out OK. Why won't it show on the window?!? Many thanks..... Steve

Replies are listed 'Best First'.
Re: Win32::GUI::Textfield problems
by heroin_bob (Sexton) on Jul 20, 2004 at 15:02 UTC
    I'm not very familiar with this module, but I'd guess that the trailing comma after the last param "-height => 600," and "-text => 'Here is some text'," might be to blame. Are you using strict?
    ~hb
      No, that's actually just a plain Perl hash declaration. Watch:
      #!perl use strict; use warnings; my %hash = ( one => 1, two => 2, ); print "$_ => $hash{$_}\n" for keys %hash;
      No error.
      It's just "syntactic sugar" to make the declaration more uniform, I believe.
      Hope this helped.
      CombatSquirrel.

      Entropy is the tendency of everything going to hell.
        Gotcha, that's definitely good to know... Thnx for the tip!
        ~hb
      No, the problem was that I didn't have -height explicitly specified!

      Steve

Re: Win32::GUI::Textfield problems
by PodMaster (Abbot) on Jul 20, 2004 at 16:09 UTC
    You need to specify dimensions and location, ie
    -left => 10, -top => 10, -width => 200, -height => 22,
    wxPerl is a much nicer choice.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Win32::GUI::Textfield problems
by Belgarion (Chaplain) on Jul 20, 2004 at 16:09 UTC

    Try giving your text field a width and a height. Right now the field is 0x0 and positioned in the upper left hand corner of the parent window. Change your AddTextfield call to:

    $dataform->AddTextfield( -name => 'example', -text => 'Here is some text', -width => 100, -height => 100, );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://376032]
Approved by sth
help
Sections?
Information?
Find Nodes?
Leftovers?
    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.