Browse locator where you do not have to click the tab key

When I put a locator field on a browse I hate it that I have to click the tab-key to move the selector of the browse.

Field: Loc:Namelocator - Cstring - Options Setting: Immediate.

Right-click on the field - Embed ‘NewSelection’:

Update(?Loc:NameLocator)
CUS:Name = Loc:NameLocator
BRW1.ResetFromBuffer()

now when you begin typing in the locator field the selector moves while you type

3 Likes

Nice @pbouma! I suppose you need to be careful though if you have a really big table it might be slow to update.

(by the way, I am going to move this topic to tips category rather than here in docs. I think it works well as a tip!)

1 Like

Well, I have have build it in customers app browse for products. They have 29.000 products in it ( for my type of customers that are a lot of records) and that works fast.

1 Like

What I would like to know if it is possible to filter the browse on the chracters typed in

Compare the logic of the Incremental Locator with the Filter locator. I’m sure you can put it together from that.

This is standard behavior for the “filtered” locator and for the incremental locator as well.
But be aware that you DON’T CLICK on the search field before typing, just type when you’re in the browse, then the browse will react right away on what you type.

Many users see the search field (locator) and they will click on it and type, but then they need to use to Tab to go back to the browse and get a reaction. So don’t do that.

My locator fields have the SKIP attribute set, so it goes to the browse right away when the screen opens.

My (sql) browses start as page loaded header sort and a incremental locator. Incremental works great because it’s always sorted.

I believe you’ll find that you need to make sure that the IMM attribute is sent on the Entry control too.

I wrote: “now when you begin typing in the locator field the selector moves while you type” works for me, all those years. But, when the column (field) in the browse is a numeric (long)…it works different. When the field (column) is String it works like I wrote, but if it’s a long I have to fill the whole numeric value I search for.
for instance if I want to locate 30557 and type in 3 it does not jump to the first 3 and have to type the whole number 30557 before it jumps to that line in the browse
BTW the locator is a local field Cstring

If the number is always 5 digits you should be able to make it work by appending zeros to the right side of the string then convert to number.

I know I have done this for a Tax ID ( SSN, ITIN, FEIN) that is always 9 digits and was stored in a LONG. Type 4 and it locates on 400000000, type 46 and it locates on 460000000, 461 -> 461000000 etc

Carl,
by appending zeros to the right side of the string then convert to number. Sorry do not understand this. Adding zeros to the right? To what ?

Thanks

Nice, too bad it doesn’t work with AnyScreen. Maybe someone have idea how to make it work with AnyScreen?

Say your file had a Customer Number that was always 5 digits. Taking your code from your first post:

CUS:Number  DECIMAL(5,0)  !Always 5 digits, minimum value 10000
ENTRY(@s5),USE(Loc:NumberLocator),IMM 

Update(?Loc:NumberLocator)
CUS:Number = SUB(CLIP(Loc:NumberLocator) & '00000',1,5)  !Fill right side with zeros
BRW1.ResetFromBuffer()

If you type 3 so Loc:NumberLocator=‘3’ then CUS:Number = SUB(‘300000’,1,5) = 30000 and locate to 30000 not 00003.

My Super Browse templates include a DisplayLocator control template, which shows the current contents of the locator (whatever type you’re using). It’s most useful with Incremental and Filter. Your users don’t even have to click on the locator field: they can just type in the browse as they normal would do.

Carl: almost done :slight_smile: does not work completely
my CUS:Number is a LONG (@N_10) and the locator is a string 10.
please can you look at it one more time ? Thanks

For this to work the Number of Digits in the code has to be FIXED i.e. the code is always 5 digits or always 10 digits. Are you Customer numbers always 10 digits?

Or what numbers of digits are used?

Customernumber is a Long (@N_10) max 10 digits, but not always. Can be 20210001 etc
Does that mean it cannot work ?

If the length is not the same for all records it cannot work as I described. This works nicely for something like an SSN that is always 9 digits.

You could make it work as a filter comparing the number converted to a string by LEFT, but that would mean it would be reading a lot of records. I use Legacy so EXIT to filter out in ValidateRecord

CUS:Number  DECIMAL(10,0)
Loc:NumberLocator STRING(10)
Loc:NumberLength  BYTE
ENTRY(@s10),USE(Loc:NumberLocator),IMM 

!On Accepted or NewSelection calc the Length the user typed into a Len variable 
Loc:NumberLength  = LEN(CLIP(Loc:NumberLocator))

!Validate Record
IF Loc:NumberLength <> 0 |
AND LEFT(CUS:Number ,Loc:NumberLength) <> Loc:NumberLocator THEN EXIT.  Filter Out

In that code LEFT(CUS:Number ,Loc:NumberLength) changes the numeric variable to a string then takes the left side number of digits entered in locator put in Loc:NumberLength. The affect of typing ‘3’ is the filter keeps 3, 31, 321, 312345678 which the LEFT converts all to ‘3’.

Type ‘31’ and all Cus:Number are converted to Left 2 digits so 321 is ‘32’ and gets rejected, as does 3 which '3 ’ does not equal ‘31’.

That would read all, or a lot of records, to filter out a few which is undesirable with a big file on a network. If this was SQL and that code ran server code it might be ok, ask an SQL expert how to optimize.

2 Likes

Hi all, as i am new to the Clarion and this group as well, this is my first post on this group. I was going through the links posted here whenever i need more info, trust me i found very useful discussions and topics most of the time. Today i was referring for the LOCATOR topic/discussion for DATE field. I couldn’t get much clarity for DATE search. I am able to introduce LOCATOR for STRING and NUMERIC fields searches but not for DATE search. Would you please help me on how to design LOCATOR for DATE field. Thanks in advance.

Locator for date would be difficult for anything except an entry field. You need to override the default and use a local variable you add to the window.