Force dialog to foreground
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Force dialog to foreground
A client has problems because a popup dialog sometimes reverts to the background and he cant see it. Is there a command that can force a dialog to stay in the foreground until it is closed
In this case, an invoice is started in dialog 1. Dialog 2 is called to select the customer. It somehow disappears behind #1. The icon on the task bar does not display the individual screens ( as some programs do ) so its hard to retrieve the dialog back to the desired one. If dialog 1 is closed #2 is visible, but since it sends data back to 1, it crashes the system.
So I need to keep it forced to the foreground. This is NOT an MDI program so that is not the issue
Sent from my iPhone using Tapatalk
In this case, an invoice is started in dialog 1. Dialog 2 is called to select the customer. It somehow disappears behind #1. The icon on the task bar does not display the individual screens ( as some programs do ) so its hard to retrieve the dialog back to the desired one. If dialog 1 is closed #2 is visible, but since it sends data back to 1, it crashes the system.
So I need to keep it forced to the foreground. This is NOT an MDI program so that is not the issue
Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- cmsoft
- Posts: 1297
- Joined: Wed Nov 16, 2005 9:14 pm
- Location: Mercedes - Bs As. Argentina
- Been thanked: 2 times
Re: Force dialog to foreground
Tim:
Prueba con
Prueba con
Code: Select all | Expand
.....
ACTIVATE DIALOG oDlg CENTER ON INIT DlgOnTop( .t.,oDlg:hWnd )
function DlgOnTop( lState, hWnd )
local nRet := 0
DEFAULT hWnd := GetActiveWindow()
if !lState
nRet = AcpOnTop( hWnd, -2, 0, 0, 0, 0, 3 )
else
nRet = AcpOnTop( hWnd, -1, 0, 0, 0, 0, 3 )
endif
return nRet
dll32 static function AcpOnTop( hWnd AS LONG, hWndInsertAfter AS LONG, x AS LONG, y AS LONG, cx AS LONG, cy AS LONG, wFlags AS LONG ) ;
AS LONG PASCAL FROM "SetWindowPos" LIB "User32.dll"
- karinha
- Posts: 7935
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Force dialog to foreground
Good afternoon, what is a pop-up dialog? Do you have any models?
Regards, saludos.
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: Force dialog to foreground
hi Tim,
try this
using HWND_TOPMOST will do the Job
try this
Code: Select all | Expand
ACTIVATE DIALOG oDlg ON INIT MakeTop( oDlg, oListbox ) CENTER
PROCEDURE MakeTop( oWnd, o1stFocus )
LOCAL oTimer
DEFAULT o1stFocus := oWnd
SetWindowPos( oWnd:hWnd, HWND_TOPMOST, ;
oWnd:nTop, oWnd:nLeft, ;
oWnd:nWidth, oWnd:nHeight, nOr( SWP_NOMOVE, SWP_NOSIZE ) )
oWnd:SetFocus()
o1stFocus:SetFocus()
RETURN
greeting,
Jimmy
Jimmy
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Force dialog to foreground
Karinha,
A popup dialog is one called from another dialog. My post gave an example. In this case the popup ( secondary ) dialog is for looking up ( or adding ) a client and a vehicle being serviced. Because it’s two databases a simple list doesnt work
Sent from my iPhone using Tapatalk
A popup dialog is one called from another dialog. My post gave an example. In this case the popup ( secondary ) dialog is for looking up ( or adding ) a client and a vehicle being serviced. Because it’s two databases a simple list doesnt work
Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- mauri.menabue
- Posts: 163
- Joined: Thu Apr 17, 2008 2:38 pm
Re: Force dialog to foreground
Hi All,
Tim, check if the child popup dialog has the 'OF' clause set with the parent value,
obviously the child popup must be modal.
TIA
Tim, check if the child popup dialog has the 'OF' clause set with the parent value,
obviously the child popup must be modal.
TIA
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Force dialog to foreground
Normally that might work but it can be called from different places. For example it can be called from the main Window or from other dialogs.
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- mauri.menabue
- Posts: 163
- Joined: Thu Apr 17, 2008 2:38 pm
Re: Force dialog to foreground
it is normal, being a customer registry, it can start from the main menu,
but also from the button in the customer field of the invoice, or of the order,
in any case it must have the father's reference as launch parameters.
TIA
Maurizio Menabue
but also from the button in the customer field of the invoice, or of the order,
in any case it must have the father's reference as launch parameters.
Code: Select all | Expand
*----------------------------------------------------------------------------------------------
Function GesClients (oParents, lModal, ....)
*----------------------------------------------------------------------------------------------
LOCAL oDlg
DEFAULT lModal := .F.
IF lModal
DEFINE DIALOG oDlg TRUEPIXEL TITLE "customer registry" SIZE 800, 600 OF oParents
ACTIVATE DIALOG oDlg CENTERED
ELSE
DEFINE DIALOG oDlg TRUEPIXEL TITLE "customer registry" SIZE 800, 600 OF oParents
ACTIVATE DIALOG oDlg CENTERED NOMODAL
ENDIF
return CLI_COD
from invoice
GesClients (oWndInvoice, .T.) MODAL
from order
GesClients (oWndOrder, .T.) MODAL
from Main Menu
GesClients (oWndMain, .F.) NO MODAL
Maurizio Menabue
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Force dialog to foreground
Good point. I will try that
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- reinaldocrespo
- Posts: 979
- Joined: Thu Nov 17, 2005 5:49 pm
- Location: Fort Lauderdale, FL
Re: Force dialog to foreground
Or, if working from inside a Class, I like to always have an ::oOwner property that can be set on object init or down the road. Any dialog is OF ::oOwner.
Just my 2 cents,
Reinaldo.
Just my 2 cents,
Reinaldo.
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Force dialog to foreground
Good point.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit