![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Thu, Oct 6 2016 9:26 AM | Permanent Link |
thomh | Hi,
Could someone take a look at the attached project? I have a main Form1 (with a base panel) and a Child Form2. On the Form1.OnCreate I code: Form2 := TForm2.Create(pnlMain) Form2.Show; Why isn't the Edit1 control on Form2 focused? I have to click it for it gain focus. Edit1.SetFocus does not seem to work either. // Thom Attachments: FocusTest.zip |
Fri, Oct 7 2016 2:35 AM | Permanent Link |
Michael Dreher | thomh wrote:
// Could someone take a look at the attached project? I observed that after calling "Form2.Show" the ActiveForm ist still the parent main form. I checked that the focus can be set after the child form becomes active. This is different from calling a form in modal state, where it becomes the ActiveForm automatically. The help on SetFocus says: // The ability of a control to obtain the input focus is dependent upon: // - Whether the control is focusable // - Whether the control is visible // - Whether its parent container control is visible All three conditions are true in this case. There's no - Whether its parent container's form is the active form But how to set the active form from the code? Application.Surface.ActiveForm is a readonly property. Should this be done by the code behind the SetFocus method? Michael Dreher |
Fri, Oct 7 2016 4:41 AM | Permanent Link |
Matthew Jones | Michael Dreher wrote:
> focus can be set after the child form becomes active I have been putting a function in the form that sets the focus to where I want it, and in my OnShow for the form, I call that with the async keyword first. That allows the focus to work as all the changes have settled. -- Matthew Jones |
Fri, Oct 7 2016 8:47 AM | Permanent Link |
thomh | >>"Matthew Jones" wrote:
>>I have been putting a function in the form that sets the focus to where I want it, and in my OnShow for the form, I >>call that with the async keyword first. That allows the focus to work as all the changes have settled. That worked for me as well, Matthew. Thanks. // Thom |
Fri, Oct 7 2016 12:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Thom,
<< Why isn't the Edit1 control on Form2 focused? I have to click it for it gain focus. >> If the first form (Form1) is being auto-created, then it is being created with the async keyword, which means that you'll also need to use the async keyword for any focus operations in the OnCreate event for the form. The other alternative is to use the OnShow event instead for this type of functionality. Tim Young Elevate Software www.elevatesoft.com |
Fri, Oct 7 2016 12:32 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Michael,
<< But how to set the active form from the code? Application.Surface.ActiveForm is a readonly property. Should this be done by the code behind the SetFocus method? >> Embedded forms are excluded from the ActiveForm property because EWB only considers top-level forms to be those that are direct children of the application surface. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, March 29, 2023 at 12:35 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |