Dialog NOWAIT lost focus at activation!

Dialog NOWAIT lost focus at activation!

Postby JC » Mon Aug 18, 2008 6:12 pm

Why I execute a activation of dialog like this at bellow, the window behind my application is focused?
Code: Select all  Expand view  RUN
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
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » Mon Aug 18, 2008 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Mon Aug 18, 2008 6: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:

Code: Select all  Expand view  RUN
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
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » Mon Aug 18, 2008 7:06 pm

Júlio,

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

test.prg
Code: Select all  Expand view  RUN
#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
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

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

Postby Antonio Linares » Tue Aug 19, 2008 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

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

Postby James Bott » Wed Aug 20, 2008 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby JC » Wed Aug 20, 2008 3: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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby James Bott » Wed Aug 20, 2008 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby JC » Wed Aug 20, 2008 4: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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby James Bott » Wed Aug 20, 2008 4: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:

Code: Select all  Expand view  RUN
#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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby JC » Wed Aug 20, 2008 4: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:

Code: Select all  Expand view  RUN
#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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests