I am having some trouble figuring out how to capture an enter/return event in a listview and treat it like a click event. I have noticed the KeyDown event, and figure that is what I'd need to use to capture the backspace and delete keys, but am not sure where to gather the values to capture these keystrokes. It seems as if the return and other keys are triggering the KeyDown event and over-ride the accelerator table, but values such as 10 and 13 which are normal dos keyboard values for return/control return aren't being seen with KeyDown.
Code below shows some of what I've tried. use Win32::GUI; $Accelerator = new Win32::GUI::AcceleratorTable( "Return" => "LV_ReturnPressed" ); $Window = new Win32::GUI::DialogBox( -name => Window, -text => "Test ListView Window", -accel => $Accelerator, -height => 500, -width => 500, -top => 0, -left => 0, -minimizebox => 1, -maximizebox => 1, -resizable => 1 ); $LV = $Window->AddListView( -name => LV, -text => "Test ListView", -left => 0, -top => 0, -height => 500, -width => 500, -list => 1, #-hottrack => 1, -- wasn't sure if this made a difference -tabstop => 1, ); $LV->Add( {-text => "First"}, {-text => "Second"}, {-text => "Third"} ); $LV->InsertColumn( -height => 500, -width => 500, -index => 0 ); $LV->SetFocus(); $Window->Show(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; } sub Window_Activate { $LV->SetFocus(); } sub LV_Click { $Item = $LV->GetSelectionMark(); print "\aClicked on $Item\n"; } sub LV_DoubleClick { $Item = $LV->GetSelectionMark(); print "\aDouble Click on $Item\n"; } sub LV_KeyDown { $Key = shift; print "$Key pressed.\n"; } sub LV_ReturnPressed { print "\aReturn pressed.\n"; }