Reset Incremental Locator in Legacy

CW8, Legacy

I want to use a button to reset an Incremental Locator on a browse and cannot get it to work properly. The Incremental Locator piece works just fine, records are located and user can backspace to edit the locator. I am using a local variable (LOC:SearchPhrase) to capture the input.

I have a button to clear the variable, and it does so, but after doing so, the browse will not accept anymore input for a different search. I have been trying several things (after looking at Source) but cannot find what to do. The SET/NEXT was out of desperation. Here’s the things I have ben trying to no avail (not all used at same time):

BUTTON EMBED (POST EVENT HANDLING):

CLEAR(LOC:SearchPhrase) 
SET(PAR:Key_Word_File_RecordID,1) ; NEXT(ParsedWords)
DO RefreshWindow
!DISPLAY

!BRW1::Sort1:LocatorValue = LOC:SearchPhrase

!PAR:ParsedWord = LOC:SearchPhrase
!DO BRW1.ResetFromBuffer()

!DO BRW1::LocateRecord 

!DO BRW1::RefreshPage

!SELECT(?Browse:1)
!SELECT(?LOC:SearchPhrase)

Any ideas?

Not sure of Legacy, but ABC it’s also a bit complicated and not intuitive. There a property of the locator class called ‘Hidden’ or something like that (It’s been a while) you need to clear that because that what is actually used by the browse.

Don’t the Up/Down keys clear the locator?

Thanks for the responses - I fudged (I think) something based on your responses. It seems like there should be a more direct way to work with the Incremental search template code, but I could not decipher it.

Regarding pressing the UpArrow, yes, that does reset the search parameter (I didn’t know that), but the audience will be one time users of the app and it would be easier to have them press a button to reset.

This is what finally worked:

SELECT(?Browse:1)    ! refocuses to the Browse being searched
PRESSKEY(UpKey)

I changed templates to generate this Routine to clear the Locator variables.

BRW1::ResetLocator ROUTINE   !DscBrw - Clear Locator Value, DecSys Custom
!|
    CASE BRW1::SortOrder
    OF 1
      BRW1::Sort1:LocatorValue = ''
      BRW1::Sort1:LocatorLength = 0
      VENMST:AutoNo = BRW1::Sort1:LocatorValue
    OF 2
      BRW1::Sort2:LocatorValue = ''
      BRW1::Sort2:LocatorLength = 0
      VENMST:VendorNo = BRW1::Sort2:LocatorValue
    OF 3
      BRW1::Sort3:LocatorValue = ''
      BRW1::Sort3:LocatorLength = 0
      VENMST:SortName = BRW1::Sort3:LocatorValue
    END
    DISPLAY

This gets done

  1. In Event:Selected for Browse
  2. In BRW1::ProcessScroll Routine after DO BRW1::PostNewSelection

To recap that is #1 if the Browse takes focus (so was clicked on, or tabbed to, or tab changed); and #2 if the user Scrolls the Browse with Arrows, Page Keys, etc.

2 Likes