After creating and showing a nonmodal dialog I want to set the focus back
to the parent window.
1.
::oParent:SetFocus()
in the FormInitialize() method of the dialogwindow doesn't work
2.
::ExportDlg:=DelGer():New(Self)
::ExportDlg:Show()
::SetFocus()
in the parentwindow doesn't work too
Is there a simple way to set the focus back to the parent window after
showing
the childwindow?
Regards
Ingo
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
oParent:SetFocus()?
- ignacio
- Site Admin
- Mensajes: 9463
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
oParent:SetFocus()?
Ingo,
On first try it works as expected. Confirm is working on your side. Thanks
METHOD Button1Click( oSender ) CLASS TForm2
TForm1():New( Self ):Show()
::SetFocus()
RETURN Nil
"Ingo" <ingo.jh@web.de> escribió en el mensaje
news:[email=4372f3e3@ozsrvnegro.ozlan.local...]4372f3e3@ozsrvnegro.ozlan.local...[/email]
> After creating and showing a nonmodal dialog I want to set the focus back
> to the parent window.
>
> 1.
> ::oParent:SetFocus()
> in the FormInitialize() method of the dialogwindow doesn't work
>
> 2.
> ::ExportDlg:=DelGer():New(Self)
> ::ExportDlg:Show()
> ::SetFocus()
> in the parentwindow doesn't work too
>
> Is there a simple way to set the focus back to the parent window after
> showing
> the childwindow?
>
> Regards
>
> Ingo
>
>
On first try it works as expected. Confirm is working on your side. Thanks
METHOD Button1Click( oSender ) CLASS TForm2
TForm1():New( Self ):Show()
::SetFocus()
RETURN Nil
"Ingo" <ingo.jh@web.de> escribió en el mensaje
news:[email=4372f3e3@ozsrvnegro.ozlan.local...]4372f3e3@ozsrvnegro.ozlan.local...[/email]
> After creating and showing a nonmodal dialog I want to set the focus back
> to the parent window.
>
> 1.
> ::oParent:SetFocus()
> in the FormInitialize() method of the dialogwindow doesn't work
>
> 2.
> ::ExportDlg:=DelGer():New(Self)
> ::ExportDlg:Show()
> ::SetFocus()
> in the parentwindow doesn't work too
>
> Is there a simple way to set the focus back to the parent window after
> showing
> the childwindow?
>
> Regards
>
> Ingo
>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
oParent:SetFocus()?
Ingo,
> 1.
> ::oParent:SetFocus()
> in the FormInitialize() method of the dialogwindow doesn't work
The event OnInitialize is launched when the form and all its controls are
created, but just before it's shown. So, *after* this event is processed,
the form is shown and the focus goes to it.
> 2.
> ::ExportDlg:=DelGer():New(Self)
> ::ExportDlg:Show()
> ::SetFocus()
> in the parentwindow doesn't work too
It's working fine here. Are you using the last version (PR6)?
BTW, the form's event OnShow may be used too to send back the focus to the
parent form.
--
Regards,
Jose F. Gimenez
> 1.
> ::oParent:SetFocus()
> in the FormInitialize() method of the dialogwindow doesn't work
The event OnInitialize is launched when the form and all its controls are
created, but just before it's shown. So, *after* this event is processed,
the form is shown and the focus goes to it.
> 2.
> ::ExportDlg:=DelGer():New(Self)
> ::ExportDlg:Show()
> ::SetFocus()
> in the parentwindow doesn't work too
It's working fine here. Are you using the last version (PR6)?
BTW, the form's event OnShow may be used too to send back the focus to the
parent form.
--
Regards,
Jose F. Gimenez
oParent:SetFocus()?
Ignacio and Jose,
thanks for answering.
Your example works here too, but in my project it is a little bit more
complicated. From the menu of a mdi-container is calling a method of the
midi which calls a method in the childwindow which calls the nonmodal
dialogwindow.
I don't know why but I can not set the focus back to the childwindow.
Here a sample.
Please try it
Regards
Ingo
"Jose F. Gimenez" <jfgimenez@wanadoo.es> schrieb im Newsbeitrag
news:[email=43730834@ozsrvnegro.ozlan.local...]43730834@ozsrvnegro.ozlan.local...[/email]
> Ingo,
>
>> 1.
>> ::oParent:SetFocus()
>> in the FormInitialize() method of the dialogwindow doesn't work
>
> The event OnInitialize is launched when the form and all its controls are
> created, but just before it's shown. So, *after* this event is processed,
> the form is shown and the focus goes to it.
>
>
>> 2.
>> ::ExportDlg:=DelGer():New(Self)
>> ::ExportDlg:Show()
>> ::SetFocus()
>> in the parentwindow doesn't work too
>
> It's working fine here. Are you using the last version (PR6)?
>
> BTW, the form's event OnShow may be used too to send back the focus to the
> parent form.
>
>
> --
> Regards,
>
> Jose F. Gimenez
>
>
Attached files Test.zip (4.2 KB)Â
thanks for answering.
Your example works here too, but in my project it is a little bit more
complicated. From the menu of a mdi-container is calling a method of the
midi which calls a method in the childwindow which calls the nonmodal
dialogwindow.
I don't know why but I can not set the focus back to the childwindow.
Here a sample.
Please try it
Regards
Ingo
"Jose F. Gimenez" <jfgimenez@wanadoo.es> schrieb im Newsbeitrag
news:[email=43730834@ozsrvnegro.ozlan.local...]43730834@ozsrvnegro.ozlan.local...[/email]
> Ingo,
>
>> 1.
>> ::oParent:SetFocus()
>> in the FormInitialize() method of the dialogwindow doesn't work
>
> The event OnInitialize is launched when the form and all its controls are
> created, but just before it's shown. So, *after* this event is processed,
> the form is shown and the focus goes to it.
>
>
>> 2.
>> ::ExportDlg:=DelGer():New(Self)
>> ::ExportDlg:Show()
>> ::SetFocus()
>> in the parentwindow doesn't work too
>
> It's working fine here. Are you using the last version (PR6)?
>
> BTW, the form's event OnShow may be used too to send back the focus to the
> parent form.
>
>
> --
> Regards,
>
> Jose F. Gimenez
>
>
Attached files Test.zip (4.2 KB)Â
oParent:SetFocus()?
Ingo,
sorry for the delay.
> Your example works here too, but in my project it is a little bit more
> complicated. From the menu of a mdi-container is calling a method of the
> midi which calls a method in the childwindow which calls the nonmodal
> dialogwindow.
> I don't know why but I can not set the focus back to the childwindow.
> Here a sample.
> Please try it
I've just tested it. The matter is that a mdi child window is in fact a
child window owned by the mdi frame window, and when another popup window
gets focused, the focus is lost not only from the mdi child but also from
the mdi frame window.
So, to return back the focus to the mdi child window, you only need to set
focus to the mdi frame. That is, change in the line 27 of form2.prg from:
::SetFocus()
to:
::oParent:SetFocus()
--
Regards,
Jose F. Gimenez
sorry for the delay.
> Your example works here too, but in my project it is a little bit more
> complicated. From the menu of a mdi-container is calling a method of the
> midi which calls a method in the childwindow which calls the nonmodal
> dialogwindow.
> I don't know why but I can not set the focus back to the childwindow.
> Here a sample.
> Please try it
I've just tested it. The matter is that a mdi child window is in fact a
child window owned by the mdi frame window, and when another popup window
gets focused, the focus is lost not only from the mdi child but also from
the mdi frame window.
So, to return back the focus to the mdi child window, you only need to set
focus to the mdi frame. That is, change in the line 27 of form2.prg from:
::SetFocus()
to:
::oParent:SetFocus()
--
Regards,
Jose F. Gimenez