FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Minimize Dialog and Window too
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Minimize Dialog and Window too
Posted: Fri Jan 21, 2011 05:31 PM

Hi,
I don't remember how to resolve this problem.
I cannot find the example.
When I minimize the dialog it remains over the application bar
I want that it minimizes normally
I can remember how to do it
Thanks in advance

marco

include "fivewin.ch"

FUNCTION MAIN( )
LOCAL oWnd
DEFINE WINDOW oWnd FROM 1000 , 1000 TO 1000 , 1000

ACTIVATE WINDOW oWnd ICONIZED ON INIT ( dialogo( ) , oWnd:end() )

RETURN NIL

FUNCTION DIALOGO
LOCAL oDlg
DEFINE DIALOG oDlg ;
STYLE nOr( WS_POPUP, ;
WS_VISIBLE, ;
WS_CAPTION, ;
WS_THICKFRAME, ;
WS_SYSMENU, ;
WS_MINIMIZEBOX, ;
WS_MAXIMIZEBOX )

ACTIVATE DIALOG oDlg CENTER

RETURN NIL

Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Minimize Dialog and Window too
Posted: Fri Jan 21, 2011 10:28 PM
This sample seems to work fine here:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg;
           STYLE NOR( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX );
           TITLE "This is a test"

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Sat Jan 22, 2011 08:32 AM

Enrico,
you forgot the window that contains the dialog

marco

Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Minimize Dialog and Window too
Posted: Sat Jan 22, 2011 11:53 AM

No, I removed it intentionally as it is not needed. Please try my sample and let me know if it works for you. If it don't then explain what you want to get and I will try to fix my sample.

EMG

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Sun Jan 23, 2011 09:07 AM
EMG,
you wrote "No, I removed it intentionally as it is not needed."
I say: "I need a Window since in a program I use TSocket class instead."

As you can see in tsocket.prg in this method

METHOD New( nPort, oWnd ) CLASS TSocket

if oWnd != nil
oWnd:bSocket = { | nSocket, nLParam | ::HandleEvent( nSocket,;
nLoWord( nLParam ), nHiWord( nLParam ) ) }

WSAAsyncSelect( ::nSocket, oWnd:hWnd, WM_ASYNCSELECT,;
nOr( FD_ACCEPT, FD_OOB, FD_READ, FD_CLOSE, FD_CONNECT, FD_WRITE ) )
else
MsgAlert( "You must create a main window in order to use a TSocket object" )
endif

thanks
marco
Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Minimize Dialog and Window too
Posted: Sun Jan 23, 2011 11:43 AM

I just tried everything to no avail, sorry.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Minimize Dialog and Window too
Posted: Sun Jan 23, 2011 07:07 PM

Marco,

Instead of a dialog use a panel.

oPanel:= TPanel():New( wndMain() )

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 09:02 AM

I have a program with only one dialog.
Window is only for tsocket class.
No I try to do this:
- instead of iconize dialog I close it and iconize Window
- When I maximize window I reopen dialog
I hope,I can think of other solutions

bye

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 09:35 AM

To James and EMG:

How can I test iconized state OF a Dialog or Window?

probably the solution is in this code But now I'm using a generic
::bresized

include "Fivewin.ch"

STATIC oDlg
STATIC oWnd

REQUEST HB_GT_GUI_DEFAULT

FUNCTION MAIN()

DEFINE WINDOW oWnd FROM 1000,1000 TO 1000,1000 PIXEL

oWnd:bResized = { || dialogo() }

ACTIVATE WINDOW oWnd

oDlg:end()

RETURN NIL

FUNCTION DIALOGO( )

tone( 100 , 3 )
DEFINE DIALOG oDlg;
STYLE NOR( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX );
TITLE "This is a test"

oDlg:bResized = { || oDlg:end(), oWnd:Iconize() }

ACTIVATE DIALOG oDlg CENTER
oWnd:End()

RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 10:29 AM
How can I test iconized state OF a Dialog or Window?


IsIconic( <hWnd> ) โ€“> lIconic

The below given fuction may also be useful for you.

To check whether a Window is in maximised state or not
IsZoomed( <hWnd> ) โ€“> lMaximized

Regards
Anser
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 11:11 AM

Anser,
IF you run this sample You never listen the sharp sound (IsIconic)

#include "Fivewin.ch"

REQUEST HB_GT_GUI_DEFAULT

FUNCTION MAIN()

LOCAL oWnd

DEFINE WINDOW oWnd FROM 100 , 100 TO 500 , 500 PIXEL

oWnd:bResized = { || IIF(IsIconic( oWnd ), tone(1000,1), tone(100,1) ) }

ACTIVATE WINDOW oWnd ICONIZED

RETURN NIL

Is not really good day for me :-)
many thanks

Marco Boschi
info@marcoboschi.it
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 11:30 AM

Not
IsIconic( oWnd )
It should be
IsIconic( oWnd:hWnd )

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 11:40 AM
Is this what you are looking for?
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd HIDDEN ON INIT ( MakeDialog(), oWnd:End() )

return nil

static function MakeDialog

   local oDlg

   DEFINE DIALOG oDlg
   oDlg:nStyle    += (WS_MINIMIZEBOX + WS_MAXIMIZEBOX)
   ACTIVATE DIALOG oDlg CENTERED

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 02:20 PM

No thank you
When You iconize Dialog it remains over application bar!

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Minimize Dialog and Window too
Posted: Mon Jan 24, 2011 02:28 PM

Probably this is the solution:
Many thanks

marco

include "Fivewin.ch"

STATIC oDlg
STATIC oWnd

REQUEST HB_GT_GUI_DEFAULT

FUNCTION MAIN()

DEFINE WINDOW oWnd FROM 1000 , 1000 TO 1000 , 1000

oWnd:bResized = { || resize_wnd( ) }

ACTIVATE WINDOW oWnd ICONIZED ON INIT dialogo( )

RETURN NIL

FUNCTION DIALOGO( )

DEFINE DIALOG oDlg;
STYLE NOR( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX );
TITLE "This is a test"

oDlg:bResized = { || resize_dlg( ) }

ACTIVATE DIALOG oDlg CENTER

IF oDlg:nresult = IDOK
oWnd:Iconize()
ELSE
oWnd:end()
ENDIF

RETURN NIL

FUNCTION RESIZE_DLG()
oDlg:end( IDOK )
RETURN NIL

FUNCTION RESIZE_WND()

IF .NOT. IsIconic( oWnd:hWnd )

dialogo()

ENDIF

RETURN NIL

Marco Boschi
info@marcoboschi.it