buenas,
la pregunta lo dice todo, como se hace?
alguna idea?
algún ejemplo?
Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
Quizás sea más fácil comprobar (o incluso forzar) el uso de minúsculas en un textbox, pero depende del uso que le vayas a dar.
Cuéntanos para qué necesitas detectar el estado de la tecla "Bloq Mayús" por si aplica la solución que te propongo.
Saludos
Cuéntanos para qué necesitas detectar el estado de la tecla "Bloq Mayús" por si aplica la solución que te propongo.
Saludos
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
simplemente quiero hacer como veo en algunas web o programas que lo hacen, que al activar el botón bloq mayúsculas se vea un botón y si esta desactivado no se vea.
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
Ah! Puesss, no sé si con el componente gb-desktop-x11 se puede hacer... creo haber leído algo sobre esto.
Investigo y te cuento algo, si no se adelanta vuott (al que le gustan estos problemitas y que seguro soluciona con alguna función externa, jeje)
Saludos
Investigo y te cuento algo, si no se adelanta vuott (al que le gustan estos problemitas y que seguro soluciona con alguna función externa, jeje)
Saludos
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
Functio externa, ora pro nobis !
Last edited by vuott on Thursday, 16 July 2015, 01:59; edited 3 times in total
jguardon escribió:
Functio externa, ora pro nobis !
Last edited by vuott on Thursday, 16 July 2015, 01:59; edited 3 times in total
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
Last edited by vuott on Thursday, 25 June 2020, 15:11; edited 3 times in total
" Audivistis, functiones externae, gementem vocem meam atque flentem ! "
Vamos a utilizar las funciones externas del API de SDL:
Vamos a utilizar las funciones externas del API de SDL:
Library "libSDL-1.2:0.11.4"
Private Const KMOD_CAPS As Integer = 8192
' int SDL_Init(Uint32 flags)
' Initialize the SDL library.
Private Extern SDL_Init(flags As Integer) As Integer
' SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
' Set up a video mode with the specified width, height and bits-per-pixel.
Private Extern SDL_SetVideoMode(width As Integer, height As Integer, bitsperpixel As Integer, flags As Integer) As Pointer
' SDL_Keymod SDLCALL SDL_GetModState(void)
' Get the current key modifier state for the keyboard.
Private Extern SDL_GetModState() As Integer
' void SDL_FreeSurface(SDL_Surface* surface)
' Free an RGB surface.
Private Extern SDL_FreeSurface(surface As Pointer)
' void SDL_Quit(void)
' Clean up all initialized subsystems.
Private Extern SDL_Quit()
Public Sub Main()
Dim i, modifiers As Integer
Dim sf As Pointer
i = SDL_Init(0)
If i <> 0 Then Error.Raise("Imposible inicializar la libreria SDL !")
sf = SDL_SetVideoMode(1, 1, 0, 0)
If sf == 0 Then Error.Raise("Imposible configurar una modalidad video !")
modifiers = SDL_GetModState()
If modifiers And KMOD_CAPS Then Print "Tecla Bloq Mayúsculas: activada !"
SDL_FreeSurface(sf)
SDL_Quit()
End
Private Const KMOD_CAPS As Integer = 8192
' int SDL_Init(Uint32 flags)
' Initialize the SDL library.
Private Extern SDL_Init(flags As Integer) As Integer
' SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
' Set up a video mode with the specified width, height and bits-per-pixel.
Private Extern SDL_SetVideoMode(width As Integer, height As Integer, bitsperpixel As Integer, flags As Integer) As Pointer
' SDL_Keymod SDLCALL SDL_GetModState(void)
' Get the current key modifier state for the keyboard.
Private Extern SDL_GetModState() As Integer
' void SDL_FreeSurface(SDL_Surface* surface)
' Free an RGB surface.
Private Extern SDL_FreeSurface(surface As Pointer)
' void SDL_Quit(void)
' Clean up all initialized subsystems.
Private Extern SDL_Quit()
Public Sub Main()
Dim i, modifiers As Integer
Dim sf As Pointer
i = SDL_Init(0)
If i <> 0 Then Error.Raise("Imposible inicializar la libreria SDL !")
sf = SDL_SetVideoMode(1, 1, 0, 0)
If sf == 0 Then Error.Raise("Imposible configurar una modalidad video !")
modifiers = SDL_GetModState()
If modifiers And KMOD_CAPS Then Print "Tecla Bloq Mayúsculas: activada !"
SDL_FreeSurface(sf)
SDL_Quit()
End
Last edited by vuott on Thursday, 25 June 2020, 15:11; edited 3 times in total
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
buenas, en el proyecto photoManager de pilvalaquarus
encontré este código sencillo y efectivo!!
encontré este código sencillo y efectivo!!
Public Sub CheckCapsLock() 'To check the Caps Lock state
Dim sState As String 'To store the 'Shell' output
Dim siCap As Short 'To store the 'Value' of Caps Lock state
Shell "xset q | grep 'LED mask'" To sState 'Shell command. Result is similar to: - 'auto repeat: on key click percent: 0 LED mask: 00000003'
siCap = Right(Bin(Right(Trim(sState), 1)), 1) 'Get the last binary value, see alternative code below
If siCap Then 'If siCap is not 0 then..
LabelCaps.text = ("Caps Lock is ON") 'Add a message to the Form indicating the Caps Lock is on
Else 'siCap must be 0
LabelCaps.text = "" 'Clear the Caps Lock message
Endif
End
Dim sState As String 'To store the 'Shell' output
Dim siCap As Short 'To store the 'Value' of Caps Lock state
Shell "xset q | grep 'LED mask'" To sState 'Shell command. Result is similar to: - 'auto repeat: on key click percent: 0 LED mask: 00000003'
siCap = Right(Bin(Right(Trim(sState), 1)), 1) 'Get the last binary value, see alternative code below
If siCap Then 'If siCap is not 0 then..
LabelCaps.text = ("Caps Lock is ON") 'Add a message to the Form indicating the Caps Lock is on
Else 'siCap must be 0
LabelCaps.text = "" 'Clear the Caps Lock message
Endif
End
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
Hola, cogier
Sí, exacto. El código si que es efectivo, justamente es algo que se me ocurrió pero no sabia que comando seria válido para hacer lo que tu has hecho.
Perfecto
Gracias.
Nota: Lecheee, si el código de justo encima es igual al de cogier, WoW
Last edited by gambafeliz on Thursday, 25 June 2020, 15:06; edited 1 time in total
cogier escribió:
Hola, cogier
Sí, exacto. El código si que es efectivo, justamente es algo que se me ocurrió pero no sabia que comando seria válido para hacer lo que tu has hecho.
Perfecto
Gracias.
Nota: Lecheee, si el código de justo encima es igual al de cogier, WoW
Last edited by gambafeliz on Thursday, 25 June 2020, 15:06; edited 1 time in total
Subject: Re: Como Detectar Si La Tecla Bloq Mayúsculas Esta Activada O No?
a perdón por dar mal el crédito. Ahora que veo este código reflexiono algo, cuando no sabemos hacer algo por código de gambas siempre se puede hacer con otros códigos ya hechos y resueltos estables etc en este caso el comando xset, tal vez haya mas.
cogier escribió:
a perdón por dar mal el crédito. Ahora que veo este código reflexiono algo, cuando no sabemos hacer algo por código de gambas siempre se puede hacer con otros códigos ya hechos y resueltos estables etc en este caso el comando xset, tal vez haya mas.
Page 1 of 2
You cannot post new topicsYou cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events
This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo
Generation Time: 0.1826s (PHP: -27% SQL: 127%)
SQL queries: 26 - Debug Off - GZIP Enabled