You could try using FindDragTarget
procedure TForm1.Memo1MouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
var cntrl:tcontrol;
begin
cntrl:=tcontrol(FindDragTarget(Mouse.CursorPos,true));
if cntrl is tmemo then
begin
if cntrl.Name='Memo1' then
begin
memolab.caption:='Memo1 MouseWheelDown MousePos X:= '+inttostr(mousepos.X);
end;
end;
end;
example proj attahed
Thanks Josh. This worked... Kind of.
Yes, it worked while the mouse was in the memo control. But while outside the control but inside the form, then it does nothing. The edit box stays empty. That's pretty much the opposite of what I want. Don't get me wrong, you made it so it separates what happens depending on the mouse location. And I'm looking to do that, But it needs to behave as normal while in the Memo and run my code while outside the Memo.
Here's what I'm looking for: Since the Memo box automatically scrolls up and down when the text is more than the Memo can hold, I want it to keep doing that. But when you roll the mouse wheel outside the Memo box, I want it to do something (I'll write that code later) while outside the Memo box.
Kind of like the forum here. As I typed my original post, I can scroll up and down inside the white box. But the box stays in the same position (on the screen). So while the box is 11 lines tall, I can scroll through 30, 50, or however many lines the text has without moving the box. But while the mouse is outside, then the Memo box no longer scrolls, but the entire webpage does. And thus, I can see all the other comments.
Let me also give you what my goal is to code. It's like an industry specific glossary of terms. Or a list of chemical constants. Or astronomical definitions. In the Edit box will appear the term or constant they're looking for and in the Memo will appear the definition or value of the constant. So since some definitions can be kind of lengthy, when they show up in the Memo box, I can scroll up and down to read the entire definition. But if I'm wheeling the mouse outside the Memo box, then I want it to scroll through the terms and constants. So that's why I was looking to separate them.
Since the terms are going to be in a record, I imagine the record to be:
type
TLog = Record
Term : String;
Definition : Array [1..10] of String;
end;
So, inside the Memo box, it scrolls up and down the definition and outside the Memo box it goes up and down the Terms in the Edit box (and therefore the definitions in the Memo box).