www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/17/05:18:16

From: William Heymann <heymann AT ucsu DOT colorado DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Member functions of objects as parameters for other functions?
Date: Wed, 16 Jul 1997 12:35:17 -0400
Organization: Netcom
Lines: 31
Message-ID: <33CCF845.38AF@ucsu.colorado.edu>
NNTP-Posting-Host: tac-wa4-01.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I am using Degui and one of its functions allows me to pass a function
as an arguement to it. I was wondering how do I pass a class's member
function to it. This library is used as a C++ interface to the Allegro
dialog objects. The set_click_callback tells the computer that when the
button is bushed it calls the appropriate function.


BallS balls;

   // Object definitions - DEGUI 1.0 beta
   shadow_box_object object_4;
   button_object object_0("Probability Simulation",0,true);
   
   // Add Objects to the dialog
   dialog menu;
   menu.add(object_4,80,80,460,330,15,16);
   menu.add(object_0,100,100,420,30,15,16);
   
   This is what the set_click_callback function looks like. How can I
modify it to             take an objects member function like I have
shown below.
   void set_click_callback     (int(*callback)(void)) { click_callback =
callback; };
   


   object_0.set_click_callback(balls.start);
   
   Error: bad argument 1 for function `void
dialog_object::set_click_callback(int (*)())' (type was int
(BallObjectArray::)())

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019