diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-08-03 23:00:04 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-08-03 23:00:04 +0000 |
commit | e4b61d4b1d44ee8299e168566699c248901e4bd7 (patch) | |
tree | 33222f3b52c520c7ea5a63899cf4f9809bacc536 | |
parent | 1c988d55aee0fc240fcdbf3001195437ed9061c8 (diff) | |
download | drakx-e4b61d4b1d44ee8299e168566699c248901e4bd7.tar drakx-e4b61d4b1d44ee8299e168566699c248901e4bd7.tar.gz drakx-e4b61d4b1d44ee8299e168566699c248901e4bd7.tar.bz2 drakx-e4b61d4b1d44ee8299e168566699c248901e4bd7.tar.xz drakx-e4b61d4b1d44ee8299e168566699c248901e4bd7.zip |
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)
-rw-r--r-- | perl-install/interactive/gtk.pm | 22 |
1 files changed, 13 insertions, 9 deletions
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); |