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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset Incremental Locator on a Timer

Status
Not open for further replies.

PxTech

Programmer
Nov 29, 2006
3
US
I want to reset an incremental locator after a few seconds of inactivity. Any ideas?
 
You haven't said which template chain you're using, or anything like that. That said, try something like this.

Assuming you have a ,TIMER attribute on the window set to (aFewSeconds * 100)

CASE EVENT()
OF EVENT:TIMER
CHANGE(?Locator,'')
END

HTH,
Mark
 
Hi!

Mark's solution will work only if the Locator control is defined on the window. But if the Locator control is not there and you are using ABC, you need to identify the object name used by the browse which will be something like the one shown below :

BRW1::Sort0:Locator IncrementalLocatorClass

CASE EVENT()
OF EVENT:TIMER
IF (LastTime# - CLOCK()) > LocatorResetTime
BRW1::Sort0:Locator.Shadow = ''
OR
BRW1::Sort0:Locator.SetShadow('')
END
LastTime# = CLOCK()
END

Regards
 
Hi Shankar,

Yup, that's why we need to know some details about what environment he's using.

You code also brings up an important point, I cannot rely on the timer to only fire N seconds after the last keystroke into the locator, unless there is logic elsewhere to manipulate the timer. I wonder if the following logic would work 0{prop:timer}=0; 0{prop:Timer}=N * 100 If that doesn't work, then it makes sense to store LastKeyStroke=CLOCK() whenever the locator is updated. This in itself can present problems as there can be a number of places to insert that logic. As I think about it more, if there is a locator control and that control does NOT have the IMM attribute, then the timer based clearing logic should be made more complex to check not only the time of the last KNOWN keystroke but also the CONTENTS(?locator)

As an aside, I stongly recommend avoiding implicit variables (ones that end in # " or $). My primary reason is that the compiler can never catch spelling mistakes, it will simply create a new implicit for you. There are other technical reasons to avoid them as well.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top