FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Dialog NOWAIT lost focus at activation!
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Mon Aug 18, 2008 06:12 PM
Why I execute a activation of dialog like this at bellow, the window behind my application is focused?
ACTIVATE DIALOG oDlg VALID .F. NOWAIT CENTERED
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Dialog NOWAIT lost focus at activation!
Posted: Mon Aug 18, 2008 06:27 PM

Have you tried to do:

oDlg:SetFocus()

after ACTIVATE DIALOG oDlg ?

Maybe your program execution is giving the focus to some other window, control, etc. as NONMODAL will not wait.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Mon Aug 18, 2008 06:58 PM
Antonio Linares wrote:Have you tried to do:

oDlg:SetFocus()

after ACTIVATE DIALOG oDlg ?

Maybe your program execution is giving the focus to some other window, control, etc. as NONMODAL will not wait.


This my code:

DEFINE DIALOG oDlg RESOURCE "WAIT_DIALOG" OF oWnd

       oDlg:lHelpIcon := .F.
       oDlg:cargo     := .F.

       REDEFINE SAY oSay ID 101 OF oDlg FONT oFontBoldGrande

ACTIVATE DIALOG oDlg VALID .F. NOWAIT CENTERED

oSay:setText( "Waiting..." )
oSay:refresh()

oDlg:setFocus()


But, Him set the focus to the window behind my application and, after my execution (is a DO WHILE command), the focus is restored to my application.
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Dialog NOWAIT lost focus at activation!
Posted: Mon Aug 18, 2008 07:06 PM
JĂșlio,

Please test this example and check where the focus is placed:

test.prg
#include "FiveWin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "A window"

   ACTIVATE WINDOW oWnd ;
      ON INIT BuildNonModal()

return nil

function BuildNonModal()

   local oDlg
   
   DEFINE DIALOG oDlg TITLE "A non modal dialog"
   
   ACTIVATE DIALOG oDlg NOWAIT CENTERED
   
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Mon Aug 18, 2008 07:23 PM

Dear Antonio, I provide a small example of my situation for you... I send to your email. Please check it!

Thank you very much!

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Mon Aug 18, 2008 07:29 PM

Please, execute the example with a window behind the .exe

Like a MS-DOS window!!

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Dialog NOWAIT lost focus at activation!
Posted: Tue Aug 19, 2008 06:04 AM

Our example runs the same if there is an open window in the background.

We wait for your example, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Tue Aug 19, 2008 11:25 AM
Antonio Linares wrote:Our example runs the same if there is an open window in the background.

We wait for your example, thanks


I have already sent to you Antonio. But, take the link to download:
http://rapidshare.com/files/138461123/nonmodal.zip.html

I think I explained to you that the wrong way, sorry... The main window is that it loses the focus when the dialog is closed!
When the dialog nonmodal is ended, the focus goes to any other different window of main window, like a MS-DOS window behind the .EXE

Please do my example with a another window behind the .EXE like the MS-DOS window!

With my application, the effect appears like a blink!
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 12:17 PM

I need some help for this!

Someone?

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 03:23 PM

Julio,

I can't figure out what you are trying to do. I looked at your code and you are creating a non-modal dialog and then trying to make it act like a modal dialog by disabling the main window. What is the point? Why not use a modal dialog. A modal dialog automatically disables the main window until it is closed. If you do this then you don't have a problem.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 03:27 PM
James Bott wrote:Julio,

I can't figure out what you are trying to do. I looked at your code and you are creating a non-modal dialog and then trying to make it act like a modal dialog by disabling the main window. What is the point? Why not use a modal dialog. A modal dialog automatically disables the main window until it is closed. If you do this then you don't have a problem.

James


James, is it! But, I need to execute a code out of the modal dialog and I think it is the unique way to do! Then, I have disabled the window for execute the code.

The main window opens the dialog non-modal and the non-modal dialog disable the main window. The main window execute a code and close the dialog. Something like this!

Exists another way to do it?
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 03:49 PM

Julio,

>Exists another way to do it?

Just execute your code from a modal dialog. The main window will remain disabled until the dialog is closed.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 04:02 PM
James Bott wrote:Julio,

>Exists another way to do it?

Just execute your code from a modal dialog. The main window will remain disabled until the dialog is closed.

James


Ok James, but the code will be execute by the main window, not by the non-modal dialog :-)
For this, a modal dialog will not permit the execution... right?
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 04:12 PM
Julio,

>Ok James, but the code will be execute by the main window, not by the non-modal dialog
>For this, a modal dialog will not permit the execution... right?

Here is a working example:

#include "fivewin.ch"

function main()
   local oWnd
   define window oWnd
   activate window oWnd on init doit()
return nil

function doit()
   local oDlg, oBtn
   define dialog oDlg
   @ 1,1 button oBtn action msgInfo("Test process called from modal dialog")
   activate dialog oDlg
return nil


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Dialog NOWAIT lost focus at activation!
Posted: Wed Aug 20, 2008 04:58 PM
James Bott wrote:Julio,

>Ok James, but the code will be execute by the main window, not by the non-modal dialog
>For this, a modal dialog will not permit the execution... right?

Here is a working example:

#include "fivewin.ch"

function main()
   local oWnd
   define window oWnd
   activate window oWnd on init doit()
return nil

function doit()
   local oDlg, oBtn
   define dialog oDlg
   @ 1,1 button oBtn action msgInfo("Test process called from modal dialog")
   activate dialog oDlg
return nil


James


Please James, try to download this mini-example... You will understanding my question! And thank for you patience!

http://rapidshare.com/files/138461123/nonmodal.zip.html
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9