On Oct 11, 2006, at 7:30 PM, Murray Lesser wrote:

I'm very new at OOP, but I've been using BASIC since early DOS days. I've been using an attempt to port one of my early "interactive" programs to Rb. Logically, the way to handle a portion that runs a sequence of "Beeps" at half-second intervals is to use a timer, but I can't figure out how associate the timer with a menu handler, which is the easy way to initiate this part of the task. If I knew how to initiate a hidden new window with the menu handler, I think this would solve my problem, but I don't.

There are several ways to handle this, but the easiest is to use the MenuHandler set the state of the Timer. If you want to disable the beeps, you would set the Timer.Mode to 0, but if you want to turn them on, you would set the Timer.Mode to 2 (repeating task).

Another option is to have the timer run all of the time, but use the MenuItem to set properties in a Module or in the App class. Then the timer would code would be something like this:

  If EnableSoundBeeps Then
    // play beep
  End If

Your MenuHandler would look something like this:

Function SoundEnableBeeps() As Boolean
  SoundEnableBeeps.Checked = Not SoundEnableBeeps.Checked
  App.EnableSoundBeeps = Me.Checked
  Return True
End Function

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to