From e4b61d4b1d44ee8299e168566699c248901e4bd7 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 3 Aug 2003 23:00:04 +0000 Subject: OptionMenus do not have an horizontal scroll-bar. This can cause havoc for long strings. So use combo box as we used to do in those cases (eg: diskdrake Create dialog box in expert mode) (bug #4484) --- perl-install/interactive/gtk.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'perl-install') diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 582216761..3118e1d30 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -520,14 +520,22 @@ sub ask_fromW { } } else { if ($e->{type} eq "combo") { - $w = $e->{not_edit} ? Gtk2::OptionMenu->new : Gtk2::Combo->new; - if (!$e->{not_edit}) { - $w->set_use_arrows_always(1); - $w->disable_activate; - } my @formatted_list = map { may_apply($e->{format}, $_) } @{$e->{list}}; + my @l = sort { $b <=> $a } map { length } @formatted_list; + $width = $l[@l / 16]; # take the third octile (think quartile) + + if ($e->{not_edit} && $width < 60) { #- OptionMenus do not have an horizontal scroll-bar. This can cause havoc for long strings (eg: diskdrake Create dialog box in expert mode) + $w = Gtk2::OptionMenu->new; + } else { + $w = Gtk2::Combo->new; + $w->set_use_arrows_always(1); + $w->entry->set_editable(!$e->{not_edit}); + $w->disable_activate; + $has_horiz_scroll = 1; + } + $w->set_popdown_strings(@formatted_list); ($real_w, $w) = ($w, $w->entry); @@ -546,10 +554,6 @@ sub ask_fromW { my $i = eval { find_index { $s eq $_ } @formatted_list }; defined $i ? $e->{list}[$i] : $s; }; - - my @l = sort { $b <=> $a } map { length } @formatted_list; - $has_horiz_scroll = 1; - $width = $l[@l / 16]; # take the third octile (think quartile) } else { $w = Gtk2::Entry->new; $w->signal_connect(changed => $changed); -- cgit v1.2.1