2 Timers... Safe?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/02/2011 at 08:24, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10+ 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hey all,

    Just curious if running 2 identical timers simultaneously is safe to do.  I have a timer in a MessageData class and have been forced to use another in a GeDialog.  Both timers tick by at exactly the same interval.  I tried to get around this by trying to get the message from my MessageData to the dialog, but I haven't had any luck doing that.

    If this isn't a safe thing to do, does anyone know a way to get a message from a MessageData class to a dialog?  Even if having this second timer running is relatively safe, I'd still like to know if this is possible... I've already had some issues with timers in the past, so I'd feel better not having to use the Timer function of the GeDialog class if I can avoid it.

    thanks!
    -kvb



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/02/2011 at 03:27, xxxxxxxx wrote:

    I'm not sure about two timers but I suppose you could send a SpecialEventAdd() from the MessageData. This will result in a CoreMessage which you can catch in every dialog.

    Something like this:

      
    class MyMessage : public MessageData  
    {  
      public:  
          virtual LONG GetTimer(void);  
          virtual Bool CoreMessage(LONG id, const BaseContainer& bc);  
    };  
      
    LONG MyMessage::GetTimer()  
    {  
      return 1000;  
    }  
      
    Bool MyMessage::CoreMessage(LONG id, const BaseContainer &bc)  
    {  
      if (id == MSG_TIMER)  
      {  
          SpecialEventAdd(1024558, 0, 0); //send your own unique ID  
      }  
      
      return TRUE;  
    }  
    

    in the dialog:

      
    Bool MyDialog::CoreMessage(LONG id, const BaseContainer& msg)  
    {  
      if (id == 1024558)  
      {  
          //do something  
      }  
        
      return TRUE;  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/02/2011 at 13:58, xxxxxxxx wrote:

    Matthias... you are my hero!  How could I forget about SpecialEventAdd!  Working perfectly:)

    thanks again!
    -kvb


Log in to reply