Hi Monks,

I am facing problem in creating combo box widget in child window.

For first time, child window launching correctly and all widgets are placed fine. But for second time, when launching child window it doesn't show the Combo box widget

Kindly point me where is the problem

#!/usr/bin/perl use Tk; use Tk::JComboBox; my $screen_size = "1010x720+0+0"; my $tool_name='Testing Interface'; &Screen(); MainLoop; #-------Drawing User interface screeen---------------------- sub Screen { $main_screen_object = MainWindow->new(-bg => 'white'); $main_screen_object->geometry($screen_size); $main_screen_object->title($tool_name); createButton('CREATE NEW WINDOW',15,490,150,$main_screen_object); } #-------Callback function 'CREATE NEW WINDOW' button------------------ +------ sub onCREATENEWWINDOWButtonClick { $main_screen_object->update(); $CopyWindow=$main_screen_object->Toplevel(-height => 240, -width = +> 270, -background => 'white', -title => 'Copy Mapping') or die "coul +d not instant\n"; createLabel('COUNTRY',30,25,undef,undef,undef,$CopyWindow); our @CountryCodesList=qw /HD NK ID LK/; createComboBox('CountryCodes',10,140,25,$CopyWindow); } sub onCountryCodeComboBoxSelect { } #-------createLabel() - Used to create the label widget for given conf +iguration--------------- sub createLabel { my($LabelName,$x,$y,$background,$Font,$Foreground,$Object) = @_; $Font = 'verdana 10 bold' unless defined $Font; $background = 'white' unless defined $background; $Foreground = '#015F96' unless defined $Foreground; my($LabelNameObject); if ( defined($Object) ) { $LabelNameObject = $Object->Label(-background =>$background,-t +ext =>$LabelName,-font =>$Font,-foreground =>$Foreground)->place(-x=> +$x,-y=>$y); } else { $LabelNameObject = $main_screen_object->Label(-background =>$b +ackground,-text =>$LabelName,-font =>$Font,-foreground =>$Foreground) +->place(-x=>$x,-y=>$y); } return($LabelNameObject); } #-------createComboBox() - Used to create the combobox widget for give +n configuration--------------- sub createComboBox { my($ComboBoxName,$Width,$x,$y,$Object) = @_; $ComboBoxName =~ s/\s+//g; my $ComboBoxObject = $Object->JComboBox(-background =>'white', -textvariable => \${$ComboBoxName}, -choices => \@{$ComboBoxName."List"}, -browsecmd =>\&{"on".$ComboBoxName."ComboBoxSelect"} +, -font =>'verdana 10', -relief => 'solid', -borderwidth => 1, -entrywidth => $Width ) ->place(-x=>$x,-y=>$y) or die "Error $! \n\n"; return($ComboBoxObject); } #-------createButton() - Used to create the button widget for given co +nfiguration--------------- sub createButton { my($ButtonLabel,$Width,$x,$y,$Object) = @_; my($ButtonObject); my $ButtonName = $ButtonLabel; $ButtonName =~ s/\s+//g; $ButtonObject = $Object->Button(-background =>'grey', -text =>"$ButtonLabel", -font =>'verdana 10 bold', -foreground =>'black', -disabledforeground => '#90938D', -activebackground=>'#4A71AD', -activeforeground => 'white', -relief => 'solid', -borderwidth => 1, -width =>$Width, -command =>\&{"on".$ButtonName."Button +Click"})->place(-x=>$x,-y=>$y); return($ButtonObject); }

In reply to Perk TK : Child Window widgets by selva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.