Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.pascal.delphi.misc > #62

Re: focus controls

From "P E Schoen" <paul@pstech-inc.com>
Newsgroups comp.lang.pascal.delphi.misc
Subject Re: focus controls
Date 2011-07-22 21:23 -0400
Organization Aioe.org NNTP Server
Message-ID <j0d7qm$g6b$1@speranza.aioe.org> (permalink)
References <c1b818ce-cd04-427e-9715-fc90c46c700b@j15g2000yqf.googlegroups.com> <4e2897a3$0$15047$426a74cc@news.free.fr>

Show all headers | View raw


"Ph. B."  wrote in message news:4e2897a3$0$15047$426a74cc@news.free.fr...

> jason madrigal a écrit :
>> Hi I'm new in delphi pascal...
>> that I'm trying is to focus an edit control in an button click event.
>>
>> thanks in advance for the help

> First, I suppose you have put a TButton control and a TEdit control
> on the form.
> Next, link a procedure to the "OnClick" button's event, then, in
> the code of this procedure, type

> Edit1.SetFocus;

> Compile, run and enjoy  ;-)

That will probably work OK. But I have had some problems setting focus of 
one control from another's onClick event. At the very least, make sure the 
SetFocus is the last line of the onClick handler. Otherwise, maybe the 
SetFocus should be in an OnMouseUp event, or even better, OnBlur or 
OnLoseFocus, if those are available. It's been awhile since I worked with 
those issues, or even Delphi itself.

Paul 

Back to comp.lang.pascal.delphi.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

focus controls jason madrigal <jasmad.v@gmail.com> - 2011-07-21 11:09 -0700
  Re: focus controls "Ph. B." <philippe_N_O.S_P_A_M_.boucault@voila.fr> - 2011-07-21 23:18 +0200
    Re: focus controls "P E Schoen" <paul@pstech-inc.com> - 2011-07-22 21:23 -0400
      Re: focus controls Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@charter.net> - 2011-07-23 11:02 -0400

csiph-web