| Subject |
Re: timer class |
| From |
Mustansir Ghor <mustan31@hotmail.com> |
| Date |
Mon, 25 Jul 2022 04:07:24 -0400 |
| Newsgroups |
dbase.getting-started |
Dear Lee
Thank you. A valuable input to address the problem.
Best Regards
Mustansir
Lee Grant Wrote:
> Mustansir,
>
> Yes, the timer() object can be a pain, using it in and out of the IDE
> designer interface. Not sure who helped me with this, but it helps to do
> this.
>
> In my onOpen method, I check first if we are inDesign mode, and if so,
> the timer is disabled. The problem becomes that when we tweak in the
> designer and then run our form from the designer we tend to forget that
> this following code will not execute again. Therefor, I added a button
> to the form, that I click to disable the timer before I click for the
> dessigner to reopen the form for fixing in the designer. Here's my code
> in my onOpen method:
>
> > function form_onOpen()
> > if this.inDesign == true
> > this.timer := Null
> > this.timer.ontimer := Null
> > this.timer.enabled = false
> > return
> > else
> > this.timer = new Timer( ) // Make timer a property of the form
> > this.timer.parent = this // Assign form as timer's parent
> > this.timer.onTimer = this.updateClock // Assign method in form to timer
> > this.timer.interval = 2 // Fire timer every 2 seconds
> > this.timer.enabled = true // Activate timer
> > //shell(false)
> > endif
> > return
>
> And this is the code I use for a custom button on the form to remind me
> why I push that button when running the form. :)
>
> > this.STOPTIMER_PB = new LGCPUSHBUTTON(this)
> > with (this.STOPTIMER_PB)
> > onClick = class::STOPTIMER_PB_ONCLICK
> > onMouseOver = class::STOPTIMER_PB_ONMOUSEOVER
> > onMouseOut = class::STOPTIMER_PB_ONMOUSEOUT
> > height = 24.0
> > left = 709.0
> > top = 614.0
> > width = 107.0
> > text = "Stop Timer"
> > statusMessage = ""
> > speedTip = "This stops the Clock timer so we can go into Design mode"
> > endwith
> >
> >
> > function STOPTIMER_PB_onClick()
> > this.parent.timer.enabled := false
> > return
>
> This allows you to use the one form, instead of having to update two
> forms or forgetting which one you fixed. This way, all I have to
> remember is that before going into designer mode from run mode is to hit
> that stop button and then I can safely go into designer mode without the
> timer causing a problem. Couple that with Mervyn's explanation and you
> can find a way to work around the form giving you problems in and out of
> design mode when you use a timer class.
>
> Lee
>
>
> On 7/24/2022 2:28 PM, Mustansir Ghor wrote:
> > Dear Mervyn Sir
> >
> > I agree with your explanation and was aware of it but I am at development stage. Here on IDE i use design and run icons to test my form. So thought may be onDesign form event or somewhere I could close the form so that I dont get disrupted with the error.
> >
> > Yes as Andy says learning process never ends.
> >
> > Regards to all
> > Mustansir
> >
> > Mervyn Bick Wrote:
> >
> <snip>
>
|
|