setfocus not working on firemonkey tedit

Hello
Why would a very simple form not set the focus on a tedit  

I am calling edit1.setfocus but for some reason I still need to toych the control at runtime 

What am idoing wrong?
1
Clive
12/12/2013 8:59:13 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

4 Replies
3761 Views

Similar Articles

[PageSpeed] 35

Clive Morgan wrote:

> I am calling edit1.setfocus but for some reason I still need to toych
> the control at runtime

Depends on when you do it. You need to show your code.

-- 
Dave Nottage [TeamB]
Find tips and code samples at Delphi Worlds: 
http://delphi.radsoft.com.au/blog
0
Dave
12/12/2013 10:07:59 PM
> {quote:title=Dave Nottage wrote:}{quote}
> Clive Morgan wrote:
> 
> > I am calling edit1.setfocus but for some reason I still need to toych
> > the control at runtime
> 
> Depends on when you do it. You need to show your code.
> 
> -- 
> Dave Nottage [TeamB]
> Find tips and code samples at Delphi Worlds: 
> http://delphi.radsoft.com.au/blog

Hi Dave Here is the code it is a very sumple test.  I still need to touch the control even after calling SetFocus in the OnActivate event.
implementation

{$R *.fmx}

procedure TForm9.EnterButtonClick(Sender: TObject);
begin
  updatescan;
end;

procedure TForm9.FormActivate(Sender: TObject);
begin
  Edit1.Setfocus;
end;

procedure TForm9.Memo1Enter(Sender: TObject);
begin
   InfoLabel.Text:='Scan Now';
end;

procedure TForm9.Button3Click(Sender: TObject);
begin
   InfoLabel.Text:='Scanned '+IntToStr(Listbox1.Items.Count)+' items';
end;

procedure TForm9.Button4Click(Sender: TObject);
begin
   InfoLabel.Text:='Start Scanning';
   ListBox1.Items.Clear;
end;

procedure TForm9.Edit1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;
  Shift: TShiftState);
begin
   if key = 13 then
   Begin
      updatescan;
      Edit1.SetFocus;
   End;

end;

procedure TForm9.updatescan;
begin
  if Edit1.Text = '5052319789850' then
    ListBox1.Items.Add('Tesco Saussage & Mash')
  else if Edit1.Text = '5011417546406' then
    ListBox1.Items.Add('Veet')
  else if Edit1.Text = '5000175411163' then
    ListBox1.Items.Add('Oxo Chicken')
  else if Edit1.Text = '5000158066007' then
    ListBox1.Items.Add('Gaviscon Double Action')
  else
    ListBox1.Items.Add('Unregistered Code ' + Edit1.Text);
  InfoLabel.Text := 'Scan again or scan DONE to finish';
  Edit1.Text := '';
end;
0
Clive
12/15/2013 10:51:54 AM
> {quote:title=Clive Morgan wrote:}{quote}
> Hi Dave Here is the code it is a very sumple test.  I still need to touch the control even after calling SetFocus in the OnActivate event.

If I need to do this I set the form's ActiveControl in OnCreate.

--
FireMonkey users guide http://bit.ly/10abRZX
MonkeyStyler FireMonkey style designer http://bit.ly/PzxKyI
Embarcadero MVP
0
Mike
12/15/2013 12:47:40 PM
Clive Morgan wrote:

> procedure TForm9.FormActivate(Sender: TObject);
> begin
>   Edit1.Setfocus;
> end;

I expect that is part of the problem, being set in FormActivate. See
Mike's reply.

-- 
Dave Nottage [TeamB]
Find tips and code samples at Delphi Worlds: 
http://delphi.radsoft.com.au/blog
0
Dave
12/15/2013 11:27:21 PM
Reply:

Similar Artilces:

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Ann: X-platform report generator for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Does Delphi XE5 firemonkey work on current Samsung tablets? [Edit]
I am being told that Delphi XE5 with firemonkey will not work on the current range of Samsung tablets even if they have Android 4 is that true? If so I will be very disappointed having invested thousands of pounds and a few hundred hours to adopt the technology on the promise I can now deploy to Android mobile devices. When I run even the most simple Hello World app I simply get a black screen on my brand new Samsung tablet. I am told it only works on Android devices with a ARMv7 CPU supporting NEON instruction sets. If this is the case developers need to know that I have been told today ...

