[Solved] Events, buttons etc...

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

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Events, buttons etc...

Postby Ident » Thu Sep 17, 2015 22:01

That was the message from before. You changed things in code since, please provide the exact error message in clear text as given in the output window if your IDE, and also post the callstack. I will look at it then.

Also did you make a breakpoint in the function and did you check the variable is alright before it is used?
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: Events, buttons etc...

Postby Tonyx97 » Fri Sep 18, 2015 08:57

When I read the link you sent to me I realized that my project was set on Release instead of Debug and now I guess it should work but it's worst, now it crashes when I create the whole GUI, the program is saying me that CEGUIBase-0.dll symbols were not loaded I don't know why...

This is the exception error:

Code: Select all

First-chance exception at 0x76E5C42D in Classic Engine.exe: Microsoft C++ exception: std::length_error at memory location 0x0018E564.


And this is the code where it crashes at:

Code: Select all

CEGUI::String ToString(float value)
{
   return to_string(value);
}


Finally this is the callstack output:

Code: Select all

    KernelBase.dll!_RaiseException@16()   Unknown
    [External Code]   
    CEGUIBase-0.dll!0f9bc24d()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for CEGUIBase-0.dll]   
    CEGUIBase-0.dll!0f8fee87()   Unknown
    CEGUIBase-0.dll!0f8f7159()   Unknown
>   Classic Engine.exe!ToString(float value) Line 18   C++
    Classic Engine.exe!GUI_t::CLabel(CEGUI::String text, float x, float y, float sx, float sy, Color color, CEGUI::String font, CEGUI::String horzAlign, CEGUI::String vertAlign, CEGUI::Window * parent) Line 127   C++
    Classic Engine.exe!InitGUI() Line 48   C++
    Classic Engine.exe!initGL() Line 210   C++
    Classic Engine.exe!main(int argc, char * * argv) Line 78   C++
    [External Code]   



I don't know why CEGUIBase-0.dll were not loaded because I have it on my project folder, on window folder and sysWOW folder too. I'm sure this is the error I'm looking to fix.

lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: Events, buttons etc...

Postby lucebac » Fri Sep 18, 2015 09:28

CEGUIBase-0.dll got loaded, everything is fine. There are just no Debug symbols since you seem to having it built in Release mode. Rebuild in 'RelWithDebSymbols' mode if you need speed and the symbols. But for true debugging I would recommend plain 'Debug' mode. Please rebuild in either one of these modes and post the new callstack afterwards. Then we can help you better.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Events, buttons etc...

Postby Ident » Fri Sep 18, 2015 09:38

Are you combining Debug with Release runtimes maybe? Please never do that.
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: Events, buttons etc...

Postby Tonyx97 » Fri Sep 18, 2015 09:53

I did it and here's the callstacks:

Code: Select all

>   Classic Engine.exe!Gridlist::OnClick(const CEGUI::EventArgs & args) Line 49   C++
    Classic Engine.exe!CEGUI::MemberFunctionSlot<Gridlist>::operator()(const CEGUI::EventArgs & args) Line 55   C++
    CEGUIBase-0.dll!58f891e2()   Unknown
    CEGUIBase-0.dll!58f8a814()   Unknown
    CEGUIBase-0.dll!58f8a7dc()   Unknown
    CEGUIBase-0.dll!58ff19ae()   Unknown
    CEGUIBase-0.dll!58ff19e7()   Unknown
    CEGUIBase-0.dll!58ff19e7()   Unknown
    CEGUIBase-0.dll!58f9a9fd()   Unknown
    Classic Engine.exe!glutMouseMotion(int button, int state, int x, int y) Line 578   C++
    glut32.dll!004540f8()   Unknown
    glut32.dll!00453f6b()   Unknown
    glut32.dll!00452aa1()   Unknown
    [External Code]   
    glut32.dll!00445916()   Unknown
    glut32.dll!00445a64()   Unknown
    glut32.dll!00445861()   Unknown
    Classic Engine.exe!main(int argc, char * * argv) Line 81   C++
    [External Code]   



Exception:

Code: Select all

Unhandled exception at 0x58F0ED71 (CEGUIBase-0.dll) in Classic Engine.exe: 0xC0000005: Access violation reading location 0x00000390.

lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: Events, buttons etc...

Postby lucebac » Fri Sep 18, 2015 09:59

What code is in the line shown by the error message?
Classic Engine.exe!Gridlist::OnClick(const CEGUI::EventArgs & args) Line 49 C++

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: Events, buttons etc...

Postby Tonyx97 » Fri Sep 18, 2015 10:03

Code: Select all

bool OnClick(const CEGUI::EventArgs& args)
{
   CEGUI::String ItemName = CListbox->getFirstSelectedItem()->getText();
   cout << "Gridlist: " << CListbox << " - Clicked Item: " << ItemName << endl;
   return true;
}

lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: Events, buttons etc...

Postby lucebac » Fri Sep 18, 2015 10:16

That are 6 lines - I only need line 49.

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: Events, buttons etc...

Postby Tonyx97 » Fri Sep 18, 2015 10:19

This is the line 49:

Code: Select all

CEGUI::String ItemName = CListbox->getFirstSelectedItem()->getText();

This is the line 43:

Code: Select all

CListbox->addItem(static_cast<CEGUI::ItemEntry*>(item));

And this is the line 55:

Code: Select all

grid.AddItem("Item 1");

lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: Events, buttons etc...

Postby lucebac » Fri Sep 18, 2015 10:30

What does getFirstSelectedItem() return? If it returns null getText() will crash your app since it tries to dereference a NULL pointer. Can you split line 49 so that you can check whether there is some valid pointer returned to you or not?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Events, buttons etc...

Postby Ident » Fri Sep 18, 2015 10:57

I actually mentioned exactly this just some replies ago...
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: Events, buttons etc...

Postby Tonyx97 » Fri Sep 18, 2015 11:31

And I already answered you Ident. It returns NULL if I click on the RIGHT Listbox first, that's why it crashes my program. Obviously I did a IF condition to check if is NULL or not, and yes, it's NULL if I click RIGHT Listbox first.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Events, buttons etc...

Postby Ident » Fri Sep 18, 2015 13:36

So in the case of the left listbox - what do you get? a not-null listbox? and you get an access violation then? Did you inspect the listbox with your debugger to see if it is a proper listbox instance? You need the debug symbols for this purpose as described.
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: Events, buttons etc...

Postby Tonyx97 » Fri Sep 18, 2015 13:48

Yes, If I click on the left one it gives me the output of the left listbox but not crashes of course, only crashes when I click right listbox first. If I click on left listbox it returns a valid listbox instance. How can I debug symbols as you said?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Events, buttons etc...

Postby Ident » Fri Sep 18, 2015 14:18

What do you mean by "when I click right listbox first"? So if you catch the nullpointer you said it won't "crash" (as you call it)? So when does it crash and what do you get there as listbox then ..
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 12 guests