Hello,
I am trying to implement a feature in which if the user presses the Spacebar key
ImageEnView's MouseInteract will be set to miScroll. And will remain like this as long as the key is kept pressed.
The moment the key is released ImageEnView's MouseInteract should get set to its previous mode.
For this I am using the component - ApplicationEvents. this component ships with Delphi.
Here is the code that I am using. With current code is written in the ShortCut and I am able to toggle between active MouseInteract and miScroll.
private
{ Private declarations }
PrevMI : TIEMouseInteract;
ModeAssigned: Boolean;
//------- ShortCut Event code --------------
var
iKey: Integer;
if ImageEnView1.IsEmpty then
Exit;
ikey := Msg.CharCode;
if iKey = VK_SPACE then
begin
if ModeAssigned = False then
begin
PrevMI := ImageEnView1.MouseInteract;
ModeAssigned := True;
ImageEnView1.Cursor := crIEHandDrag;
ImageEnView1.MouseInteract := [];
ImageEnView1.MouseInteract := [miScroll];
end
else
begin
ImageEnView1.MouseInteract := [];
ImageEnView1.MouseInteract := PrevMI;
ModeAssigned := False;
ImageEnView1.Cursor := crIECross;
end;
Handled := True;
end;
But I am not able to implement this functionality as described.
Can someone please help in solving this?
TIA
Yogi Yang