Firemonkey
I am so dammed frustrated with firemonkey and livebindings. The VCL + DB Controls were fast, consistent, and stable. This fmx framework is crap. It's slow on my i5 Macbook. I'd be embarrassed to put out an app like this. The help is lousy and apparently very few people are using it based on my failed Google searches. I can see why. Livebindings is cute when you have a few fields, but it a rats nest when you have a moderately complex form and have to wire up dozens of controls. There is no official support for nullable fields in livebindings which blows my mind....

Installing components for FireMonkey HD and FireMonkey iOS
Hi, How do I install components for both FireMonkey HD and FireMonkey iOS? I have one package 'FMXMyFireMonkeyControl' and 'FMIFireMonkeyControl' which both point to the same file with the same registration 'TFireMonkeyControl'. If I compile one package (FMXMyFireMonkeyControl) it installs correctly, then change the include file (FMCompile.INC) to compile for IOS (FMIFireMonkeyControl) which is included in the FMX.FireMonkeyControl.pas file: {$I FMCOMPILE.INC} uses {$IFDEF COMPILEIOS} FMX_Types, FMX_Objects, FMX_Forms, FMX_Dialogs, FMX_Effe...

FireMonkey and TEdit.OnChange
I am converting a vcl application to FireMonkey and I must stay it is tedious. In the VCL application I have a TEdit Box which I initialise (in the OnShow event) with {code} ed_EntryString.OnChange := EditBox_NotifiesListbox; ed_EntryString.OnEnter := EditBox_NotifiesListbox; {code} When typing in the edit box the EditBox_NotifiesListbox gets executed as expected. In the Firemonkey version I have (in a self constructed Show event (I also tried in the OnCreate event)) {code} ed_EntryString.OnChange := EditBox_NotifiesListbox; ed_EntryString.OnEnter := EditBox_NotifiesListb...

Making Firemonkey more compatible with Delphi
I have programmed in Delphi since 1995 Delphi1 I am now evaluating Delphi XE4. It boggles my mind, why embarcadero has lost the most important aspects of Delphi. Simplicity and Fast User Interface creation. I can easily see how Firemonkey can be improved to bring it in line with traditional Delphi Techniques by doing the following. 1. All Firemonkey controls need a data aware counterpart. 2. Firemonkey Styles need to be converted to TControl descendants. 3. ie. TLayout goes to TPanel ( TFMXPanel ) 4. ie. TRectangle does to TFrame TFMXFrame ) 5. LiveBindings gets placed un...

Delphi XE2, OSX and FireMonkey?
1. Does anyone know if developing with FireMonkey will be the only way to develop for OSX with XE2? 2. Does anyone know if you will need to compile on a Mac for OSX, or will XE2 cross compile? I know this will all come out during the world tour, but I'm just trying to get some idea so I can start planning. 1. Yes, I think for now it will be the only way. But you can probably build a native UI for OSX by directly using the API, like you can also develop Win32 applications without using the VCL. 2. XE2 will only be available for Windows, but it will compile for other platforms. &l...

How to "passwordchar" a TEdit in Firemonkey
Hello: There is no PasswordChar property on the TEdit in firemonkey. How can I hide what the user is typing, ie. password field. I would normally just set the passwordchar property to "*". Thanks, Sidney just set the password property to true > {quote:title=Sidney Egnew wrote:}{quote} > Hello: > > There is no PasswordChar property on the TEdit in firemonkey. How can I hide what the user is typing, ie. password field. I would normally just set the passwordchar property to "*". > > Thanks, Sidney ...

Android Firemonkey SOAP Client Not Working
I ran into the following problem and have opened a ticket in Quality Central: #122209. Please stop by and vote for it if you are experiencing the same issue. If by chance you figured this out, please by all means take all the credit and help a brother out. (Example in the QC ticket) After importing a WSDL, making a SOAP call to a web service results in an Access Violation on Android. The same code executed on either WIN32 or Apple IOS works correctly for both HTTP and HTTPS. I have attempted this on webservices that communicate via HTTP and HTTPS. I have used multiple different webs...

