# Easy Peasy Top of the List

**URL:** <https://clarionhub.com/t/easy-peasy-top-of-the-list/7041>\
**Category:** questions\
**Tags:** browse\
**Created:** [March 19, 2024, 12:19am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041 "2024-03-19T00:19:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisHargett](https://clarionhub.com/user_avatar/clarionhub.com/chrishargett/32/2413_2.png) [@ChrisHargett](https://clarionhub.com/u/ChrisHargett)\
**Post date:** [March 19, 2024, 12:19am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/1 "2024-03-19T00:19:20Z")

</div>

Some things just annoy me and I think it should annoy my users. This doesn't, but it's annoying me.

I have a browse B that is dependent on browse A (standard ABC BrowseClass). When I make a selection in Browse A, the Browse B list populates properly, sorts properly, but about half the time, the last line in the Browse B list is selected instead of the first line. I could spend an hour or two trying to determine what the problem is, but it has to be something simple. What am I missing?

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 19, 2024, 12:48am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/2 "2024-03-19T00:48:00Z")

</div>

You can give this a try. I wrote it more than 23 years ago 🙂

Used it quite a bit back when I used appgen.

[jsbrowsec55.zip](https://clarionhub.com/uploads/short-url/5D4dsgDSIsIuD8kW2W452S2P6GE.zip) (2.2 KB)

Here’s the readme:

**Real Parent/Child Listboxes for ABC.**

Currently in ABC, there is no built-in way to relate a  
particular “Parent” browse with its “Child” browse(s).  
When a parent browse is scrolled, the child browse does  
change the displayed records, but instead of resetting  
selector bar to the top, it tries to find the “closest”  
to the previously selected record. This behavior often  
might be desirable in some cases, but when it is a child  
browse, it should be re-set (in my opinion).

This enclosed derivation of the ABC BrowseClass class  
allows a parent browse to keep track of it’s children  
so that they can be properly reset upon the scrolling  
of the parent browse. It also handles the enabling/disabling  
of the child browse’s INSERT button if there are no records  
in the parent browse.

!Installation-------------------------------------------

1. Copy JSbrowse.inc and JSBrowse.clw to the libsrc directory. (in C7+, use \Clarion\Accessory\Libsrc\win)
2. Refresh the ABC headers or close/restart CW.

!Implementation-----------------------------------------

1. For a “PARENT” browse, uncheck “Use Default ABC Browse” in the  
browse class properties, and set the class to “JSBrowseClass”

2. In the embeditor, after the browses initialize, put this:

YourParentBrowse.AddItem(AChildBrowse)  
YourParentBrowse.AddItem(AnotherChildBrowseIfYouHaveOne,0)!Pass a zero like this if you don’t want the child browse to be disabled if there are no records in the parent browse.  
YourParentBrowse.AddItem(YetAnotherChildBrowseIfYouHaveOne)  
!Add more if you need

!That’s It-----------------------------------------------

1. Compile and go.

---

<div class="post-metadata">

**Author:** ![ChrisHargett](https://clarionhub.com/user_avatar/clarionhub.com/chrishargett/32/2413_2.png) [@ChrisHargett](https://clarionhub.com/u/ChrisHargett)\
**Post date:** [March 19, 2024, 1:18pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/3 "2024-03-19T13:18:48Z")

</div>

Thanks, Jeff! It’s comforting to know that it’s a common problem and that I’m not a complete idiot. But I am looking for a easy peasy solution. Something like clear the file record and do a ResetFromFile method call somewhere.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 19, 2024, 2:41pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/4 "2024-03-19T14:41:51Z")

</div>

If you read the code, you can see what it does on line 56. 🙂

But there are things you need to keep track of, which this class does. It’s much easier to just do what the notes say than fart around with this stupid issue for days, like I did.

But I’d love to see a one liner and/or property that someone uses.

---

<div class="post-metadata">

**Author:** ![totalhip](https://clarionhub.com/user_avatar/clarionhub.com/totalhip/32/1477_2.png) [@totalhip](https://clarionhub.com/u/totalhip)\
**Post date:** [March 19, 2024, 2:51pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/5 "2024-03-19T14:51:40Z")

</div>

> [@jslarve](#):
>
> I wrote it more than 23 years ago:  
> Currently in ABC, there is no built-in way to relate a  
> particular “Parent” browse with its “Child” browse(s).

A 23 year old recognized problem in ABC that SV hasn’t manage to fix even with an available public solution?

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 19, 2024, 3:36pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/6 "2024-03-19T15:36:03Z")

</div>

Not sure how you’re getting there from here. Maybe nobody asked them for it.

---

<div class="post-metadata">

**Author:** ![totalhip](https://clarionhub.com/user_avatar/clarionhub.com/totalhip/32/1477_2.png) [@totalhip](https://clarionhub.com/u/totalhip)\
**Post date:** [March 19, 2024, 4:23pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/7 "2024-03-19T16:23:12Z")

</div>

> [@jslarve](#):
>
> Maybe nobody asked them for it.

Oh, that could well be the case. Nevertheless, it is an example of a problem that has repeatedly come up over the years and a general fix, most likely welcomed by developers using ABC, just never happened. I haven’t any doubt the same is true for several other ABC problems as well. No person to blame, just an observation regarding a flawed process.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 19, 2024, 6:36pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/8 "2024-03-19T18:36:30Z")

</div>

Thanks for the valuable and positive input.

---

<div class="post-metadata">

**Author:** ![PurpleEdge2214](https://clarionhub.com/user_avatar/clarionhub.com/purpleedge2214/32/5109_2.png) [@PurpleEdge2214](https://clarionhub.com/u/PurpleEdge2214)\
**Post date:** [March 20, 2024, 12:59am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/9 "2024-03-20T00:59:16Z")

</div>

In Event:NewSelection for the Parent browse…

```
  IF NotFirstTime
   FREE(Queue:ChildBrowse)
  ELSE
    NotFirstTime = TRUE
  END  

```

I think it was Jim Kane who suggested this solution last century?

Can probably be made a one-liner if you can find the right embed to FREE(Queue:ChildBrowse), I couldn’t after a quickish look.

---

<div class="post-metadata">

**Author:** ![ChrisHargett](https://clarionhub.com/user_avatar/clarionhub.com/chrishargett/32/2413_2.png) [@ChrisHargett](https://clarionhub.com/u/ChrisHargett)\
**Post date:** [March 20, 2024, 1:19am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/10 "2024-03-20T01:19:16Z")

</div>

I cobbled together Jeff Slarge and your solutions into the following code. Jeff’s code “on line 56” worked, but not the first time through. Here’s my Easy Peasy solution. I don’t like the idea of using the static variable, though.

```auto
IncomingTextsBrws.TakeNewSelection PROCEDURE
FirstTime Byte(1),static
  CODE
  IF FirstTime THEN 
     FirstTime = False
  ELSE
     EmployeeTextBrws.ListQueue.Free
     EmployeeTextBrws.Reset()  
  end
  
  PARENT.TakeNewSelection

```

---

<div class="post-metadata">

**Author:** ![vitesse](https://clarionhub.com/user_avatar/clarionhub.com/vitesse/32/837_2.png) [@vitesse](https://clarionhub.com/u/vitesse)\
**Post date:** [March 20, 2024, 2:53am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/11 "2024-03-20T02:53:38Z")

</div>

> [@ChrisHargett](#):
>
> I don’t like the idea of using the static variable, though.

if you use a static like that it is best to make it threaded:

```auto
FirstTime Byte(1),static,thread

```

---

<div class="post-metadata">

**Author:** ![Flavio\_Suarez](https://clarionhub.com/user_avatar/clarionhub.com/flavio_suarez/32/1347_2.png) [@Flavio\_Suarez](https://clarionhub.com/u/Flavio_Suarez)\
**Post date:** [March 20, 2024, 11:20am UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/12 "2024-03-20T11:20:42Z")

</div>

Using it from C5.5 to C11!!  
Helps a lot!

---

<div class="post-metadata">

**Author:** ![totalhip](https://clarionhub.com/user_avatar/clarionhub.com/totalhip/32/1477_2.png) [@totalhip](https://clarionhub.com/u/totalhip)\
**Post date:** [March 20, 2024, 12:09pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/13 "2024-03-20T12:09:48Z")

</div>

> [@jslarve](#):
>
> Thanks for the valuable and positive input.

Okay, perhaps a better rephrasing of my original question and worthy of a discussion elsewhere in order to actually be valuable & positive. How do simple fixes, such as yours or whatever comes from this thread, to long standing ABC problems get incorporated into the shipping classes? It seems wrong that a widely recognized problem from 23 years ago is still around.

---

<div class="post-metadata">

**Author:** ![ChrisHargett](https://clarionhub.com/user_avatar/clarionhub.com/chrishargett/32/2413_2.png) [@ChrisHargett](https://clarionhub.com/u/ChrisHargett)\
**Post date:** [March 20, 2024, 1:35pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/14 "2024-03-20T13:35:06Z")

</div>

It’s not quite working right. If you click on a line in the parent browse, it works. If you click on the same line again, the child browse empties and doesn’t reload. If you double-click, the same thing happens. Hmmmmm. 🤔

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 20, 2024, 1:57pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/15 "2024-03-20T13:57:31Z")

</div>

> [@jslarve](#):
>
> It’s much easier to just do what the notes say than fart around with this stupid issue for days, like I did.

Welcome to the “farting around for days” that I spoke of. 🙂

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 20, 2024, 2:55pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/16 "2024-03-20T14:55:52Z")

</div>

I forget exactly what was going on when I wrote it, but notice that my class is not using TakeNewSelection. For whatever reason, I had determined that keeping track of the ViewPosition was the best way to know if we should free the queue. This was done in the UpdateWindow method, after the parent call.  
So maybe if you just declare a Save:ViewPosition, you can do something like my UpdateWindow code, without the extra stuff.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [March 20, 2024, 3:09pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/17 "2024-03-20T15:09:28Z")

</div>

> [@jslarve](#):
>
> This was done in the UpdateWindow method, after the parent call.

Whoops. Got that wrong. Sorry. It was UpdateBuffer BEFORE parent call.

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/f/f9b13188b7c460ba7f0d5e5ce792866c2da277a7.png)

---

<div class="post-metadata">

**Author:** ![ChrisHargett](https://clarionhub.com/user_avatar/clarionhub.com/chrishargett/32/2413_2.png) [@ChrisHargett](https://clarionhub.com/u/ChrisHargett)\
**Post date:** [March 20, 2024, 6:17pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/18 "2024-03-20T18:17:18Z")

</div>

After a bit of trepidation, I went with Jeff’s original solution. It works great! Thanks, Jeff. I got tired of fartin around. 🙂

---

<div class="post-metadata">

**Author:** ![FoucheRabie](https://clarionhub.com/letter_avatar_proxy/v4/letter/f/7cd45c/32.png) [@FoucheRabie](https://clarionhub.com/u/FoucheRabie)\
**Post date:** [October 2, 2024, 1:12pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/19 "2024-10-02T13:12:59Z")

</div>

Greetings,  
How would one implement this non-fartin method on a DropList?

1. DropList selects the Building, then…
2. Browse show all the DATEs, rooms, Availability

Most of the time the LAST DATE is selected, which is at bottom of the Browse.  
The user has to navigate back to the top.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [October 2, 2024, 1:24pm UTC](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041/20 "2024-10-02T13:24:27Z")

</div>

In the DropList, in TakeNewSelection, or EVENT:Selected (after parent call) try:

```Clarion
YourBrowseLabel.Free
YourBrowseLabel.Reset

```

[Next page](https://clarionhub.com/t/easy-peasy-top-of-the-list/7041.md?page=2)
