From: Eric H. <eh...@co...> - 2006-03-20 17:50:43
|
#-- This is a code snipet from a Dual Listbox control dialog which allows=20 #-- the user to reorder the columns of a ListView "on-the-fly". The order #-- of columns saved is saved in a MS-ACCESS table for each unique username #-- so that the user will retain those column order settings for future #-- sessions. =20 #-- =20 #-- BUG REPORT:=20 #-- I am noticing column 0 of the Listview is much wider than the #-- width of the column header text? This appears to be a bug in the #-- widget. See code below for setting column widths.=20 ##################### sub BTN_Save4_Click { ##################### =20 my $ls_text; #-- local scalar my $ls_sel; my $ls_i; my $ls_sqltxt; my $ls_ret; my $ls_error; my $ls_len; #-- if all column names have not been selected from left listbox, return.=20 if ($LB_List1->Count() > 0) {return 1;} @ga_ColumnOrder=3D(); %gh_ColumnOrder=3D(); %gh_ColumnList=3D(); =20 $ls_sqltxt =3D "UPDATE tblColumnOrder SET "; =20 for ($ls_sel=3D0;$ls_sel<=3D36;$ls_sel++) { $ls_text=3D$LB_List2->GetString($ls_sel); $gh_ColumnOrder{$ls_sel}=3D$ls_text; $gh_ColumnList{$ls_text}=3D$ls_sel; $ga_ColumnOrder[$ls_sel]=3D$gh_OrigColumnList{$ls_text}; $ls_sqltxt =3D $ls_sqltxt . "[" . $ls_text . "]=3D" . $ls_sel . = ","; } $LV->SetColumnOrderArray(@ga_ColumnOrder); $LV->RedrawItems(0,$LV->Count()-1); for($ls_i=3D0;$ls_i<=3D36;$ls_i++) { $LV->SetColumnWidth($ls_i,-2); #-- adjust to fit column header text=20 } #-- for some reason, column 0 stretches out wide way! past the width of #-- the column header text? All other columns are as wide as header #-- text. This appears to be a bug in the widget.=20 $ls_len=3Dlength($ls_sqltxt); $ls_sqltxt=3Dsubstr($ls_sqltxt,0,($ls_len-1));=20 $ls_sqltxt=3D$ls_sqltxt . " WHERE username =3D '" . $gs_LoggedUser . = "'"; ... } |