Delphi FireMonkey project / testComplete and MSAA
Hi I am actualy working on a new team project developped using FireMonkey. We want to create automated tests with TestComplete which is already used to run tests on some VCL projects. Unfortunatly, we discovered that TestComplete is not directly compatible with FireMonkey application, it only sees the windows but not the controls on it. Making some research we, found that TestComplete is able to identify controls thanks to MSAA. So we created a really short project (only one form with some controls) using the FireMonkey Accessibility Pack in order to look at TestComplete's behavio...

Master/Detail Does not Work Properly with FireMonkey
There is an error with the master/detail functionality in Delphi XE2 that needs resolved rather quickly. The bug occurs as follows: On a form (FireMonkey application) I have placed two stringgrids, a master and detail grid. As I step through the master grid, the records in the detail grid appear to update as expected. However, if the record count (>1) in the previously viewed detail grid is the same record count as the active detail grid, the detail grid does not update correctly. Only the first record in the detail grid is properly updated. The remaining records are not update...

Firemonkey 2 gestures do not works, what am I doing wrong?
Hi all! I have installed Delphi XE 3 Architect. I have made all instructions from that tutorial video http://www.youtube.com/watch?feature=player_embedded&v=VXeNoKVAe9U and from DocWiki http://docwiki.embarcadero.com/RADStudio/XE3/en/Gestures_in_FireMonkey#Enabling_Standard_Gestures +How to Use Gestures with FireMonkey+ +For a control to be able to use gestures, the control must have the Touch property (TForm and many of the objects derived from TFmxObject support this property).+ +Enabling Interactive Gestures+ +To add support for interactive gestures for a control, you...

ANN: Delphi XE2 FireMonkey BOOK
September 5, 2012 Coogara Consulting is pleased to announce that our new book is available: "FireMonkey Development for iOS and OS X with Delphi XE2" by Graeme Chandler. It is available printed (comb binding) or in PDF and MOBI (Kindle compatible) formats. Only from: http://shop.coogara.com Regards Graeme Chandler Coogara Consulting http://www.coogara.com.au http://shop.coogara.com http://www.strikingwood.com.au Graeme Chandler wrote: > Coogara Consulting is pleased to announce that our new book is > available: > > "FireMonkey Dev...

Web resources about - setfocus not working on firemonkey tedit - embarcadero.delphi.firemonkey


Firemonkeys - GamesIndustry International
The world's leading games industry website. Get insight from todays industry leaders with news, interviews and analysis of global gaming trends. ...

Firemonkey’s Real Racing 3 To Launch At The End Of February
In September, Apple demoed Firemonkey’s Real Racing 3 at the iPhone 5 event . Three months later and the game has yet to show up in the App Store. ...

EA Games and Firemonkey Bringing Real Racing 3 to Android, Fasten your Seat Belts
Start up your engines race fans, EA Games is teaming up with Firemonkey to bring Real Racing 3 to mobile devices. If you’re a fan of more realistic ...

EA's Firemint and IronMonkey Studios Merge to Become FireMonkeys
... game development studios into one mega-studio in Australia. Firemint and IronMonkeys will be merged into a single studio now known as Firemonkeys ...

News: Firemonkeys announces Real Racing 3
Firemonkeys, a new gaming subsidiary of Electronic Arts born from the merger of FireMint and IronMonkey, has announced the coming release of ...

firemonkeys - iMore
EA has pushed out another impressive update to its equally impressive iOS racer, Real Racing 3, that for the first time brings cars from Ferrari ...

Firemonkeys on Real Racing 3 going free-to-play
... got a hands-on preview of Real Racing 3. We also spoke with Ptolemy Oberin, one of the game’s programmers and project lead at developer Firemonkeys, ...

Real Racing 3 coming in 2012 from Firemonkeys
The first game from recently merged developer Firemonkeys is Real Racing 3 , the developer revealed moments ago during EA's Summer Showcase event ...

Firemonkeys Previews Real Racing 3 for iPhone and iPad
Firemonkeys, the new combined studio from EA combining the IronMonkey and Firemint gaming studios, has announced the development of Real Racing ...

EA Mobile Moves: IronMonkey & Firemint Merge Into “Firemonkeys,” Now Have 50M Players Between
... that it is merging two top mobile game studios, IronMonkey and Firemint , which will fittingly combine to create a new company, called Firemonkeys. ...

Resources last updated: 11/27/2015 7:13:30 PM