Dialog NOWAIT does not go to background

Dialog NOWAIT does not go to background

Postby reinaldocrespo » Thu Jun 30, 2011 8:06 pm

Hi.

When a dialog is activated with the NOWAIT clause, it always stays on the foreground even if it looses focus. How can I make the dialog go to the background when it looses focus?

Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Dialog NOWAIT does not go to background

Postby ukoenig » Thu Jun 30, 2011 9:11 pm

Reinaldo,

You can use oDlg:Hide() and oDlg:Show()
I use it, to switch between Window- and Dialog-preview :
Maybe there is still another possible Solution, but it works fine for me.

// Shows the hidden Dialog from a Main-window-action ( Button )

...
...
DEFINE WINDOW oWnd ;
TITLE 'Background-, Title-, xBrowse-, Logo-, Border- and Font-editor => Release 1.1 / June 2011'

@ nSHeight - 130, nSWidth - 260 BTNBMP oBtn1 OF oWnd ;
SIZE 100, 50 PIXEL 2007 ;
NOBORDER ;
PROMPT " &Tools" ;
FILENAME c_path + "\Bitmaps\Select.Bmp" ;
ACTION oDlg:Show() ;
FONT oFont1 ;
LEFT
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "Exit " + CRLF + "Title and Border","EXIT", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )

...
...
// The Main-window is visible
// The Dialog is called ON INIT, oDlg is defined in the Main-window

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT ( WND_BRUSH( nWStyle, lWGrad, nWColorF, nWColorB, nWPos, cWBrush, cWImage ) , ;
SHOW_DLG(oDlg) , oDlg:Hide() ) ;
ON PAINT ( ABPaint( hDC, 50, 50, oLogo, 255 ), ;
NEW_LOGO(hDC) )

oLogo:End()
oWndLogo:End()
oFont1:End()
oBrwFont:End()
oTitleFont:End()

RETURN NIL

// -----

FUNCTION SHOW_DLG(oDlg)
Local oBtn1, oBtn2

DEFINE DIALOG oDlg SIZE 950, 600 OF oWnd PIXEL TRANSPARENT ;
FONT oFont1 TITLE 'Title- / xBrowse- and Border-painter'
...
...
...
// Hide the Dialog and show the Main-window

@ 265, 355 BTNBMP oBtn1 OF oDlg ;
SIZE 60, 30 PIXEL 2007 ;
NOBORDER ;
PROMPT " &Close" + CRLF + " Painter" ;
FILENAME c_path + "\Bitmaps\Quit.Bmp" ;
ACTION ( oDlg:Hide(),oWnd:Refresh() ) ;
FONT oFont1 ;
LEFT
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "Switch to " + CRLF + "Main-window","SWITCH-Preview", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )

@ 265, 423 BTNBMP oBtn16 OF oDlg ;
SIZE 45, 30 PIXEL 2007 ;
NOBORDER ;
PROMPT " Exit" ;
FILENAME c_path + "\Bitmaps\Quit.Bmp" ;
ACTION ( oDlg:End(), oWnd:End() ) ;
FONT oFont1 ;
LEFT
oBtn16:lTransparent := .t.
oBtn16:cToolTip = { "Exit " + CRLF + "Title and Border","EXIT", 1, CLR_BLACK, 14089979 }
oBtn16:SetColor( 0, )

ACTIVATE DIALOG oDlg CENTERED NOWAIT

RETURN NIL

Hides the Dialog ( Visible on Button-action ) :

Something about the new Tool :
The Userlogo ( Olga.jpg ) is converted to a Alphablended BMP with Pixelformer,
to show a transparent-level.
From inside the Tool, the BMP is resized ( possible from -50% to + 20% ) and a transparent-level is defined.
As well it is possible, to adjust the Position on Screen.

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Dialog NOWAIT does not go to background

Postby reinaldocrespo » Thu Jun 30, 2011 10:40 pm

Uko;

Thank you for the reply. It is enlightening. However, I would much rather not hide the dialog. I only want it to go to the background and still show any part not covered by the dialog that gains new focus. and by clicking on any exposed area of the dialog it will again gain focus and move to the foreground. Help?



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Dialog NOWAIT does not go to background

Postby ukoenig » Thu Jun 30, 2011 11:23 pm

Reinaldo,

another Solution :
using a Window instead of a Dialog.
Please have a look at Sample : Testwnds.prg
( shows 2 Windows )

or using a Dialog ( the Dialog will be always on Top of the Window ) :
instead of oDlg:Hide() / oDlg:Show(), You could use :

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT ( SHOW_DLG(), oDlg:Move( 50, 50, 200, 150, .T. ) ) // Resize to any Size on a defined Screenposition

and for the Dialog :

oDlg:bLClicked :={|| oDlg:Move( 20, 20, 950, 600, .T. ) } // on Click restore to the original Position and Size
ACTIVATE DIALOG oDlg CENTERED NOWAIT

Best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Dialog NOWAIT does not go to background

Postby Natter » Fri Jul 01, 2011 5:27 am

DEFINE WINDOW oWnd

@ 0,0 SAY oSy PROMPT "" OF oWnd PIXEL

DEFINE DIALOG oDlg FROM 0,0 TO 0,0 PIXEL OF oSy ;
STYLE nOr( WS_VISIBLE, WS_CHILD)

ACTIVATE WINDOW oWnd MAXIMIZED ON INIT My_Ini()

procedure My_Ini
ACTIVATE DIALOG oDlg NOWAIT VALID .F.
return

If I understand right
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Dialog NOWAIT does not go to background

Postby ukoenig » Sat Jul 02, 2011 10:10 am

I think, that is what he means :

On start, the Dialog is shown behind the Mainwindow :

Image

A click somewhere on the Dialog visible Area, brings it on Top :
( switching between Window and Dialog )

Image

Iconize Main-Window and keep Dialog visible :

Image

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 68 guests