Hola a todos. Estoy convirtiendo una vieja apliación prehistórica, hecha en clipper Summer '87 (todavía funcionando) a FWH. He hecho una pequeña maqueta con un problema que tengo, por si alguien puede echarme una mano. Muchas gracias.
- Cuando pulso el botón "Abrir ventana" se crea una ventana child.
- Si la cierro pulsando el botón "cerrar ventana" funciona, pero si pulso la tecla escape me da error que adjunto al final.
- Sin embargo, si añado estas dos líneas que están comentadas en la función salir() el programa funciona perfectamente cuando pulso la tecla escape para cerrar la ventana child.
// oLbx:end()
// MsgWait( "cerrando fichero","Salir",0.1 )
Muchas gracias.
Alvaro
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------------------//
function Main()
local oWnd,oBar
local i
local aStru
SET DELE ON
set exclusive off
aStru := { ;
{"CAMPO1" , "C", 20, 0}, ;
{"CAMPO2" , "C", 20, 0} }
dbcreate("pruebas.dbf", aStru)
use pruebas new alias pruebas
for i=1 to 6
dbappend()
dbrlock()
pruebas->campo1:="Registro "+str(i)
dbunlock()
next i
dbcloseall()
DEFINE WINDOW oWnd TITLE "pruebas " MDI
DEFINE BUTTONBAR oBar 3D OF oWnd size 80,40
define button of obar prompt "Abrir ventana" action ventanachild(oWnd)
oWnd:bKeyDown = { | nKey | teclas(nKey,oWnd) }
activate window oWnd valid (ferase("pruebas.dbf"),.t.)
return nil
// -------------------------------------------------------------------------- //
static function ventanachild(oWnd)
local oWnd2,obar
local oLbx
local cAlias
use pruebas new alias (cAlias:=getnewalias("area"))
define window oWnd2 MDICHILD of oWnd color 25, RGB(255,255,255)
DEFINE BUTTONBAR oBar 3D OF oWnd2 size 80,40
define button of obar prompt "Cerrar ventana" action ownd2:end()
@ 50 , 20 LISTBOX oLbx FIELDS (cAlias)->campo1,(cAlias)->campo2 ;
FIELDSIZES 150,150 ;
HEADERS "Campo1", "Campo2" ;
SIZE oWnd2:nWidth-50 , oWnd2:nheight-100 pixel of oWnd2
oLbx:setfocus()
activate window oWnd2 valid salir(oLbx,cAlias) ;
on resize (oLbx:nWidth:=oWnd2:nWidth-50,oLbx:nheight:=oWnd2:nheight-100)
return .t.
// -------------------------------------------------------------------------- //
static function salir(oLbx,cAlias)
// oLbx:end() // ------------------------------------------- descomentar para que funcione
// MsgWait( "cerrando fichero","Salir",0.1 ) // --- descomentar para que funcione
(cAlias)->( DBCLOSEAREA() )
return .t.
//----------------------------------------------------------------------------//
static function teclas(nKey,oWnd)
do case
case nkey=13 // enter
case nkey=27 // escape
oWnd:end()
endcase
return .t.
//----------------------------------------------------------------------------//
function GetNewAlias( cDbfName )
static n := 0
return cDbfName + StrZero( ++n, 4 )
====================== error.log
Application
===========
Path and name: C:\FWH\projects\Pruebas\pruebas.exe (32 bits)
Size: 1,196,032 bytes
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 05/20/08, 00:35:01
Error description: Error BASE/1002 Alias does not exist: fich0002
Stack Calls
===========
Called from: .\source\PRUEBAS.PRG => (b)VENTANACHILD(0)
Called from: => TWBROWSE:DRAWSELECT(0)
Called from: .\source\classes\WBROWSE.PRG => (b)TWBROWSE(0)
Called from: => TWBROWSE:LOSTFOCUS(0)
Called from: => TWBROWSE:KILLFOCUS(0)
Called from: => TWBROWSE:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => SENDMESSAGE(0)
Called from: .\source\classes\WINDOW.PRG => (b)TWINDOW(0)
Called from: => TMDICLIENT:SENDMSG(0)
Called from: => TMDICLIENT:CHILDCLOSE(0)
Called from: => TMDICHILD:END(0)
Called from: => TMDICLIENT:LCLOSEALL(0)
Called from: => TMDIFRAME:END(0)
Called from: .\source\PRUEBAS.PRG => TECLAS(0)
Called from: .\source\PRUEBAS.PRG => (b)MAIN(0)
Called from: => TMDIFRAME:KEYDOWN(0)
Called from: => TWINDOW:KEYDOWN(0)
Called from: => TMDICHILD:KEYDOWN(0)
Called from: => TCONTROL:KEYDOWN(0)
Called from: => TWBROWSE:KEYDOWN(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: => TWBROWSE:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: => TMDIFRAME:ACTIVATE(0)
Called from: .\source\PRUEBAS.PRG => MAIN(0)
System
======
CPU type: Genuine Intel(R) CPU 2140 @ 1.60GHz 1600 Mhz
Hardware memory: 1024 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Compiler version: Harbour devel build 1.1-1 Intl.
Windows version: 5.1, Build 2600 Service Pack 2
Windows total applications running: 49
Variables in use
================
Procedure Type Value
==========================
(b)VENTANACHILD
Param 1: O Class: TWBROWSE
Local 1: U
Local 2: N 0
Local 3: S
TWBROWSE:DRAWSELECT
Local 1: O Class: TWBROWSE
Local 2: S
Local 3: U
Local 4: N 4523452
Local 5: U
Local 6: N 1
(b)TWBROWSE
Param 1: O Class: TWBROWSE
Param 2: N 7603668
TWBROWSE:LOSTFOCUS
Param 1: N 7603668
TWBROWSE:KILLFOCUS
Param 1: N 7603668
Local 1: O Class: TWBROWSE
Local 2: U
TWBROWSE:HANDLEEVENT
Param 1: N 8
Param 2: N 7603668
Param 3: N 0
Local 1: O Class: TWBROWSE
Local 2: U
_FWH
Param 1: N 0
Param 2: N 8
Param 3: N 7603668
Param 4: N 0
Param 5: N 8
Local 1: O Class: TWBROWSE
SENDMESSAGE
Param 1: N 7603668
Param 2: N 545
Param 3: N 1640024
Param 4: U
(b)TWINDOW
Param 1: O Class: TMDICLIENT
Param 2: N 545
Param 3: N 1640024
Local 1: U
TMDICLIENT:SENDMSG
Param 1: N 545
Param 2: N 1640024
TMDICLIENT:CHILDCLOSE
Param 1: O Class: TMDICHILD
Local 1: O Class: TMDICLIENT
Local 2: N 1
TMDICHILD:END
Local 1: O Class: TMDICHILD
Local 2: L .T.
TMDICLIENT:LCLOSEALL
Local 1: O Class: TMDICLIENT
TMDIFRAME:END
Local 1: O Class: TMDIFRAME
TECLAS
Param 1: N 27
Param 2: O Class: TMDIFRAME
(b)MAIN
Param 1: N 27
Param 2: N 65537
TMDIFRAME:KEYDOWN
Param 1: N 27
Param 2: N 65537
Local 1: O Class: TMDIFRAME
Local 2: U
TWINDOW:KEYDOWN
Param 1: N 27
Param 2: N 65537
Local 1: O Class: TMDICHILD
Local 2: U
TMDICHILD:KEYDOWN
Param 1: N 27
Param 2: N 65537
Local 1: O Class: TMDICHILD
TCONTROL:KEYDOWN
Param 1: N 27
Param 2: N 65537
Local 1: O Class: TWBROWSE
TWBROWSE:KEYDOWN
Param 1: N 27
Param 2: N 65537
Local 1: O Class: TWBROWSE
TWINDOW:HANDLEEVENT
Param 1: N 256
Param 2: N 27
Param 3: N 65537
TWBROWSE:HANDLEEVENT
Param 1: N 256
Param 2: N 27
Param 3: N 65537
Local 1: O Class: TWBROWSE
Local 2: U
_FWH
Param 1: N 65537
Param 2: N 256
Param 3: N 27
Param 4: N 65537
Param 5: N 8
Local 1: O Class: TWBROWSE
WINRUN
Param 1: N 9700734
TMDIFRAME:ACTIVATE
Param 1: C "NORMAL"
Param 2: U
Param 3: U
Param 4: U
Param 5: U
Param 6: U
Param 7: B {|| ... }
Param 8: U
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: B {|| ... }
Param 18: U
Param 19: U
Local 1: O Class: TMDIFRAME
Local 2: U
Local 3: U
MAIN
Local 1: O Class: TMDIFRAME
Local 2: O Class: TBAR
Local 3: N 7
Local 4: A Len: 2
Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFNTX
DataBases in use
================
Classes in use:
===============
1 ERROR
2 HBCLASS
3 HBOBJECT
4 TWINDOW
5 TMDIFRAME
6 TMENU
7 TMENUITEM
8 TBRUSH
9 TMDICLIENT
10 TFONT
11 TCONTROL
12 TBAR
13 TRECT
14 TBTNBMP
15 TMDICHILD
16 TWBROWSE
17 TSCROLLBAR
18 TDIALOG
19 TREG32
Memory Analysis
===============
118 Static variables
Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes