OCX y eventos.
Publicado: Lun Ago 11, 2008 12:50 pm
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. )
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. )