Dear my friends,

I don't understand why my scrollbar does not appear in my Listbox.

Please tell me my mistake.

Thank you very much in advance.
========
#!/usr/bin/perl -w
use Tk;
use kueri;
$mw=MainWindow->new;
$layarutama=$mw->title("arsipan in GUI");
$labelkatakunci=$mw->Label(
        -text => "Type-in the keyword: "
)->grid(
        -row => 0,
        -column => 0,
        -sticky => 'e'
);
$entrykatakunci=$mw->LabEntry(
        -textvariable => \$katakunci,
        -state => 'normal',
        -width => 50,
        -font => 'ArialBlack',
        -foreground => 'green',
        -takefocus => 1
)->grid(
        -row => 0,
        -column => 1,
        -sticky => 'w'
);
$tombolcari=$mw->Button(
        -text => "Find up",
        -command => sub{ &cari; }
)->grid(
        -row => 1,
        -column => 0
);
$tombolkeluar=$mw->Button(
        -text => "Quit",
        -command => sub{ exit }
)->grid(
        -row => 1,
        -column => 1
);
$sb=$mw->Scrollbar(
        -orient => 'vertical',
        -background => 'blue',
        -relief => 'sunken',
        -width => 100
);
$lbsqlcari=$mw->Listbox(
        -width => 140,
        -height => 20,
        -yscrollcommand => ['set' => $sb]
)->grid(
        -row => 2,
        -column => 0,
        -columnspan => 2
);
$sb->configure(-command => ['yview' => $lbsqlcari]);
MainLoop;

sub cari{
  $kk = $entrykatakunci->get();
  print "Ok, I use \"$kk\" as the keyword.\nNow I am diving into the database 
to find out what you have in it.\nPlease be patient.\n";
  $strsql="select nomor,location,informasi,nomormedia from tblarsip where 
(location like '%$kk%') or (informasi like '%$kk%')";
  print "$strsql\n";
#   
$dbh=DBI->connect("DBI:mysql:arsipan;localhost:3306","root","kikipritasari") or 
die "gagal konek ke mysql";
  $dbh=DBI->connect($kueri::dsn,$kueri::un,$kueri::pw) or die "gagal konek ke 
mysql";
  $sth=$dbh->prepare("$strsql");
  $sth->execute;
  while (@selectres=$sth->fetchrow_array){
        $lbsqlcari->insert('end',@selectres);
  }
  $sth->finish;
}

-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer


-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to