About Store Forum Documentation Contact



Post Reply 
TextLine doesn't respond!
Author Message
Eric Offline
Member

Post: #1
TextLine doesn't respond!
Hello, here's my code:
Code:
struct TextLabel : GuiCustom
{
    virtual void update(C GuiPC &gpc)
    {
             super::update(gpc);
               _for.update(gpc);
        _text_field.update(gpc);
    }
    virtual void draw(C GuiPC &gpc)
    {
        if(gpc.visible && visible())
        {
            D.clip(gpc.clip);
                   _for.draw(gpc);
            _text_field.draw(gpc);
        }
    }
    TextLabel& init(C Rect &rect, Flt text_width, C Str &for_text, C Str &textfield_text=S, C Str &textfield_alt=S)
    {
        create(rect);

        _for.create(Rect_LU(rect.lu(), rect.w()*text_width, rect.h()), for_text, &DefaultTextStyle);
        _text_field.init(Rect_LU(rect.lu().x+(rect.w()*text_width)+TLABEL_SPC, rect.lu().y,
            rect.w()-(rect.w()*text_width)-TLABEL_SPC, rect.h()), textfield_text, textfield_alt);

        T+=_for;
        T+=_text_field;

        return T;
    }
private:
    Text      _for;
    TextField _text_field;
};

TextField = my custom TextLine (only the rects colors are changing, rest is the same, but even if I change TextField to TextLine the problem still exists)

So.. my problem is: the TextField doesn't respond - it means I cannot write anything to it, like it didn't had kb focus.

The code in .cpp file in Init() is:
Code:
Gui+=text_label.init(Rect_C(0.0f, -0.0f, 0.9f, 0.1f), 0.2f, "label:");

P.S. Esenthel if you're reading this: is there any chance for you to provide for every TextLine it's own pointer to textline TextStyle? It'd enable me to implement "alternative text" in text lines smile and It'd be much appreciated!

Regards,
Eric 'Eri' Przychocki
ourgames.eu
(This post was last modified: 01-07-2014 05:39 PM by Eric.)
01-07-2014 05:34 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: TextLine doesn't respond!
Hi,

GuiCustom does not support += operator,
please use Window or Region (and then don't call update/draw on sub elements because they will be called automatically)
01-07-2014 09:47 PM
Find all posts by this user Quote this message in a reply
Eric Offline
Member

Post: #3
RE: TextLine doesn't respond!
thanks, worked!

Regards,
Eric 'Eri' Przychocki
ourgames.eu
01-09-2014 10:20 PM
Find all posts by this user Quote this message in a reply
Post Reply