Dialog NOWAIT lost focus at activation!

User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Dialog NOWAIT lost focus at activation!

Post by JC »

Why I execute a activation of dialog like this at bellow, the window behind my application is focused?

Code: Select all | Expand

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
User avatar
Antonio Linares
Site Admin
Posts: 42511
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Post by Antonio Linares »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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:

Code: Select all | Expand

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
User avatar
Antonio Linares
Site Admin
Posts: 42511
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Post by Antonio Linares »

Júlio,

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

test.prg

Code: Select all | Expand

#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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
Antonio Linares
Site Admin
Posts: 42511
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Post by Antonio Linares »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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:

Code: Select all | Expand

#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
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

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:

Code: Select all | Expand

#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
Post Reply