In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

OCX y eventos.

Foro público de Xailer en español
Responder
rafa
Mensajes: 119
Registrado: Vie Ene 16, 2009 9:59 am

OCX y eventos.

Mensaje 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. )
rafa
Mensajes: 119
Registrado: Vie Ene 16, 2009 9:59 am

OCX y eventos.

Mensaje 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
rafa
Mensajes: 119
Registrado: Vie Ene 16, 2009 9:59 am

OCX y eventos.

Mensaje 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
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

OCX y eventos.

Mensaje 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
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Responder