[Y-devel] Sample program/signals help

Mark Thomas mark at www.y-windows.org
Thu Feb 26 20:22:21 GMT 2004


James Harr wrote:
> 
> I've been trying to add a couple signal calls to provide more of an example in 
> the sample program.
> 
> I've inserted this code in main() after their respective grid->addWidget 
> lines:
>   samplebutton -> clicked.connect (bind 
>           (slot (this, &Sample::buttonClicked)) );
>   samplecheckbox -> clicked.connect (bind
>           (slot (this, &Sample::checkboxChanged)) );
> 
> As well as these two functions:
> /********SNIP********/
> void Sample::buttonClicked ()
> {
>     cout << "Button pressed" << endl;
> }
> void Sample::checkboxChanged ()
> {
>     cout << "Checkbox changed" << endl;
> }
> /********SNIP********/

Checkbox "changed" signals have a bool parameter saying what the new 
value is.

In the declarations, it looks like:

   SigC::Signal1<void, bool>
                  |      |
     +------------+      +-+     which maps like this
     |                     |
   void checkboxChanged (bool)

Regards,

   Mark.
-- 
|| Mark Thomas
|| www.y-windows.org
||
||



More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved