Trabajando con gtk con fivelinux

Trabajando con gtk con fivelinux

Postby jgayoso » Tue Dec 06, 2011 3:59 pm

Tengo el siguiente extracto de codigo, pero al mostrar el valor cPaso no me muestra ningun valor y yo esperaba que me mostrara "OPCION-33".
Me compila bien sin errores, pero no hace lo esperado.
Estoy con trabajando con FiveLinux y Linux Suse.

Desde ya se agradece cualquier ayuda.



Local oDlg, oBtn,oBtn2,cPaso

DEFINE DIALOG oDlg SIZE nAnchoDialogo, nAltoDialogo
@ nL, nC BUTTON oBtn PROMPT "OPCION-1" OF oDlg SIZE nLB*nAnchoLetra,nAltoLetra ACTION ( nSeleccion:=1, lExit := .T., oDlg:End() )
@nL, nC BUTTON oBtn2 PROMPT "OPCION-2" OF oDlg SIZE nLB*nAnchoLetra,nAltoLetra ACTION ( nSeleccion:=2, lExit := .T., oDlg:End() )

gtk_button_set_label(oBtn,"OPCION-33")
cPaso:=gtk_button_get_label(oBtn)

ACTIVATE DIALOG oDlg VALID lExit CENTER

msgalert(cPaso)



#IfDef __FIVELINUX__

#pragma BEGINDUMP

#include <gtk/gtk.h>
#include "hbapi.h"

HB_FUNC( GTK_BUTTON_GET_LABEL ) // widget -> cExt
{
gchar *cText;
gchar *msg;
cText = ( gchar *) gtk_button_get_label( GTK_BUTTON( hb_parptr( 1 ) ) );
msg = ( gchar *) g_convert( cText, -1,"ISO-8859-1","UTF-8",NULL,NULL,NULL );
hb_retc( ( gchar * ) msg );
}

HB_FUNC( GTK_BUTTON_SET_LABEL ) // widget, cText
{
gchar *msg = g_convert( hb_parc(2), -1,"UTF-8","ISO-8859-1",NULL,NULL,NULL );
gtk_button_set_label( GTK_BUTTON( hb_parptr( 1 ) ), msg );
}

#pragma ENDDUMP
#Endif
jgayoso
 
Posts: 170
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile

Re: Trabajando con gtk con fivelinux

Postby Daniel Garcia-Gil » Tue Dec 06, 2011 5:48 pm

Hola

estas pasando un objeto a la funcion en C, debes pasar el handle (que esta representado por un numero y no por un puntero), entonces pienso que deberia quedar de esta manera

desde PRG

Code: Select all  Expand view
gtk_button_set_label(oBtn:hWnd,"OPCION-33")
cPaso:=gtk_button_get_label(oBtn:hWnd)


desde C, cambia estas lineas

Code: Select all  Expand view
( gchar *) gtk_button_get_label( ( GtkButton * ) hb_parnl( 1 ) );


Code: Select all  Expand view
  gtk_button_set_label( ( GtkButton * ) hb_parnl( 1 ), msg );
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Trabajando con gtk con fivelinux

Postby Antonio Linares » Tue Dec 06, 2011 7:44 pm

Jorge,

Cambia estas líneas:

gtk_button_set_label(oBtn,"OPCION-33")
cPaso:=gtk_button_get_label(oBtn)

por:

oBtn:SetText( "OPCION-33" )
cPaso = oBtn:GetText()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41283
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 3 guests