ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 OnVirtualKey stuttering...

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bmesser Posted - Feb 21 2013 : 03:48:14
Hi

I have an ImageEnView component with a number of layers I am stepping through to create an animation loop. I have actions for next frame and previous frame so I thought I would hook them up to the OnKeyDown event so that you could control them with the left/right arrow keys and the zoom level with the up/down arrow keys. This didn't work and I found that the component had a OnVirtualKey event. The code worked a lot more reliably with this - but I found when you stepped through one key press/frame at a time you got one successful event but the next event wouldn't fire. If you keep the key down the event fires repeatedly so all I can figure is that there is a repeat delay interval that's causing this. Can anyone advise me how I can smoothly loop through my frames one at a time?

procedure TfmMain.ImageVirtualKey(Sender: TObject; VirtualKey, KeyData: Cardinal; KeyDown: Boolean);
begin
  case VirtualKey of
    vk_add,vk_down    : TAzoomIn.Execute;
    vk_subtract,vk_up : TAzoomOut.Execute;
    vk_right          : TAnext.Execute;
    vk_left           : TAprevious.Execute;
  end;
end;


Bruce.
2   L A T E S T    R E P L I E S    (Newest First)
bmesser Posted - Feb 22 2013 : 07:29:40
Nigel

You can't assign key events such as left & right arrow to actions as far as I know - only keys like insert or the function keys.

Anyway you where correct the image was losing focus somehow so I just added a line in the action to maintain the focus. Then the problem is even the shortest key press and the image layers looped at least two steps. So I added a 150 millisecond wait just before resetting the focus so it responded to a single key press. If you keep your finger down on the key it does auto-repeat.

Bruce.
xequte Posted - Feb 21 2013 : 13:07:48
Hi

Did you try assigning these shortcuts to the "Shortcut" property of each TAction?

Failing that, OnKeyDown/Up would be the best place to do it. Was the event not firing? Did the ImageEnView lose focus?

You can also catch the OnKeyDown/Up events for the form if KeyPreview is enabled.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com