Comportamiento de textbox - Textbox behavior

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
danybones
Posts: 6
Joined: Thu Jan 15, 2009 5:33 pm

Comportamiento de textbox - Textbox behavior

Post by danybones »

Hola, gente!!

Estoy desarrollando una aplicación para calcular precios de venta. Lo pienso usar en una tablet y diseñé botones que emulan los números y la tecla Enter, mucho más grandes que el teclado en pantalla que trae W10. Y tengo un problema cuando interactúo entre los textbox con los parámetros y los botones. Para la respuesta del botón 1 (por ejemplo) uso ON LOSTFOCUS del textbox, así sé cual era el textbox activo al que se le agregará un 1. Luego vuelvo a ese textbox con su contenido más el 1. Espero que hasta ahora se entienda.
El problema que tengo es que al poner foco nuevamente en el textbox con SetFocus, queda resaltado todo su contenido, como cuando se pasa a ese control usando Tab. Y lo soluciono parcialmente colocando el cursor al final con la propiedad CaretPos. Pero así pierdo la capacidad de que lo que ingreso reemplace lo existente (No tengo forma de diferenciar -al pulsar el botón- si el textbox tenía todo en contenido "en azul" o si estaba con el cursor solo). Hay alguna función/propiedad/loquesea que se me está escapando? :?:

Gracias desde ya!
Dany Bones Bielewicz
===============================
Hi people!!

I am developing an application to calculate sales prices. I plan to use it on a tablet and I designed buttons that emulate the numbers and the Enter key, much larger than the on-screen keyboard that W10 brings. And I have a problem when I interact between textboxes with parameters and buttons. For the response of button 1 (for example) I use ON LOSTFOCUS of the textbox, so I know which was the active textbox to which a 1. will be added. Then I return to that textbox with its content plus 1. I hope that it is understood.
The problem I have is putting focus back on the textbox with SetFocus, all its content is highlighted, like when you pass that control using Tab. I partially solve it by placing the cursor at the end with the CaretPos property. But this way I lose the ability for what I enter to replace what exists (I have no way of differentiating -by pressing the button- if the textbox had everything in content "in blue" or if it was with the cursor only). Is there any function / property / whatever is escaping me? :?:

Thanks since now!
Dany Bones Bielewicz
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Comportamiento de textbox - Textbox behavior

Post by AUGE_OHR »

hi,
danybones wrote: Sat Apr 04, 2020 12:38 am The problem I have is putting focus back on the textbox with SetFocus ...
a own "OSK" have 2 Problem :

a.) to "Enter" a Key the "OSK" must be in Foreground -> your App is in Background
b.) you have save "last" Control with LOSTFOCUS ... so how your "OSK" get these Information "where" to send Keystoke :?:

if your "OSK" is a Modul "in" your App you might be able to find a HMG Solution ... like SETFOCUS() or KEYBOARD()
if your "OSK" is a external App than you need Windows Way with

Code: Select all

   SendMessage( hWnd,WM_SETTEXT, 0, cText+CHR(0) )
so your "OSK" must get Handle of TEXTBOX

Code: Select all

   hWnd:= GetControlHandle( cObj, cForm )
... or "search it" with FindWindow() / FindWindowEx()
have fun
Jimmy
Post Reply