Article View: comp.windows.interviews
Article #1515Callback Functions in 3.0b
From: Pamela Chan
Date: Sun, 23 Jun 1991 21:22
Date: Sun, 23 Jun 1991 21:22
61 lines
2400 bytes
2400 bytes
I'm a beginner in InterViews and I'm currently working with
InterViews 3.0b.
This is probably a silly question but I do want to know
the answer....
I'm trying to associate a callback funtion with a simple
push button. I was looking at the sample program <alert.c>
in the standard distribution. It works fine if I assigned
World::quit as the callback function, but anything else will
generate a compiler error:
/////////////////////////////////////////////////////////
class TestButton {
public:
TestButton(){};
~TestButton(){};
void Press(){
fprintf (stderr, "Test button pressed\n");
};
};
declare(ActionCallback, TestButton)
implement(ActionCallback, TestButton)
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),
new ChoiceItem(
new Bevel(new Margin(new Label("Test", f, fg), 3.0),
new Outset(color)),
new Bevel(new Margin(new Label("Test", f, fg), 3.0),
new Inset(color))
)
);
========================================================
"main.c", line 31: error: bad argument list for
TestButton_ActionCallback::TestButton_ActionCallback()
(no match against any TestButton_ActionCallback::TestButton_ActionCallback())
1 error
/////////////////////////////////////////////////////
I'm not sure what's declare() and implement() and
I'm only following the example blindly.
Can anyone explain to me what's wrong with my callback function?
Thanks.
------------------------------------------------------------------------
Pamela Chan International Computer Science Institute
chan@icsi.berkeley.edu 1947 Center Street, Berkeley, CA
Technical Details
Message-ID:
<CHAN.91Jun23132258@icsid2.comp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!agate!agate.berkeley.edu!chanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!agate!agate.berkeley.edu!chan From: chan@icsid2.comp (Pamela Chan) Newsgroups: comp.windows.interviews Subject: Callback Functions in 3.0b Message-ID: <CHAN.91Jun23132258@icsid2.comp> Date: 23 Jun 91 21:22:58 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Distribution: comp Organization: /n/icsid/db/u/chan/.organization Lines: 61