How to make the TScollBox automatically scroll when DragMode is dmAutomatic?
I have a ScrollBox in which I have a GridPanel in which I have Buttons.
I set DragMode to dmAutomatic for all buttons so I can move the buttons around (drag and drop).
But I have a problem: because the GridPanel is larger than the ScrollBox, the ScrollBox has the vertical scrollbar visible. I want to make the ScrollBar to automatically scroll down so I can drop a bottom from the visible (top) rows into the inaccessible rows at the bottom (this is typical behavior for all Windows programs, right?)
I have simple code that is doing this: In MouseMove I detect when the mouse is getting close to the bottom of the ScrollBox and I adjust ScrollBox.VertScrollBa.Position to scroll down. This works ONLY if I am NOT in "drag and drop" mode (if I am not dragging a button).
If I start a drag and drop operation NO mouse events are fired.
What can I do to receive MouseMove event even if I am in "drag and drop" mode?
A solution would be not to use dmAutomatic and implement my own drag and drop alternative (based on mousedown, mousemove, mouseup). Is these a quicker fix?
delphi mouseevent c++builder onmouseover
|
show 1 more comment
I have a ScrollBox in which I have a GridPanel in which I have Buttons.
I set DragMode to dmAutomatic for all buttons so I can move the buttons around (drag and drop).
But I have a problem: because the GridPanel is larger than the ScrollBox, the ScrollBox has the vertical scrollbar visible. I want to make the ScrollBar to automatically scroll down so I can drop a bottom from the visible (top) rows into the inaccessible rows at the bottom (this is typical behavior for all Windows programs, right?)
I have simple code that is doing this: In MouseMove I detect when the mouse is getting close to the bottom of the ScrollBox and I adjust ScrollBox.VertScrollBa.Position to scroll down. This works ONLY if I am NOT in "drag and drop" mode (if I am not dragging a button).
If I start a drag and drop operation NO mouse events are fired.
What can I do to receive MouseMove event even if I am in "drag and drop" mode?
A solution would be not to use dmAutomatic and implement my own drag and drop alternative (based on mousedown, mousemove, mouseup). Is these a quicker fix?
delphi mouseevent c++builder onmouseover
1
If I remember correctly aTDragObject
will receive and handle the mouse messages during Drag&Drop. But you should then get e.g.DragOver
events instead.
– nil
Nov 22 '18 at 16:14
@nil - I think I get the idea: "move the code from MouseMove to DragOver". I will try it. thanks!
– Rigel
Nov 22 '18 at 16:15
Maybe, if it's true that you receive MouseMove when not dragging and DragOver when dragging.
– nil
Nov 22 '18 at 16:19
@nil - it works. can you post your comment as an answer so I can accept it? 1.5 million thanks.
– Rigel
Nov 22 '18 at 16:25
1
"What can I do to receive MouseMove event even if I am in "drag and drop" mode?" - Nothing... you can't. See documentation for SetCapture on MSDN for explanation. Called from TDragObject.Capture.
– Sertac Akyuz
Nov 22 '18 at 16:39
|
show 1 more comment
I have a ScrollBox in which I have a GridPanel in which I have Buttons.
I set DragMode to dmAutomatic for all buttons so I can move the buttons around (drag and drop).
But I have a problem: because the GridPanel is larger than the ScrollBox, the ScrollBox has the vertical scrollbar visible. I want to make the ScrollBar to automatically scroll down so I can drop a bottom from the visible (top) rows into the inaccessible rows at the bottom (this is typical behavior for all Windows programs, right?)
I have simple code that is doing this: In MouseMove I detect when the mouse is getting close to the bottom of the ScrollBox and I adjust ScrollBox.VertScrollBa.Position to scroll down. This works ONLY if I am NOT in "drag and drop" mode (if I am not dragging a button).
If I start a drag and drop operation NO mouse events are fired.
What can I do to receive MouseMove event even if I am in "drag and drop" mode?
A solution would be not to use dmAutomatic and implement my own drag and drop alternative (based on mousedown, mousemove, mouseup). Is these a quicker fix?
delphi mouseevent c++builder onmouseover
I have a ScrollBox in which I have a GridPanel in which I have Buttons.
I set DragMode to dmAutomatic for all buttons so I can move the buttons around (drag and drop).
But I have a problem: because the GridPanel is larger than the ScrollBox, the ScrollBox has the vertical scrollbar visible. I want to make the ScrollBar to automatically scroll down so I can drop a bottom from the visible (top) rows into the inaccessible rows at the bottom (this is typical behavior for all Windows programs, right?)
I have simple code that is doing this: In MouseMove I detect when the mouse is getting close to the bottom of the ScrollBox and I adjust ScrollBox.VertScrollBa.Position to scroll down. This works ONLY if I am NOT in "drag and drop" mode (if I am not dragging a button).
If I start a drag and drop operation NO mouse events are fired.
What can I do to receive MouseMove event even if I am in "drag and drop" mode?
A solution would be not to use dmAutomatic and implement my own drag and drop alternative (based on mousedown, mousemove, mouseup). Is these a quicker fix?
delphi mouseevent c++builder onmouseover
delphi mouseevent c++builder onmouseover
edited Nov 22 '18 at 16:13
Rigel
asked Nov 22 '18 at 16:02
RigelRigel
10k14111223
10k14111223
1
If I remember correctly aTDragObject
will receive and handle the mouse messages during Drag&Drop. But you should then get e.g.DragOver
events instead.
– nil
Nov 22 '18 at 16:14
@nil - I think I get the idea: "move the code from MouseMove to DragOver". I will try it. thanks!
– Rigel
Nov 22 '18 at 16:15
Maybe, if it's true that you receive MouseMove when not dragging and DragOver when dragging.
– nil
Nov 22 '18 at 16:19
@nil - it works. can you post your comment as an answer so I can accept it? 1.5 million thanks.
– Rigel
Nov 22 '18 at 16:25
1
"What can I do to receive MouseMove event even if I am in "drag and drop" mode?" - Nothing... you can't. See documentation for SetCapture on MSDN for explanation. Called from TDragObject.Capture.
– Sertac Akyuz
Nov 22 '18 at 16:39
|
show 1 more comment
1
If I remember correctly aTDragObject
will receive and handle the mouse messages during Drag&Drop. But you should then get e.g.DragOver
events instead.
– nil
Nov 22 '18 at 16:14
@nil - I think I get the idea: "move the code from MouseMove to DragOver". I will try it. thanks!
– Rigel
Nov 22 '18 at 16:15
Maybe, if it's true that you receive MouseMove when not dragging and DragOver when dragging.
– nil
Nov 22 '18 at 16:19
@nil - it works. can you post your comment as an answer so I can accept it? 1.5 million thanks.
– Rigel
Nov 22 '18 at 16:25
1
"What can I do to receive MouseMove event even if I am in "drag and drop" mode?" - Nothing... you can't. See documentation for SetCapture on MSDN for explanation. Called from TDragObject.Capture.
– Sertac Akyuz
Nov 22 '18 at 16:39
1
1
If I remember correctly a
TDragObject
will receive and handle the mouse messages during Drag&Drop. But you should then get e.g. DragOver
events instead.– nil
Nov 22 '18 at 16:14
If I remember correctly a
TDragObject
will receive and handle the mouse messages during Drag&Drop. But you should then get e.g. DragOver
events instead.– nil
Nov 22 '18 at 16:14
@nil - I think I get the idea: "move the code from MouseMove to DragOver". I will try it. thanks!
– Rigel
Nov 22 '18 at 16:15
@nil - I think I get the idea: "move the code from MouseMove to DragOver". I will try it. thanks!
– Rigel
Nov 22 '18 at 16:15
Maybe, if it's true that you receive MouseMove when not dragging and DragOver when dragging.
– nil
Nov 22 '18 at 16:19
Maybe, if it's true that you receive MouseMove when not dragging and DragOver when dragging.
– nil
Nov 22 '18 at 16:19
@nil - it works. can you post your comment as an answer so I can accept it? 1.5 million thanks.
– Rigel
Nov 22 '18 at 16:25
@nil - it works. can you post your comment as an answer so I can accept it? 1.5 million thanks.
– Rigel
Nov 22 '18 at 16:25
1
1
"What can I do to receive MouseMove event even if I am in "drag and drop" mode?" - Nothing... you can't. See documentation for SetCapture on MSDN for explanation. Called from TDragObject.Capture.
– Sertac Akyuz
Nov 22 '18 at 16:39
"What can I do to receive MouseMove event even if I am in "drag and drop" mode?" - Nothing... you can't. See documentation for SetCapture on MSDN for explanation. Called from TDragObject.Capture.
– Sertac Akyuz
Nov 22 '18 at 16:39
|
show 1 more comment
1 Answer
1
active
oldest
votes
During drag-and-drop operations the VCL will create a TDragObject
to manage said drag-and-drop operation. This TDragObject
- or a derived class - will start receiving and handling mouse events as long as dragging lasts. In turn, it will generate drag-and-drop specific events like OnDragOver
and OnDragDrop
which can be handled by - potential target - controls under current mouse position.
This will allow you to handle OnMouseMove
whenever no drag-and-drop is happening. In addition handle OnDragOver
in a similar way to catch mouse movements when currently dragging.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434652%2fhow-to-make-the-tscollbox-automatically-scroll-when-dragmode-is-dmautomatic%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
During drag-and-drop operations the VCL will create a TDragObject
to manage said drag-and-drop operation. This TDragObject
- or a derived class - will start receiving and handling mouse events as long as dragging lasts. In turn, it will generate drag-and-drop specific events like OnDragOver
and OnDragDrop
which can be handled by - potential target - controls under current mouse position.
This will allow you to handle OnMouseMove
whenever no drag-and-drop is happening. In addition handle OnDragOver
in a similar way to catch mouse movements when currently dragging.
add a comment |
During drag-and-drop operations the VCL will create a TDragObject
to manage said drag-and-drop operation. This TDragObject
- or a derived class - will start receiving and handling mouse events as long as dragging lasts. In turn, it will generate drag-and-drop specific events like OnDragOver
and OnDragDrop
which can be handled by - potential target - controls under current mouse position.
This will allow you to handle OnMouseMove
whenever no drag-and-drop is happening. In addition handle OnDragOver
in a similar way to catch mouse movements when currently dragging.
add a comment |
During drag-and-drop operations the VCL will create a TDragObject
to manage said drag-and-drop operation. This TDragObject
- or a derived class - will start receiving and handling mouse events as long as dragging lasts. In turn, it will generate drag-and-drop specific events like OnDragOver
and OnDragDrop
which can be handled by - potential target - controls under current mouse position.
This will allow you to handle OnMouseMove
whenever no drag-and-drop is happening. In addition handle OnDragOver
in a similar way to catch mouse movements when currently dragging.
During drag-and-drop operations the VCL will create a TDragObject
to manage said drag-and-drop operation. This TDragObject
- or a derived class - will start receiving and handling mouse events as long as dragging lasts. In turn, it will generate drag-and-drop specific events like OnDragOver
and OnDragDrop
which can be handled by - potential target - controls under current mouse position.
This will allow you to handle OnMouseMove
whenever no drag-and-drop is happening. In addition handle OnDragOver
in a similar way to catch mouse movements when currently dragging.
edited Nov 22 '18 at 16:55
answered Nov 22 '18 at 16:44
nilnil
1,1811318
1,1811318
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434652%2fhow-to-make-the-tscollbox-automatically-scroll-when-dragmode-is-dmautomatic%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
If I remember correctly a
TDragObject
will receive and handle the mouse messages during Drag&Drop. But you should then get e.g.DragOver
events instead.– nil
Nov 22 '18 at 16:14
@nil - I think I get the idea: "move the code from MouseMove to DragOver". I will try it. thanks!
– Rigel
Nov 22 '18 at 16:15
Maybe, if it's true that you receive MouseMove when not dragging and DragOver when dragging.
– nil
Nov 22 '18 at 16:19
@nil - it works. can you post your comment as an answer so I can accept it? 1.5 million thanks.
– Rigel
Nov 22 '18 at 16:25
1
"What can I do to receive MouseMove event even if I am in "drag and drop" mode?" - Nothing... you can't. See documentation for SetCapture on MSDN for explanation. Called from TDragObject.Capture.
– Sertac Akyuz
Nov 22 '18 at 16:39