Recent

Author Topic: [SOLVED]Automaticaly set input to TEdit1  (Read 2315 times)

Kevinn33

  • New Member
  • *
  • Posts: 26
[SOLVED]Automaticaly set input to TEdit1
« on: April 03, 2018, 11:53:02 am »
Hello, I want to ask about how to input automatically to TEdit when the form is open?

example, i want a barcode scanner to directly write on TEdit without Click the TEdit
« Last Edit: April 03, 2018, 12:19:08 pm by Kevinn33 »

balazsszekely

  • Guest
Re: Automaticaly set input to TEdit1
« Reply #1 on: April 03, 2018, 11:54:24 am »
Like this:
Code: Pascal  [Select][+][-]
  1. Edit1.Text := 'this is a test';

Kevinn33

  • New Member
  • *
  • Posts: 26
Re: Automaticaly set input to TEdit1
« Reply #2 on: April 03, 2018, 11:57:32 am »
ehm its not what i want..

what i mean is, when you run a program whatever input from keyboard or barcode goes directly to TEdit without even click the TEdit box

i dont know how to do this

balazsszekely

  • Guest
Re: Automaticaly set input to TEdit1
« Reply #3 on: April 03, 2018, 12:00:15 pm »
Click to your form, go to Object Inspector and set ActiveControl property to Edit1. You can also do it programmatically like Edit1.SetFocus.

Kevinn33

  • New Member
  • *
  • Posts: 26
Re: Automaticaly set input to TEdit1
« Reply #4 on: April 03, 2018, 12:04:32 pm »
Thanks!, That is what i wanted.
Thank you GetMem for teaching simple things  :D
and it also work using
ActiveControl := TEdit;
#fromNewbieinLazarus
« Last Edit: April 03, 2018, 12:20:13 pm by Kevinn33 »

balazsszekely

  • Guest
Re: Automaticaly set input to TEdit1
« Reply #5 on: April 03, 2018, 12:19:44 pm »
Use the OnActivate event
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormActivate(Sender: TObject);
  2. begin
  3.   Edit1.SetFocus;
  4. end;    

PS: In the meantime you deleted your last question. I assume you figured out the answer.

Kevinn33

  • New Member
  • *
  • Posts: 26
Re: [SOLVED]Automaticaly set input to TEdit1
« Reply #6 on: April 04, 2018, 01:01:58 am »
@GetMem hahahaha  I thought no one would see my last question,

yes yes I Figure it out by putting ActiveControl := TEdit; on Buttonclick( Back to Form 1 ) Procedure

I thought I should be able to figure this out so I deleted the question.

I think asking too much for simple thing without trying it is not a good way to learn coding :)
I Respect people who teach me, so I wont ask too much as its like using them.



 

TinyPortal © 2005-2018