FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Minimize Dialog and Window too
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Minimize Dialog and Window too

Posted: Mon Jan 24, 2011 06:53 PM

Marco,

One side affect of your last code is that when you attempt to resize the window/dialog it minimizes. This is unexpected to the user.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Minimize Dialog and Window too

Posted: Mon Jan 24, 2011 07:09 PM

Marco,

A solution to the problem is to add BORDER NONE to the DEFINE WINDOW line. This prevents resizing. You could also add the NOMAXIMIZE clause.

DEFINE WINDOW oWnd FROM 1000 , 1000 TO 1000 , 1000 nomaximize border none

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Minimize Dialog and Window too

Posted: Mon Jan 24, 2011 07:19 PM
Marco,

I am wondering why you want to be able to minimize a dialog? Users will not expect to be able to do this as it is standard behavior for dialogs not to be minimizable.

If the issue is only the need and presence of the window, then what about just hiding the window?

oWnd:hide()

That provides you with the window that is required for a socket but the user cannot see the window--only the dialog.

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

function main()
   local oWnd
   define window oWnd from -100,-100 to -99,-99
   activate window oWnd on init Start()
return nil

function Start()
   local oDlg
   wndMain():hide()
   define dialog oDlg
   activate dialog oDlg center
   wndMain():end()
return nil

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: Tue Jan 25, 2011 08:10 AM

>One side affect of your last code is that when you attempt to resize the window/dialog it >minimizes. This is unexpected to the user.

It's a very simple program: no window, no menu only a dialog and user often iconize it.

Marco Boschi
info@marcoboschi.it
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Minimize Dialog and Window too

Posted: Tue Jan 25, 2011 08:44 AM
Code (fw): Select all Collapse
oWnd:hide()
It is better to ACTIVATE WINDOW oWnd HIDDEN. The window does not even flash.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Minimize Dialog and Window too

Posted: Tue Jan 25, 2011 09:09 AM
The main issue is that Mr. Marco wants to have a Socket client ( not server ) with Dialog only which can be minimized to taskbar. We are talking about creating a window and hiding it only because WndMain() is required.

The TSocket():New( nPort, oWnd ) accepts oWnd as second parameter.
Code (fw): Select all Collapse
METHOD New( nPort, oWnd ) CLASS TSocket

   DEFAULT oWnd := WndMain(), ::aSockets := {}

   if Len( ::aSockets ) == 0
      if WSAStartup() != 0
         MsgAlert( "WSAStartup error" )
      endif
   endif

   if ( ::nSocket := Socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) == 0
      MsgAlert( "Socket creation error: " + Str( WsaGetLastError() ) )
   endif

   ::cIPAddr  = GetHostByName( GetHostName() )
   ::aBuffer  = {}
   ::lSending = .f.
   ::lDebug   = .f.

   if nPort != nil
      ::nPort = nPort
      BindToPort( ::nSocket, nPort )  // Bind is not needed for connect sockets
   endif

   AAdd( ::aSockets, Self )

   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

return Self

//----------------------------------------------------------------------------//

WndMain() is expected only if the second paramter oWnd is not supplied.
Have you tried creating socket client with TSocket():New( nPort, oDlg ) ?
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Minimize Dialog and Window too

Posted: Tue Jan 25, 2011 11:02 AM
Rao,

It is better to ACTIVATE WINDOW oWnd HIDDEN. The window does not even flash.


I didn't know about the HIDDEN clause. That is why I drew the window off the screen so it doesn't flash.

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: Tue Jan 25, 2011 03:33 PM

Probably I have to go in this direction:

  • no initial Window so I have no problem When I iconize the dialog
  • I Have to create a dummy window (or hide) when I create oTelnet object

    IF oTelnet = NIL

    oTelnet := TSocket():New( nPorta )
    oTelnet:Connect( cIp )
    oTelnet:lDebug := .T.

It looked like a small problem but...pain

Many thanks guys

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: Minimize Dialog and Window too

Posted: Tue Jan 25, 2011 03:58 PM

>WndMain() is expected only if the second paramter oWnd is not supplied.
>Have you tried creating socket client with TSocket():New( nPort, oDlg ) ?

It seems a good solution
Now I remove window and I review all involved functions
Thank You very much!

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: Minimize Dialog and Window too

Posted: Wed Jan 26, 2011 10:56 AM

I confirm
In this way

IF oTelnet = NIL
oTelnet := TSocket():New( nPorta, oDlg )

now my program works fine without a window

Thanks again
marco

Marco Boschi
info@marcoboschi.it
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Minimize Dialog and Window too

Posted: Wed Jan 26, 2011 02:48 PM

Glad to know it works.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion