convertir gpointer en data

convertir gpointer en data

Postby jgayoso » Tue Aug 04, 2020 3:57 pm

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)
jgayoso
 
Posts: 170
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile

Re: convertir gpointer en data

Postby jgayoso » Tue Aug 04, 2020 8:32 pm

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);
jgayoso
 
Posts: 170
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 25 guests