From: <mil...@se...> - 2009-11-19 09:08:20
|
Dear All : Does any one know how to let the ListView subitem can be edit ? Below is my sample code : #!perl use Win32::GUI ; $MW = Win32::GUI::Window -> new( -name => 'MW', -size => [350,550], -pos => [250,125], -text => "Listview Example", -font => $font_T_8 , -style => WS_MINIMIZEBOX | WS_SYSMENU, ); $LV_0 = $MW -> AddListView( -name => "LV_0", -size => [300,500], -pos => [6,6], -fullrowselect => 1, # Select every colnum's row at the same time -hottrack => 0, # Auto select item , don't click item -gridlines => 1, # Draw the border for list table -checkboxes => 0, # Show the check box on the every row start -singlesel => 1, -oneclickactivate => 1, # Change the cursor to onecclick type while on the select item -editlabel => 1, # Can be edit -visible => 1, -nocolumnheader => 0, # Hide the column header ); $LV_0 -> InsertColumn( -index => 1, -width => 150, -text => "Column_0", ); $LV_0 -> InsertColumn( -index => 2, -width => 150, -text => "Column_1", ); #$LV_1 = Win32::GUI::ListView::SubItem -> new( # -parent => $LV_0, # -index => 1, # -subindex => 1, # ); for(0..100){ print $LV_0 -> InsertItem ( -text => [ ( sprintf "index %03d", $_ ), ( sprintf "subindex% 03d", $_ ) ] ), "\n"; } $MW -> Show(); Win32::GUI::Dialog(); exit(0); sub MW_Terminate{ -1; } sub LV_0_DblClick{ print "SelectedItem:", $LV_0 -> SelectedItems(), "\n" ; $LV_0 -> EditLabel( $LV_0 -> SelectedItems() ); } sub LV_0_BeginLabelEdit{ print "BLabelEdit:", "@_", "\n"; } sub LV_0_EndLabelEdit{ print "ELabelEdit:", "@_", "\n"; } ---End-- Best Regards Miller Chen |