Tengo el siguiente código donde la función KeyPressEvent recive un PHB_ITEM en gpointer pero al convertir no me pasa los valores.
Algo estoy haciendo mal ¿si alguien me puede ayuda?
g_print("%d %s \n", (int)hb_arrayGetNL( aData, 1 ), (char *)hb_arrayGetC( aData, 2 ));
Resultado en Pantalla OK:
65470 XXXXXXXXXX
g_signal_connect ( G_OBJECT( entry_box ), "key_press_event", G_CALLBACK( KeyPressEvent ), (gpointer) aData );
.
.
.
.
.
gboolean KeyPressEvent( GtkWidget * entry, GdkEventKey * event, gpointer aData ) {
PHB_ITEM param = aData;
g_print("%d - %s \n", (int)hb_arrayGetNL(param,1), (char *)hb_arrayGetC(param,2));
Resultado en Pantalla: ( No trae los valores esperados (65470 XXXXXXXXXX) )
0 - (null)
convertir gpointer en data
Re: convertir gpointer en data
Ya lo arregle...
GPtrArray* parray;
parray = g_ptr_array_new ();
g_ptr_array_add (parray, (gpointer) hb_arrayGetNL( aData, 1 ));
g_ptr_array_add (parray, (gpointer) cPicture);
g_signal_connect ( G_OBJECT( entry_box ), "key_press_event", G_CALLBACK( KeyPressEvent ), parray );
.
.
.
.
gboolean KeyPressEvent( GtkWidget * entry, GdkEventKey * event, GPtrArray *aData ) {
guint x = g_ptr_array_index(aData, 0);
gchar *y = g_ptr_array_index(aData, 1);
g_print("%d %s \n", x, y);
GPtrArray* parray;
parray = g_ptr_array_new ();
g_ptr_array_add (parray, (gpointer) hb_arrayGetNL( aData, 1 ));
g_ptr_array_add (parray, (gpointer) cPicture);
g_signal_connect ( G_OBJECT( entry_box ), "key_press_event", G_CALLBACK( KeyPressEvent ), parray );
.
.
.
.
gboolean KeyPressEvent( GtkWidget * entry, GdkEventKey * event, GPtrArray *aData ) {
guint x = g_ptr_array_index(aData, 0);
gchar *y = g_ptr_array_index(aData, 1);
g_print("%d %s \n", x, y);