Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Put the focus in a AnalogNumeric
PostPosted: Tue Sep 25, 2012 3:32 am 

Joined: Mon Sep 24, 2012 9:08 am
Posts: 11

Offline
Hi guys,

This is my first post, also is the first time I program this type of HMI. I'm trying to read from usb port a barcode from a barcode reader and put it in a analogNumeric control.

So far no problem.

I'm trying the following: I want when the screen opens, the keyboard focus automatically will put into the analogNumeric , and I can't do it, I must click over the analognumeric for the keyboard focus can be put over the control and therefore read the barcode.

Is there a script to do that? Because I've looked everywhere and I was unable to find it.

Sorry for my poor english....

Thank you very much for your help.

best Regards


 Profile  
 
 Post subject: Re: Put the focus in a AnalogNumeric
PostPosted: Tue Sep 25, 2012 10:32 am 

Joined: Fri May 25, 2012 7:44 am
Posts: 22
Location: Charlotte, NC. USA

Offline
Something like the below code can be placed in the screen's Opened event.

Code:
((Neo.ApplicationFramework.Controls.Controls.TextBox)AnalogNumeric1.AdaptedObject).Focus();


Assuming your AnalogNumeric Object is...
AnalogNumeric1

you can cast the object to its base class of
(Neo.ApplicationFramework.Controls.Controls.TextBox)

This exposes the "Focus" method on the underlying object. I have tested this in a simulated run of the project and it automatically focuses the analog numeric and shows the OnScreenKeyboard.

_________________
Best Regards,
Patrick Hall


 Profile  
 
 Post subject: Re: Put the focus in a AnalogNumeric
PostPosted: Tue Sep 25, 2012 10:50 am 

Joined: Mon Sep 24, 2012 9:08 am
Posts: 11

Offline
your code works perfect...

Thank you very much... you save my life....

best regards,


 Profile  
 
 Post subject: Re: Put the focus in a AnalogNumeric
PostPosted: Wed Dec 19, 2012 11:16 pm 

Joined: Wed Dec 19, 2012 11:00 pm
Posts: 2

Offline
Hi,
I tested as per the previous post by Patrick. I was able to build with no error but still have an exception thrown error when I tried to simulate. Am I doing something wrong? Here is my script.
void Screen1_Opened(System.Object sender, System.EventArgs e)
{
((Neo.ApplicationFramework.Controls.Controls.TextBox) AnalogNumeric1.AdaptedObject).Focus();
}

Thanks and regards,


 Profile  
 
 Post subject: Re: Put the focus in a AnalogNumeric
PostPosted: Thu Dec 20, 2012 9:36 am 

Joined: Tue Mar 13, 2012 9:53 am
Posts: 824

Offline
Please post the exception.

_________________
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer


 Profile  
 
 Post subject: Re: Put the focus in a AnalogNumeric
PostPosted: Thu Dec 20, 2012 10:12 am 

Joined: Wed Dec 19, 2012 11:00 pm
Posts: 2

Offline
Hi Mark,
I found the issue. when I created a new project, I selected pc 800x600 as my target and add analognumeric object inside the screen. Then I added the script for screen open event. When I simulated the project, it gave me an exception. I changed to T7A as my target and now its working.

Thanks,


 Profile  
 
 Post subject: Re: Put the focus in a AnalogNumeric
PostPosted: Wed Jul 02, 2014 8:39 am 

Joined: Thu Jun 26, 2014 2:33 pm
Posts: 1

Offline
Hello

Using the suggested script, I can select the analog numeric. But I need after entering a value (in a usb keyboard) the object comes back to focus again.
Do you have any suggestions?

I tried to use the Lost Focus, but the terminal restarts after entering the value in first.

void Screen1_Opened(System.Object sender, System.EventArgs e)
{
((Neo.ApplicationFramework.Controls.Controls.TextBox)AnalogNumeric1.AdaptedObject).Focus();
}

void AnalogNumeric1_LostFocus(System.Object sender, System.EventArgs e)
{
((Neo.ApplicationFramework.Controls.Controls.TextBox)AnalogNumeric1.AdaptedObject).Focus();
}

Grateful for the attention.


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron