GIDForums

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Mar-2008, 15:24
ehump20 ehump20 is offline
New Member
 
Join Date: Mar 2008
Posts: 1
ehump20 is on a distinguished road

Trouble with Fl::add_timeout


I'm having trouble with Fl:add_timeout doing what I want to do.

CPP / C++ / C Code:
void callback(void*) {
      puts("TICK");
      Fl::repeat_timeout(1.0, callback);
    }

    int main() {
      Fl::add_timeout(1.0, callback);
      return Fl::run();
    }

Whenever I put the Fl::add_timeout in the same file as main like the code above, it works just fine and the callback can do whatever I want. However, whenever I create a different class and try to put fl::add_timeout in the functions, I get errors saying the callback needs to be static. So I do this:

CPP / C++ / C Code:
static void myClass::callback(void*) {
      //Want to perform actions here
    }

void myClass::doSomething(){
Fl::add_timeout(3.0,callback);
}  

However, because callback is now static, I cannot call other functions within the class, which is want I want to do. Is there any way I can do this?
Last edited by admin : 03-Mar-2008 at 05:06. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #2  
Old 03-Mar-2008, 05:37
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,102
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough

Re: Trouble with Fl::add_timeout


Try out the information in this thread and see if it will help.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
 

Recent GIDBlogNew Corolla Altis, 10th Generation - Part I by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble displaying table graph zerrigan CPP / C++ Forum 0 10-Apr-2007 20:40
Trouble with a linked list... Mararia CPP / C++ Forum 1 22-Jan-2007 12:53
feof() trouble Lewk of Serthic C Programming Language 5 14-Sep-2005 23:43
C programming trouble Newworld C Programming Language 8 12-Sep-2004 23:06
Having trouble trying to format C: Nickster64 Computer Software Forum - Windows 2 27-Jul-2004 07:31

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 12:50.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.