Fix a crash with a long text.

At the moment the scroll_label is the label to be used if wrapping is
required.  The dialog looks a bit ugly due to the fact that the
scroll_label can't optimize it's size yet. Also the alignment looks a
bit odd, but I'll leave it to Baufo to tune that part.
This commit is contained in:
Mark de Wever 2009-01-31 12:06:50 +00:00
parent 0d66f0b154
commit b5109a2b56
2 changed files with 7 additions and 4 deletions

View file

@ -44,12 +44,12 @@
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
[scroll_label]
id = "login_label"
definition = "default"
label = ""
[/label]
[/scroll_label]
[/column]

View file

@ -23,6 +23,7 @@
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/label.hpp"
#include "gui/widgets/password_box.hpp"
#include "gui/widgets/scroll_label.hpp"
#include "gui/widgets/toggle_button.hpp"
namespace gui2 {
@ -234,8 +235,10 @@ void tmp_login::pre_show(CVideo& /*video*/, twindow& window)
dynamic_cast<tbutton*>(window.find_widget("change_username", false));
if(change_username) change_username->set_retval(2);
tlabel* label =
dynamic_cast<tlabel*>(window.find_widget("login_label", false));
// Needs to be a scroll_label since the text can get long and a normal label
// can't wrap (at the moment).
tcontrol* label =
dynamic_cast<tscroll_label*>(window.find_widget("login_label", false));
if(label) label->set_label(label_);
ttoggle_button* remember_password