Clonning Spinner - possible bug?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Visse
Just popping in
Just popping in
Posts: 6
Joined: Fri Apr 12, 2013 23:06

Clonning Spinner - possible bug?

Postby Visse » Sun Apr 28, 2013 19:31

Hi, I think I have found a bug in the way Spinner - and possible other widgets that uses 'auto window'.
Its manifest itself when you try to clone a spinner, the Editbox auto window loses some of its properties, the most noticable properties for me is the font & the validation string.

The cause of the problem is that then you clone the spinner - it first creates all its auto windows:

Code: Select all

Window* Window::clone(const String& newName, const bool deepCopy) const
{
    Window* ret =
        WindowManager::getSingleton().createWindow(getType(), newName);

But then all its properties all cloned, including its LookNFeel.

Code: Select all

    // always copy properties
    clonePropertiesTo(*ret);

And then the in the Window::setLookNFeel its recreating all its auto windows:

Code: Select all

    // Work to initialise the look and feel...
    const WidgetLookFeel& wlf = wlMgr.getWidgetLook(look);
    // Get look and feel to initialise the widget as it needs.
    wlf.initialiseWidget(*this); /// <<< this call recreates all the auto windows
    // do the necessary binding to the stuff added by the look and feel
    initialiseComponents();

in 'Spinner::initialiseComponents' its calling the function 'setTextInputMode':

Code: Select all

        setTextInputMode(Integer);

but because its the second time this function is called, the first time was then the spinner was created, it fails the test:

Code: Select all

        if (mode != d_inputMode)
        { // This code is not run
            switch (mode)
            {
            case Integer:
                getEditbox()->setValidationString(IntegerValidator);
                break;

And as consequence the editbox looses its validation string. And in a similar way its looses its font.

A quick fix to the problem is to add the following line:

Code: Select all

void Window::setLookNFeel(const String& look)
{
    if( d_lookName == look ) return;

I don't know if it causes any other bugs but its fixes my problem with cloning a Spinner.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Clonning Spinner - possible bug?

Postby CrazyEddie » Mon Apr 29, 2013 16:27

I'll need to look into it. Can you add a ticket on mantis (http://mantis.cegui.org.uk login with your forum id), and include the same information there, or a link back here at the very least. This way the issue (and potential fix) will not get lost and forgotten - because I can't always look at these things immediately, and in a few weeks I will have forgotten completely :)

Thanks,

CE.

Visse
Just popping in
Just popping in
Posts: 6
Joined: Fri Apr 12, 2013 23:06

Re: Clonning Spinner - possible bug?

Postby Visse » Thu May 02, 2013 21:19

I don't seem to be able to log in, it just gives me this error message:
Your account may be disabled or blocked or the username/password you entered is incorrect.

And I'm sure that I'm using the same username & password as to the forums.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Clonning Spinner - possible bug?

Postby CrazyEddie » Fri May 03, 2013 11:18

I have looked on mantis, your account exists there so it should work. If you continue to have issues, I can reset that so that next time you log in there it is created freshly - let me know if you want me to do that.

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 31 guests