Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!sgi!shinobu!fido.asd.sgi.com!marktwain.rad.sgi.com!linton From: linton@marktwain.rad.sgi.com (Mark Linton) Newsgroups: comp.windows.interviews Subject: Re: Callback Functions in 3.0b Message-ID: <1991Jun24.161307.2804@fido.asd.sgi.com> Date: 24 Jun 91 16:13:07 GMT References: Sender: news@fido.asd.sgi.com (Usenet News Admin) Reply-To: linton@marktwain.rad.sgi.com (Mark Linton) Distribution: comp Organization: sgi Lines: 25 In article , chan@icsid2.comp (Pamela Chan) writes: |> I'm trying to associate a callback funtion with a simple |> push button. I was looking at the sample program |> in the standard distribution. It works fine if I assigned |> World::quit as the callback function, but anything else will |> generate a compiler error: |> |> Glyph* MakeControlPanelDialog(Font* f, Color* fg, TestButton* tbutton) { |> |> Button* button1 = new Button( |> |> // *******error occurs here********** |> new ActionCallback(TestButton) (&tbutton, TestButton::Press), |> |> // replace the above line with the following and it works fine |> // new ActionCallback(World) (&world, &World::quit), |> |> "main.c", line 31: error: bad argument list for |> TestButton_ActionCallback::TestButton_ActionCallback() |> (no match against any TestButton_ActionCallback::TestButton_ActionCallback()) |> 1 error The problem is you pass ``&tbutton'' instead of ``tbutton''. The constructor wants a pointer to a TestButton (or more generally the callback receiver type). The alert program uses ``&world'' because world is declared as an object instead of a pointer.