paragui-users
[Top][All Lists]
Advanced

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

[paragui-users] Re: Signels ?


From: David Stubbs
Subject: [paragui-users] Re: Signels ?
Date: Tue, 22 Mar 2005 11:55:03 +0000

Hi All,

Thought I would point out the mistakes that I have made just incase it
helps anybody else thats finds them self's with the same problems...
(lack of knowledge). I think my infancy with C++ coursed a lot of
problems so it took me some time but here is the modified test program
that works. Differences are that the "Testing" class now inherits from
the SigC::Object and the "PrintHello" member function has the return
type of bool. The only other change is that the instance "t1" of the
"Testing" class in instantiated by "Testing t1;" not "Testing t1();",
not sure why this makes a difference but it does (once again my lack
of knowledge).

Sorry to bother you all, and thanks once again for a great tool kit.

David Stubbs

==================================================
#include "pgapplication.h"
#include "pgbutton.h"
#include <iostream>

class Testing : public SigC::Object {
public:
       bool PrintHello(PG_Button* b);
};

bool Testing::PrintHello(PG_Button* b){
       std::cout << "Hello there \n";
};

int main() {

   PG_Application app;

   app.LoadTheme("default");

   Testing t1;

   if(!app.InitScreen(800,600, 0, SDL_SWSURFACE)){
       printf("Resolution not supported\n");
       exit(-1);
   }

   //
   PG_Button button(NULL, PG_Rect(20, 20, 368, 72), "Testing");

   button.Show();
   button.sigClick.connect(slot(t1, &Testing::PrintHello));


   app.Run();

   return EXIT_SUCCESS;
};

================================================


On Mon, 21 Mar 2005 15:42:57 +0000, David Stubbs <address@hidden> wrote:
> Hi All,
> 
> I have been playing with ParaGUI for two days and it seems wonderful,
> the theming is great !. I wanted to use SDL as the underlying layer
> but wanted something to make life easier when making my app, after
> looking though all of the toolkits ParaGUI seemed like the best one
> for me, Although I was a little apprehensive as I've only used C++ a
> little but I thought the effort would be worth it.
> 
> I'm having a problem trying to link up a click signal from a button to
> a member function, I have a test app bellow to illustrate. I would
> like to tie the click event from "button" to the member function
> "PrintHello" in the instance "t1" of the "Testing" class.  Sorry for
> such a basic query just can't figure it out, all help, pointers, tips
> or links to any docs or mailing list posts I have missed all greatly
> appreciated.
> 
> Thanks in advance
> 
>      David.
> 
> =======================================================
> #include "pgapplication.h"
> #include "pgbutton.h"
> #include <iostream>
> 
> class Testing {
> public:
>         void PrintHello(PG_Button* b);
> };
> 
> void Testing::PrintHello(PG_Button* b){
>         std::cout << "Hello there \n";
> };
> 
> int main() {
> 
>     PG_Application app;
> 
>     app.LoadTheme("default");
> 
>     Testing t1();
> 
>     if(!app.InitScreen(800,600, 0, SDL_SWSURFACE)){
>         printf("Resolution not supported\n");
>         exit(-1);
>     }
> 
>     //
>     PG_Button button(NULL, PG_Rect(20, 20, 368, 72), "Testing");
> 
>     // button->sigClick.connect(slot(t1, &Testing::PrintHello));
> 
>     button.Show();
> 
>     app.Run();
> 
>     return EXIT_SUCCESS;
> };
> =======================================================
>




reply via email to

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