paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-users] Callback Object for Radiobuttons


From: Evil Azrael
Subject: [paragui-users] Callback Object for Radiobuttons
Date: Fri, 7 Mar 2003 00:32:19 +0100

Hi!

I am currently try to install an callback function for an RadioButton,
but it crashs the programm at the end of the calling function ( the
constructor of the window). The Crash Message is
"The value of ESP was not properly saved across a function call.
This is usually a result of calling a function declared with one
calling convention with a function pointer declared with a differient
calling convention"

Can i do it like this, or do i have to derive a new control for this
purpose?

size1 = new PG_RadioButton(this,RAD_SIZE1 ,PG_Rect(175,50,100,25),"klein");
size1->SetEventObject(MSG_BUTTONCLICK,this, (MSG_CALLBACK_OBJ) 
&Schritt1::aenderung,NULL);

Thanx in advance for any answer and especially for any help :)

Christoph Nelles


-------------------------------
Full Class Code :

class Schritt1 : public PG_Window, public PG_EventObject
{
public:
        Schritt1();
        ~Schritt1() {};
        
        PG_RadioButton *size1,*size2,*size3;
        PG_RadioButton *dichte1,*dichte2,*dichte3;
        PG_SpinnerBox *anzahl_spieler;
        PG_SpinnerBox *anzahl_ki;

        bool eventButtonClick (int id, PG_Widget *widget);

        PARAGUI_CALLBACK(aenderung) {
        PG_LogMSG("Da ist was passiert!");
        return true;    
        };


        enum {
                RAD_SIZE1 = 1001, RAD_SIZE2,RAD_SIZE3,
                RAD_DICHTE1,RAD_DICHTE2,RAD_DICHTE3,
        };
};

Schritt1::Schritt1() : 
PG_Window(NULL, 
PG_Rect((PG_Application::GetScreenWidth()-500)/2,(PG_Application::GetScreenHeight()-500)/2,500,500),"Neues
 Spiel - Grundeinstellungen",WF_SHOW_CLOSE)
{
        size1 = new PG_RadioButton(this,RAD_SIZE1 
,PG_Rect(175,50,100,25),"klein");
        size1->SetEventObject(MSG_BUTTONCLICK,this, (MSG_CALLBACK_OBJ) 
&Schritt1::aenderung,NULL);
        size2 = new PG_RadioButton(this,RAD_SIZE2, 
PG_Rect(275,50,100,25),"mittel",size1);
//      size2->SetEventObject(MSG_BUTTONCLICK,this, (MSG_CALLBACK_OBJ) 
&Schritt1::aenderung);
        size3 = new PG_RadioButton(this,RAD_SIZE3, 
PG_Rect(375,50,100,25),"groß",size1);
//      size3->SetEventObject(MSG_BUTTONCLICK,this, (MSG_CALLBACK_OBJ) 
&Schritt1::aenderung);
        dichte1 = new 
PG_RadioButton(this,RAD_DICHTE1,PG_Rect(175,100,100,25),"dünn");
        dichte2 = new 
PG_RadioButton(this,RAD_DICHTE2,PG_Rect(275,100,100,25),"normal",dichte1);
        dichte3 = new 
PG_RadioButton(this,RAD_DICHTE3,PG_Rect(375,100,100,25),"dicht",dichte1);

        anzahl_spieler = new PG_SpinnerBox(this,PG_Rect(175,150,50,25));
        anzahl_ki = new PG_SpinnerBox(this,PG_Rect(425,150,50,25));

        PG_Label *bezeichnung = new 
PG_Label(this,PG_Rect(25,50,150,25),"Galaxiegröße");
        bezeichnung = new PG_Label(this,PG_Rect(25,100,150,25),"Sternendichte");
        bezeichnung = new PG_Label(this,PG_Rect(25,150,150,25),"Anzahl 
Spieler");
        bezeichnung = new PG_Label(this,PG_Rect(275,150,150,25),"Davon KI");

        PG_Button *knopf = new PG_Button(this,-1, 
PG_Rect(375,450,100,40),"Weiter");
        knopf = new PG_Button(this,PG_WINDOW_CLOSE, 
PG_Rect(200,450,100,40),"Abbrechen");
}

bool Schritt1::eventButtonClick(int id, PG_Widget *widget)
{
        PG_Window::eventButtonClick(id,widget);
        if (id == PG_WINDOW_CLOSE)
        {
                Startmenue *startmenue = new Startmenue;
                startmenue->Show();
                Hide();
                SendMessage(NULL, MSG_WINDOWCLOSE, GetID(), 0);
                return true;
        }
        return false;
}



  

-- 
Mit freundlichen Grüssen
Evil Azrael                          mailto:address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]