Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put timer that does not affect the textbox valid event? 2

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
578
0
16
PH
Hi everyone... i have put a timer in my main form that has an interval of one second, (i have put a digital clock in my main form) that a pageframe is present, and in the page one there is a text.valid event. My problem is... the input in my valid event is affected everytime a clock resets and shows new time. Is there a way that text1.valid input is not affected when putting a clock? May i have your thoughts please... Thanks and God bless....
 
Mandy,

I might not have understood this correctly, but it sounds as if you need to disable the time while the Valid is in progress. If that's right, you should put this at the start of the Valid: [tt]THISFROM.MyTimer.Enabled = .F.[/tt] And then [tt]THISFROM.MyTimer.Enabled = .T.[/tt] just before you exit the timer.

Or perhaps you need to disable the timer for the whole time that the textbox has focus? In that case, you should disable it in the textbox's GotFocus, and re-enable it in the LostFocus.

If this doesn't answer your question, perhaps you could explain the scenario a little more carefully.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Maandy, what are you doing in the timer? if you set focus to something, then this would cause the valid event in any control that currently has focus, and then you have to avoid that. Just for example set a label.caption to the current time, the display happens without setting focus to anything.

Chriss
 
Hi... Mike you have understood it well actually.. its exactly what i need...
Chriss... I've put it actually in the label... and its working fine now...
You always give me a very good sugesstions and answers...
Thank you and God bless....
 
Good, Mandy.

While I'm all in for data binding, and a label can't be bound to data, the clock surely is readonly and therefore a label is justified and sufficient to display it. And it won't remove the focus from anything, I mean technically from other controls. I consider you don't show the seconds portion of the time, though, as a ticking clock can be distracting. Unless you have a good reason for the user to see time elapsing.

You could also show the status bar and then simply do SET CLOCK STATUS, which shows a clock in the lower right, but it'll also show seconds.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top