Minimize Dialog and Window too

Minimize Dialog and Window too

Postby MarcoBoschi » Fri Jan 21, 2011 5: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
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby Enrico Maria Giordano » Fri Jan 21, 2011 10:28 pm

This sample seems to work fine here:

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Minimize Dialog and Window too

Postby MarcoBoschi » Sat Jan 22, 2011 8:32 am

Enrico,
you forgot the window that contains the dialog

marco
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Minimize Dialog and Window too

Postby MarcoBoschi » Sun Jan 23, 2011 9: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
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby Enrico Maria Giordano » Sun Jan 23, 2011 11:43 am

I just tried everything to no avail, sorry.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Minimize Dialog and Window too

Postby James Bott » Sun Jan 23, 2011 7:07 pm

Marco,

Instead of a dialog use a panel.

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

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Minimize Dialog and Window too

Postby MarcoBoschi » Mon Jan 24, 2011 9: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
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby MarcoBoschi » Mon Jan 24, 2011 9: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
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby anserkk » 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
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Minimize Dialog and Window too

Postby MarcoBoschi » 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
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby nageswaragunupudi » Mon Jan 24, 2011 11:30 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Minimize Dialog and Window too

Postby nageswaragunupudi » Mon Jan 24, 2011 11:40 am

Is this what you are looking for?
Code: Select all  Expand view  RUN
#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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Minimize Dialog and Window too

Postby MarcoBoschi » Mon Jan 24, 2011 2:20 pm

No thank you
When You iconize Dialog it remains over application bar!
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Minimize Dialog and Window too

Postby MarcoBoschi » Mon Jan 24, 2011 2: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
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 10 guests

cron