i've seen the wiki and followed the first two tutorials, so i've added an event handler to the button and then specified the function:
void myFunction (const QuickGUI::EventArgs &args)
const QuickGUI::MouseEventArgs& mea = dynamic_cast<QuickGUI::MouseEventArgs&>(args);
if(mea.button == QuickGUI::MB_Left)
but the compiler gives me an error in the line of the casting, telling me "cannot use 'dynamic_cast' to convert from 'const QuickGUI::EventArgs' to 'QuickGUI::MouseEventArgs &'".
what is wrong?
You need a 'const' in the dynamic_cast<> part. You can't cast to a non-const type if the original is a const.
Also, you might want to use static_cast, it'll be faster. dynamic_cast is only really useful for pointers, since it can return NULL if the cast was outside a class hierarchy. Since you're using references, though, it can't return NULL, so there's really not much point in using it.
Thanks for exposing the typo, I've updated the wiki. Also good to learn more about static vs dynamic casting.
i know that maybe this is not the right place to say that, but i have also noted that there is at least another error in the wiki, in the "getting started" tutorial: we have to include the file QuickGUIRoot.h and not QuickGUI.h. maybe another "error" is when passing some parameters to the button desc object: there aren't position and size properties...all is made by dimensions(if i'm not in error...).
The Dimension class consists of a Size class and Point class, so they're all related. As for the wiki typos, everybody should be able to edit it right?
i didn't know...i'm not so practical with the wiki...
I have fixed them both. Thanks again.