FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveLinux / FiveDroid (Android) SendKey() y Printer en Fivelinux
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 06:14 PM

A Antonio y a los compañeros del foro que han trabajado con Fivelinux si por favor me pueden orientar en lo siguiente:
a) Existe un equivalente a SendKey() en FiveLinux?
b) Que otra libreria se debe enlazar para utilizar el printer con FiveLinux ya que libgnomeprintui2 no esta disponible.

Saludos,

George

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 08:17 PM
George,

Como FiveLinux usa GTK podemos usar gdk_event_put() como se explica aqui:

https://mail.gnome.org/archives/gnome-devel-list/2002-August/msg00093.html

Pero según comentan aqui, no funciona correctamente y al parecer se puede usar XTestFakeKeyEvent():

https://mail.gnome.org/archives/gtk-app-devel-list/2003-November/msg00312.html

pero esa función pertenece a X11 y habría que usar esta librería: libx11-dev:

http://stackoverflow.com/questions/5299989/x11-xlib-h-not-found-in-ubuntu

No lo he probado, asi que no se si servirá
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 08:24 PM
George,

b) Que otra libreria se debe enlazar para utilizar el printer con FiveLinux ya que libgnomeprintui2 no esta disponible


Por lo visto GTK proporciona un "High-level Printing API":

https://developer.gnome.org/gtk3/stable/gtk3-High-level-Printing-API.html

Habría que probarlo con FiveLinux
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 08:26 PM

George,

Que distribución de Linux estás usando ? Debian, Ubuntu, ... ?

32 ó 64 bits ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 09:05 PM
Gracias Antonio por tus sugerencias.
He visto en el foro el siguiente codigo, referente a SendKey(), que tu publicaste para Fivewin:
HB_FUNC( FW_SENDKEY )
{
if( hb_parni( 2 ) == 0 )
keybd_event( ( BYTE ) hb_parni( 1 ), ( BYTE ) hb_parni( 2 ),
KEYEVENTF_EXTENDEDKEY | 0, 0 );
else
keybd_event( ( BYTE ) hb_parni( 1 ), ( BYTE ) hb_parni( 2 ),
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
}

Seria posible convertirlo a FiveLinux?

Por otro lado estoy usando Fivelinux en la Raspberry-Pi 2 bajo Raspbian (una version de DEBIAN para las Raspberry-Pi).
Tengo entendido que la RASPI-2 corre a 32 Bits

Saludos,

George
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 09:17 PM

Antonio,
He estado revisando el codigo get de Fivelinux y puedo interceptar ahi ciertas teclas pero lo que necesito hacer es saltar de un control al proximo control cuando se presione la tecla [ENTER]
En Fivewin usamos "::oWnd:GoNextCtrl( ::hWnd ). Tenemos un metodo equivalente en Fivelinux?

Saludos,

George

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 09:20 PM

George,

la función keybd_event() es sólo para Windows. Tendríamos que probar de la forma que comentan en esos mensajes.

Voy a ver si puedo instalar Raspbian 32 bits en VirtualBox

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 09:32 PM
George,

Prueba a añadir este método en la clase TWindow:
Code (fw): Select all Collapse
METHOD GoNextCtrl( hWnd ) CLASS TWindow

   local nAt := AScan( ::aControls, { | oCtrl | oCtrl:hWnd == hWnd } )

   if nAt != 0
      if nAt < Len( ::aControls )
         ::aControls[ nAt + 1 ]:SetFocus()
      else
         ::aControls[ 1 ]:SetFocus()
      endif
   endif

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 10:09 PM
Raspbian is a distribution for ARM processors. Raspbian cannot run in VirtualBox.


I don't have a Raspberri at hand... :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 10:11 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 10:22 PM
Antonio,
Lo que me enviaste funciona perfecto dentro de la clase GET usando solo el codigo

case nKey == K_ENTER
::aControls[nControl]:SetFocus()

Mas adelante integrare el metodo a la clase TWindow para hacerlo mas generico.

Si quieres te envio a tu correo las libreria de FiveLinux que genere para las RASPI-2 y los fuentes utilizados.

Saludos,

George
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SendKey() y Printer en Fivelinux
Posted: Thu Feb 11, 2016 10:27 PM

George,

Muy bien :-)

Si, por favor, envíamelo. Gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion