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
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
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
#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>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.
oWnd:hide()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
//----------------------------------------------------------------------------//It is better to ACTIVATE WINDOW oWnd HIDDEN. The window does not even flash.
Probably I have to go in this direction:
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
>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!
I confirm
In this way
IF oTelnet = NIL
oTelnet := TSocket():New( nPorta, oDlg )
now my program works fine without a window
Thanks again
marco
Glad to know it works.