# SOLVED: Question About Browse EVENT:ScrollDown and Alert Key

**URL:** <https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777>\
**Category:** questions\
**Tags:** browse\
**Created:** [December 23, 2024, 5:17pm UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777 "2024-12-23T17:17:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [December 23, 2024, 5:17pm UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/1 "2024-12-23T17:17:10Z")

</div>

Hello Everyone,

I'm using this code when an alert key is pressed:

```auto
If ThisWindow.Run(1,ChangeRecord) = RequestCompleted
	IF BRW4::NoScrollDown
		BRW4::NoScrollDown = False
	ELSIF KEYCODE() <> MouseRight
		POST(EVENT:ScrollDown,?ListCostItems)
	END
End

```

The code does what I want in that the update form is called and the browse row moves to the next record. However, if I try to press the alert key again, the alert key event does not fire. I have to manually click on the browse to get the alert key event to fire.

I'm guessing perhaps there's a browse reset or window method I need to call.

Thank you!!

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [December 24, 2024, 1:24am UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/2 "2024-12-24T01:24:22Z")

</div>

Im guessing here but;

Assuming the Alert is tied to the vontril, not the Window, your problem is Focus.

When you return from the Form the List Control does not have focus. So pressing the key does nothing. Clicking on the control gives it focus.

You coukd either alert the key at the Window level, or add a SELECT to your code to set the focus on return from the form.

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [December 24, 2024, 1:32am UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/3 "2024-12-24T01:32:12Z")

</div>

Thank you Bruce.

I’ve Tried SELECT(?ListCostItems,Choice(?ListCostItems)), after EVENT:ScrollDown, to no avail.

Basically, my client wants to iterate through the browse one row at a time with the ability to Alert(F2Key) along the way with F2 calling the update form.

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [December 24, 2024, 2:12am UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/4 "2024-12-24T02:12:44Z")

</div>

Have you tried Alerting F2 at the Window level, not the Control level?

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [December 24, 2024, 3:08am UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/5 "2024-12-24T03:08:09Z")

</div>

Yes sir. It’s been window level from the start.

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [December 24, 2024, 4:32am UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/6 "2024-12-24T04:32:45Z")

</div>

I suspect you’re missing something - some detail you’ve overlooked. If the key is Alerted at the window level, then you’ll get the Event at the window level when the key is pressed. I suggest you chase that a bit to see who is “swallowing” it (likely via an Event:PreAlertKey)

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [December 24, 2024, 8:47pm UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/7 "2024-12-24T20:47:47Z")

</div>

> [@Bruce](#):
>
> suggest you chase that a bit to see who is “swallowing” it (likely via an Event:PreAlertKey)

A Sub class procedure would show that.

---

<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:** [December 26, 2024, 1:28am UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/8 "2024-12-26T01:28:46Z")

</div>

Yeah, move your alert key from the window to the browse.

In the embed for the browse alertkey place…

```auto
IF KEYCODE() = F2Key
  POST(Event:Accepted,?YourBrowseUpdateButton)
END

```

In the embed for immediately after the call to your update procedure, place…

```auto
ThisWindow.Run PROCEDURE(USHORT Number,BYTE Request)

ReturnValue BYTE,AUTO

! Start of "WindowManager Method Data Section"
! [Priority 5000]

! End of "WindowManager Method Data Section"
  CODE
  ! Start of "WindowManager Method Executable Code Section"
  ! [Priority 2500]
  
  ! Parent Call
  ReturnValue = PARENT.Run(Number,Request)
  ! [Priority 6000]
  
  IF SELF.Request = ViewRecord
    ReturnValue = RequestCancelled                        
  ELSE
    GlobalRequest = Request
    UpdateStudents ! YOUR update procedure
    ReturnValue = GlobalResponse
  END

```

! [Priority 8500]  
  
**IF Request = 2 AND ReturnValue = RequestCompleted  
POST(EVENT:ScrollDown,?Browse:1) ! YOUR BROWSE LIST CONTROL  
END**

```auto
  ! End of "WindowManager Method Executable Code Section"
  RETURN ReturnValue

```

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [December 26, 2024, 5:28pm UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/9 "2024-12-26T17:28:26Z")

</div>

> [@donridley](#):
>
> I’m using this code when an alert key is pressed:
> 
> ```auto
> If ThisWindow.Run(1,ChangeRecord) = RequestCompleted
> ...
> End
> 
> ```

Rather than calling `ThisWindow.Run(1,ChangeRecord)` in the Alert Key Event I would try to run the Change button code so all the Browse refresh happens as normal. You just need a Local variable Flag. I’ll take some of Purple Edge’s code.

In the embed for the Alert Key Event:

```clarion
IF KEYCODE() = F2Key |
AND ~?ChangeButton{PROP:Disable} THEN !if no records its Disabled
    MoveDownF2 = True
    POST(Event:Accepted,?ChangeButton)
END

```

In the Embed for the Change button after the Update check if the F2 Move Down flag is True and do your code. This way .Update() runs all the Browse Refresh code:

```clarion
 OF ?ChangeButton
    ThisWindow.Update() !<--- Generated
    ! [Priority 8500]
    IF MoveDownF2 = True THEN 
       MoveDownF2 = False
      ... your code to move down ...
    END 

```

This will always Move Down even if the user cancels. I think that’s ok. If you want to prevent that then at the end of ThisWindow.Run() check for Cancel:

```clarion
 IF Request = 2 AND ReturnValue <> RequestCompleted
    MoveDownF2 = False
 END

```

* * *

Another approach to consider is instead of using an Alert Key set the attribute `KEY(F2Key)` on the Change button. That will make F2 press the Change button where you can check for F2

```clarion
 OF ?ChangeButton
    IF KEYCODE()=F2Key THEN MoveDownF2 = True.

    ThisWindow.Update() !<--- Generated

    ! [Priority 8500]
    IF MoveDownF2 = True THEN 
       MoveDownF2 = False
      ... your code to move down ...
    END 

```

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [January 4, 2025, 10:52pm UTC](https://clarionhub.com/t/solved-question-about-browse-event-scrolldown-and-alert-key/7777/10 "2025-01-04T22:52:00Z")

</div>

Solved!

This turned out to be a Noyantis DockingPanes issue.

So in the parent window that contains the DockingPanes OLE control,EVENT:GainFocus,I had to call this method:

`DockingPane5.GainFocusChildWindow('ChildPaneID')`

Then, in the window inside the docking pane,EVENT:GainFocus, I made a call to this Win32 API:

`SetFocus(HWND hwnd), LONG, PROC, PASCAL, NAME('SetFocus')`

with the focus being set on the browse.
