Página 1 de 1

OCX y eventos.

Publicado: Lun Ago 11, 2008 12:50 pm
por rafa
Tengo una duda, supongo que alguien ya a liado con ello, pero no se como
hacer lo siguiente;
Haciendo un simil con VB6, para seguir más o menos el hilo.
Creo el OCX en el formulario;
METHOD FormInitialize( oSender ) CLASS TForm1
WITH OBJECT ::oPhGantX := TphGantX():New( ::oPanel1 )
:nAlign := alCLIENT
:OnValueChangedGantTime := "changes" // Si hay cambios, lo
indicará aqui.
:Create()
END
RETURN Nil
Creo su corresponiente evento; ( Que según lo que me ha creado Xailer es );
EVENT OnValueChangedGantTime( @utheGant, @utheDataEntity )
METHOD Changes( utheGant, utheDataEntity ) CLASS TForm1
Local tn // As IphDataEntity_Tree2
Local startstr, stopstr // As String
tn = utheDataEntity:Row:TreeNode
startstr = DTOC( utheDataEntity:Start )
stopstr = DTOC( utheDataEntity:Stop )
MsgInfo( "Desde " + StartStr + " hasta " + stopstr )
RETURN NIL
El problema viene dado aqui;
tn = utheDataEntity:Row:TreeNode , esto es un puntero a utheDataEntity.
Pero el mismo EVENT en VB6, que funciona ;
Private Sub phGantX1_OnValueChangedGantTime(ByVal theGant As
phGantXControl.IphGantX, ByVal theDataEntity As
phGantXControl.IphDataEntity_GantTime)
Dim tn As IphDataEntity_Tree2
Dim startstr, stopstr As String
Set tn = theDataEntity.Row.TreeNode
startstr = DateTime.DateValue(theDataEntity.Start)
stopstr = DateTime.DateValue(theDataEntity.Stop)
phGantX1.GridCellValueSet 2, tn.GridRowIndex, startstr, -1
phGantX1.GridCellValueSet 3, tn.GridRowIndex, stopstr, -1
End Sub
Supongo que ese AS phGantXControl.IphDataEntity_GantTime es lo que hace
que no casque, cosa que si ocurre en Xailer/Harbour.
¿ Como se supone que se soluciona esto ? Es decir que ese puntero que me
viene, pueda usarlo como un objeto.
Gracias.
Rafa Carmona
( Lo digo simplemente por curiosidad, me dio por jugar con esto haber
que va saliendo y reportando cosillas. )

OCX y eventos.

Publicado: Lun Ago 11, 2008 1:04 pm
por rafa
Ya intenté hacer algo como un mensaje previamente de Jose A.
obj:= TOleAuto():New( PointerToInt( utheDataEntity ) )
tn = obj:Row:TreeNode
Pero casca;
***************************** Registro de errores
*****************************
Fecha: 08/11/08
Hora: 13:02:54
Memoria libre: 633296
Area actual: 1
------------------------- Información del compilador
--------------------------
Versión Xailer: Xailer 1.9.2 Version 1.9
Compilador: xHarbour build 1.0.0 Intl. (SimpLex) PCode Version: 9
Compilador C/C++: Borland C++ 5.8.0
Plataforma: Windows XP Professional 5.01.2600 Service Pack 2
----------------------- Información detallada del error
-----------------------
Subsistema: 22230388
Código de error: 3
Estado: .F.
Descripción: DISP_E_MEMBERNOTFOUND
Operación: ROW
Argumentos:
Fichero:
Código error SO: 0
Pila de llamadas:
TOLEAUTO:ROW (0)
TFORM1:CHANGES (50)
TPHGANTX:ONVALUECHANGEDGANTTIME (0)
RUNFORM (0)
TAPPLICATION:RUN (209)
MAIN (15)
Saludos
Rafa Carmona

OCX y eventos.

Publicado: Lun Ago 11, 2008 3:55 pm
por rafa
Gracias a Jose F.Gimenez... el error era el mio, y es que el method
estaba mal, pues no recordaba que siempre viene oSender..
Asi que este method;
METHOD Changes( utheGant, utheDataEntity ) CLASS TForm1
Tiene que ser;
METHOD Changes( oSender, utheGant, utheDataEntity ) CLASS TForm1
Entonces, funciona perfectamente!
obj:= TOleAuto():New( PointerToInt( utheDataEntity ) )
tn = obj:Row:TreeNode
Saludos
Rafa Carmona

OCX y eventos.

Publicado: Mar Ago 12, 2008 10:33 am
por jfgimenez
Rafa,
> Gracias a Jose F.Gimenez... el error era el mio, y es que el method estaba
> mal, pues no recordaba que siempre viene oSender..
>
> Asi que este method;
> METHOD Changes( utheGant, utheDataEntity ) CLASS TForm1
>
> Tiene que ser;
> METHOD Changes( oSender, utheGant, utheDataEntity ) CLASS TForm1
>
> Entonces, funciona perfectamente!
Me alegro de que te haya funcionado ;-)
> obj:= TOleAuto():New( PointerToInt( utheDataEntity ) )
Con la nueva versión de xHarbour para Xailer 2.0, ya no hace falta llamar a
PointerToInt(), y se puede hacer directamente:
obj:= TOleAuto():New( utheDataEntity )
--
Un saludo,
José F. Giménez
http://www.xailer.com
http://www.xailer.info