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

Re^3: Help with JComboBox

by JamesNC (Chaplain)
on Nov 17, 2004 at 20:56 UTC ( [id://408578]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Help with JComboBox
in thread Help with JComboBox

I think you did it again... do this to set the dialog windows combo box to the main window combo box, should probably rename these to avoid the Who's on first, what's on second...
############################### # Added this line so the displayed value is correct #$selected = $selected_1; #<-- not this $testbox2->setSelected( $selected1 ); #<-- but this ###############################

Replies are listed 'Best First'.
Re^4: Help with JComboBox
by TonyDonker (Novice) on Feb 14, 2005 at 08:50 UTC
    Hello, I am using the JCombobox module. All of the time, when I select an option from the combobox, I receive the message: 'Use of uninitialized value in pattern match (m//) at ../JComboBox.pm line 567' I have tried thousands of things, but nothing seem to work. Is there anyone who has an idea? Thanks in advance, Ton
      Lines 566-569 of my version of JComboBox.pm is
      my $mode = $cw->cget('-validate'); if ($mode =~ /match/) { $cw->configure(-validate => 'none'); }
      $mode must be undefined and as a result, issues that warning.

      The code can be re-written to check before it tries to regex. You can change the code in the module to something like:
      my $mode = $cw->cget('-validate'); if (defined $mode && $mode =~ /match/) { # <== change $cw->configure(-validate => 'none'); }
      And that will fix the warning. If you are using -validate make sure you aren't pointing to an undef value. All the code does is set -validate to 'none' if it is set to 'match'. It is in the SetSelectedIndex subroutine.

      JamesNC

        Yes, this is one way of going about fixing it - I have also suggested doing something like:

        my $mode = $cw->cget('-validate') || "none";

        To ensure that there was a value. The thing is it should never have been left to default to undef like it had. I think my preferred fix would be to set a default from the very start ... say at line 207:

        -validate => [qw/METHOD validate Validate none/],

        It's worth mentioning that the newer versions of JComboBox don't have this problem. The newer version also has features that look like they would have helped folks who have posted here before.

        This is probably the first time I've ever checked perlmonks for problems encountered with JComboBox -- I find it a little odd that the questions weren't posted to comp.lang.perl.tk, but I'm glad that folks were able to get help with it, or find better solutions.

        Rob
        Thanks JamesNC - that works! The message is not being generated anymore...!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://408578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-25 14:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found