All,
How do I set the focus to a particular item in a ListView once the ListView
receives the focus?  So far I have:


#! perl
use Win32::GUI;
my %roles = ("r1" => "role 1",
"r2" => "role 2",
"r3" => "role 3",
"r4" => "role 4",
"r5" => "role 5",
);

# Create Main Window
my $Window = new Win32::GUI::DialogBox (
  -name     => "Window",
  -title    => "Testing",
  -pos      => [100, 100],
  -size     => [400, 400],
) or die "new Window";

#
# list view for roles
$Window->AddListView(
  -name => "lbRoles",
  -pos  => [ 15, 90 ],
  -size => [ 245, 145 ],
  -fullrowselect => 1,
  -nocolumnheader => 1,
  -visible => 1,
  -tabstop => 1,
  -onGotFocus => sub {
                       $Window->lbRoles->SetSelectionMark(3);
                       return;
                 },
);

$Window->lbRoles->InsertColumn( -index => 0, -subitem => 0, -text=>
"Description", -width => 240);

foreach (sort keys %roles) {
$Window->lbRoles->InsertItem(-text => ["$roles{$_}"]) if $_ ne "" &&
$roles{$_} ne "";
}

#
# ok button
#
$Window->AddButton(
  -name => "btnOk",
  -pos=>[36,242],
  -width => 100,
  -height => 25,
  -cancel => 1,
  -text => "Ok",
  -default => 1,
  -ok => 1,
  -tabstop => 1,
  -visible => 1,
);
# ---
# end ok button

$Window->Show();
Win32::GUI::Dialog();
__END__


Thanks,
Brian

Reply via email to