I am trying to use this module to make a GUI for a command-line
application.

I am using at the moment two list boxes and a Progress Bar. For some
reason the interpreter can't find the second list box when I try to call
its Add function. I also can't seem to get slide bars to appear on the
listboxes either.

Basically I am trying to remove a string from List box A and move it to
List Box B via selection and a click on a button.

I have included the code I am messing with below. If anyone can tell me
anything here I'd appreciate it.

use Win32::GUI;

$Menu = new Win32::GUI::Menu(
File => "&File",
Text =>"",
);

$Window = new Win32::GUI::Window(
-name => "Window",
-title => "Steve's Window",
-left => 100, 
-top => 100,
-width => 500, 
-height => 400, 
-menu => $Menu,
);

$Window ->AddProgressBar(
-name => "Progbar",
-width=>250,
-height=>20,
-top =>100,
-left=>125,
-smooth =>0,
-vertical =>0
);

$Window->Progbar->SetPos (0);
$Window->Progbar->SetRange(0,10);
$Window->Progbar->SetStep (1);

$Window->AddLabel(
-name =>"ProgLabel",
-align => "center",
-text =>"Overall Progress",
-width => 100,
-height =>50,
-top => 150,
-left=>150 
);

$Window->AddListbox (

name => "Done",
-align => "center",
-width => 100,
-height => 500,
-left =>400,
-multisel => 1,
-ScrollV =>1,
-sort =>1
);

$Window->AddListbox (
-name => "Agenda",
-align => "center",
-width => 100,
-height => 500,
-multisel => 1,
-ScrollV =>1,
-sort =>1
);

$Window->AddButton(
-name => "Remove",
-align => "center",
-text => "Remove",
-left => 200,
-top => 200
-width => 100,
-height => 50,
);



$Window->Show();

@Stuff = ("First","Second","Third", "Fourth");

foreach $item (@Stuff)
{ 

$Window->Agenda->Add($item);
}


$screen = $Window->GetDC();
$i=1;
while(1)
{
$i++; 
Win32::GUI::DoEvents(); 
$Window->Progbar->StepIt();
sleep (1);
$screen->TextOut(200,250,"Overall Progress : $i");
}




sub Remove_Click
{
# which one is selected ?
$todo = $Window->Agenda->SelectedItem();
if ($todo == -1)
{
$todo = $Window->Done->SelectedItem();
if ($todo == -1)
{
exit;
}

$item = $Window->Done->GetString($todo);
$Window->Done->RemoveItem($todo);
$Window->Agenda->AddString($item);
$todo = -1;
}
else
{
$item = $Window->Agenda->GetString($todo);
$Window->Agenda->RemoveItem($todo);
$Window->Done->Add($item);
$todo = -1;
}

}


sub Window_Terminate
{

return -1;
} 



Reply via email to