Hello Support,
I have a dxBarEdit on a Ribbon control. I will be using a barcode scanner to scan into the dxBarEdit control and I need to react to the barcode which has just been scanned in.
With a normal TEdit I use the OnKeyPress event and check if (Key = #13) then perform a function on the scanned code, however the dxBarEdit appears to suppress #13 in the OnKeyPress event so my function never gets fired.
I have tried using OnExit but this is not really suitable as I need to know that the enter key has been pressed or a #13 has been received from a scanner.
Is there another method I can use with this control to get this or maybe a change I can make to the source code which would allow the enter key to appear in OnKeyPress event?
with Regards
Andy…
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Andy,
By design, pressing Enter posts and closes the active ExpressBars editor. So, I recommend that you handle the OnKeyDown event of your TdxBarEdit instead. Will this meet your requirements?
Thanks,
Serge
Hi Serge,
The keydown event almost works for me but I am now facing a slightly different issue.
I select a record in a cxGrid by double clicking and then scan the asset barcode into the BarEdit control
The OnKeyDown event looks like this:-
if key = vk_Return then
begin
if PassAssetCheck(BarEdit1.CurText) then
begin
// Code to handle a valid asset
end
else
begin
BarEdit1.Text :='';
BarEdit1.Setfocus(True);
end;
end;
The problem arises when the PassAssetCheck returns false. Instead of the BarEdit getting the focus, the focus goes to the selected grid record. Is there another way to reference the BarEdit control to force it to receive focus?
Thanks
Andy.
Hi Andy,
As I mentioned earlier, pressing Enter closes the active ExpressBars editor. So, calling the editor's SetFocus method from within its OnKeyDown event handler seems to be not quite correct. This mostly seems to be a timing issue. I recommend that you postpone this operation (focusing the editor) when executing it. For example, start a short-delay timer and display the form when it's over, or, better yet, post a custom message to the parent form, and call the editor's SetFocus method in the handler of this message, implemented in the class of your form. This will allow our components to process the message queue and correctly complete their internal routines.
Hopefully, this will help you overcome the problem. Please keep me informed about your progress.
Please also review the following Knowledge Base article, which may be helpful:
"How to Programmatically Set Focus to an ExpressBars Editor"
http://www.devexpress.com/kb=A233
Thanks,
Serge