<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16588"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 bgColor=#ffffff text=#000000
CanvasTabStop="true" name="Compose message area">
<DIV><FONT size=2 face=Arial>I have solved it.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Had to do bit by bit testing and deductive
reasoning to find the cause: The bit by bit found nothing but took lots of
nice time trying useless things. The deductive reasoning - this is
my oldest program, and was written before I understood clearly the difference
between the form onActivate and onShow events. I had some code in
the main form onActivate event that did quite a lot of setups - including
showing the second form which in its onActivate event did some further
processing. I am guessing this is to use a technical
term "asking for weird stuff" . Moving all the code to the onShow
event in both forms fixed the problem. Well I think that's what
fixed it.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Why did I do it this way with the onActivate event,
which fires every time the main form is returned to? Well no-one
ever told me otherwise, so I had already put in code that made it only fire most
of the code once ever, effectively it was an onShow event. And also on the
list of events Activate is right at the top and Show is right at the bottom, and
I was teaching myself this stuff.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>The other mystery which I am not going to try to
figure is that for over 6 years it has worked fine, and something minor
altered recently has thrown it. I think it was when I added a combo box to
the main form. Even then most of the time it worked fine, but often would
not. The main symptom was the edit not getting proper focus - go
figure!</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>I remember a saying on the door of one of my
Physics lecturers - "This problem - once solved - will be simple"</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>John</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT><FONT size=2 face=Arial></FONT><FONT size=2
face=Arial></FONT><FONT size=2 face=Arial></FONT><FONT size=2
face=Arial></FONT><FONT size=2 face=Arial></FONT><FONT size=2
face=Arial></FONT><BR> </DIV>
<DIV><FONT size=2 face=Arial>Yes I have tried all sorts of things like setting
TabStop to false, and most hopefully setting the control second in
the Tab Order list with focus going to another control and then doing a Setfocus
to the one I want. It still does not fix it. Also been
playing with Autoselect and ShowSelect, and IMEMode. Nothing makes
any difference - I am convinced its something in the way the program is
built</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Is there a way to programatically set the focus
more than what Setfocus does?</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>John</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV>Hi John,<BR><BR>Have you tried to set the tab order to 1 (or 0 - can't
remember which is the "accepted" first) for this control
?<BR><BR>Cheers,<BR><BR>Pieter<BR><BR>On 10/06/2010 21:20, John Bird wrote:
</DIV>
<BLOCKQUOTE cite=mid:9328102237AA4ADDB0BF506812422C8E@JohnSony2 type="cite">
<META name=GENERATOR content="MSHTML 8.00.7600.16588">
<DIV><FONT size=2 face=Arial>This one has me foxed. I have a
standard unit which is a form dialog at the start of many programs -
which gets an access code and a password.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>In one program only it misbehaves - the Tedit
fields never seem to get focus properly, so although the users can type text,
there is no cursor and the onexit event of the TEdit does not
fire. Also default text in the Tedit does not show as
selected. Subsequent returns to this and other edit boxes do
behave properly.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>This is Delphi 2007 - problem shows for this
program on Windows 7 and XP. XP Manifest is in use. Very little
processing before this dialog form is shown...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>Note I have already done code like
Edit1.Setfocus -- it does not fix the problem.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>Anyone have any ideas??? Normal build
and compile all and deleting all dcus has not fixed it.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>Also is there any way to force a Tedit to have
its text selected. </FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>John</FONT></DIV><PRE wrap=""><FIELDSET class=mimeAttachmentHeader></FIELDSET>
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <A class=moz-txt-link-abbreviated href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</A>
Admin: <A class=moz-txt-link-freetext href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</A>
Unsubscribe: send an email to <A class=moz-txt-link-abbreviated href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</A> with Subject: unsubscribe</PRE></BLOCKQUOTE><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe
<P>
<HR>
<P></P>_______________________________________________<BR>NZ Borland Developers
Group - Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject: unsubscribe</BODY></HTML>