FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Window y Dialog
Posts: 485
Joined: Fri Feb 09, 2007 10:34 AM
Window y Dialog
Posted: Tue Nov 03, 2009 06:54 PM

Muy buenas foro, tengo un programa que me muestra un dialogo, pero le he añadido una funcion que se tiene que conectar por socket, entonces tuve que crear una windows para los sockets, cuando tengo el valor necesario, cierro la window y los sockets, y cuando voy a cargar el dialogo no se carga, se que es por la window, pero no se como solucionarlo, aqui teneis mas o menos el código:

SI COMENTO LA LINEA cIP:=GetPublicIP() me carga el dialogo.

function main()
local cIP
cIP:=GetPublicIP()
define dialog oDlg resource "CDILAUNCHER"
...
...
activate dialog oDlg center

return

function GetPublicIP(cServer,cWeb)
local oWnd,cIP:="",nI:=0,nF:=0
public cTextWeb:=""
default cServer:="xxx",cWeb:="xxx"
define window oWnd title "GetPublicIP" from -100, -100 to -100, -100
activate window oWnd on init (GetIPWeb(cServer,cWeb,@oWnd))
cIP:=cTextWeb
release cTextWeb
if !empty(cIP)
nI:=at('<b>',cIP)
nF:=at('</b>',cIP)
if nI<>0 .and. nF<>0
cIP:=substr(cIP,nI+3,nF-nI-3)
end if
end if
return cIP
static function GetIPWeb(cServer,cWeb,oWnd)
local oWebClient
oWebClient:=TWebClient():New()
oWebClient:Connect(cServer)
oWebClient:bOnRead = { |cData| (cTextWeb+=cData,oWnd:end()) }
oWebClient:oSocket:SendData( "GET "+cWeb+" HTTP/1.0" + CRLF +"Host: "+cServer+ CRLF +CRLF )
return

Un Saludo.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Window y Dialog
Posted: Tue Nov 03, 2009 07:34 PM
Juan,

La primera ventana ó diálogo que creas en FiveWin se establece como ventana principal, de tal forma, que al cerrarse, FiveWin entiende que se va a terminar la aplicación, y se inicia un proceso de cierre automatico.

Como quieres que el diálogo sea tu "ventana" principal, prueba a hacerlo asi:
Code (fw): Select all Collapse
DEFINE DIALOG oDlg

ACTIVATE DIALOG oDlg ON INIT ( cIP:=GetPublicIP() )
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion