Seleccionar todo el texto en un TextBox
Moderator: Rathinagiri
Re: Seleccionar todo el texto en un TextBox
Muchas gracias Maestro Roberto.
Rafael Pérez
Rafael Pérez
Re: Seleccionar todo el texto en un TextBox
Hola Roberto.
Lamento tener que darte tanto la lata, pero es que he buscado las API de Windows y son muchísimas.
Me gustaría saber cuales son las que usa internamente HMG aparte de las tres que me has indicado.
Muy agradecido
Rafael Pérez
Lamento tener que darte tanto la lata, pero es que he buscado las API de Windows y son muchísimas.
Me gustaría saber cuales son las que usa internamente HMG aparte de las tres que me has indicado.
Muy agradecido
Rafael Pérez
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Seleccionar todo el texto en un TextBox
HMG uses LOTS of WInAPi functions.arroya2 wrote:Hola Roberto.
Lamento tener que darte tanto la lata, pero es que he buscado las API de Windows y son muchísimas.
Me gustaría saber cuales son las que usa internamente HMG aparte de las tres que me has indicado.
Muy agradecido
Rafael Pérez
You should look at sources.
Regards,
Roberto.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Seleccionar todo el texto en un TextBox
Supongo que se refiere a las fuentes de HMG. ¿De dónde me las puedo bajar?Roberto Lopez wrote:HMG uses LOTS of WInAPi functions.arroya2 wrote:Hola Roberto.
Lamento tener que darte tanto la lata, pero es que he buscado las API de Windows y son muchísimas.
Me gustaría saber cuales son las que usa internamente HMG aparte de las tres que me has indicado.
Muy agradecido
Rafael Pérez
You should look at sources.
Regards,
Roberto.
Muchas gracias y saludos.
Rafael Pérez
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Seleccionar todo el texto en un TextBox
You can see them from c:\hmg\source\*.c
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Seleccionar todo el texto en un TextBox
I've returnd to this Idea, but, as I observed, this SendMessage causes selection only from mouse cursor to end of the field.gfilatov wrote: Hello Mol,
Take a look for the following sample:Code: Select all
#include "minigui.ch" Function Main DEFINE WINDOW Form_1 ; AT 0,0 ; WIDTH 640 HEIGHT 480 ; TITLE 'Test' ; MAIN ; ON INIT OnInit( 'Text_2' , 'Form_1' ) @ 50,10 TEXTBOX Text_1 ; VALUE 123 ; FONT 'Verdana' SIZE 12 ; TOOLTIP 'Numeric TextBox' ; NUMERIC ; MAXLENGTH 5 @ 100,10 TEXTBOX Text_2 ; VALUE "123" ; FONT 'Verdana' SIZE 12 ; TOOLTIP 'Character TextBox' @ 150,20 Button Button_1 ; Caption "Disable" ; Height 80 ; Action DisableControls() @ 150,120 Button Button_2 ; Caption "Enable" ; Height 80 ; Action EnableControls() END WINDOW Form_1.Center Form_1.Activate Return Nil Function DisableControls() Form_1.Text_1.Enabled := .F. Form_1.Text_2.Enabled := .F. Return Nil Function EnableControls() Form_1.Text_1.Enabled := .T. Form_1.Text_2.Enabled := .T. Return Nil #define EM_SETSEL 177 Function OnInit( cControlName , cParentForm ) Setfocus( GetControlHandle( cControlName , cParentForm ) ) SendMessage( GetControlHandle( cControlName , cParentForm ) , EM_SETSEL , 0 , -1 ) Return Nil
Could anybody test it?
Marek
Re: Seleccionar todo el texto en un TextBox
I want to refresh this topic because this solution doesn't work with mouse.
Somebody has any idea how to select whole field after enter by mouse?
Somebody has any idea how to select whole field after enter by mouse?
- AUGE_OHR
- Posts: 2061
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Seleccionar todo el texto en un TextBox
hi Mol,
Code does work
but "something" does delete my Color after "Sleep" when using Mouse ... hm
Code does work
Code: Select all
hWndEdit := GetControlHandle( ControlName, ParentForm )
SendMessage( hWndEdit, EM_SETSEL, nStartIndex, nEndIndex )
// add this for Test
DO EVENTS
hb_idleSleep( 1.0 )
have fun
Jimmy
Jimmy
- AUGE_OHR
- Posts: 2061
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Seleccionar todo el texto en un TextBox
hi,
try this with TEXTBOX
it will "high-light" hole TEXTBOX but Cursor is at End of Entry
! Note : you must change Code to use "your" Color(s)
try this with TEXTBOX
Code: Select all
ONGOTFOCUS MarkText( ThisWindow.Name, This.Name )
ONLOSTFOCUS DeHilite( ThisWindow.Name, This.Name )
Code: Select all
STATIC PROCEDURE MarkText( ParentForm, ControlName )
LOCAL cValue, hWndEdit, nStartIndex := 0, nEndIndex := - 1
IF _IsControlDefined( ControlName, ParentForm )
DoMethod( ParentForm, ControlName, "SetFocus" )
SetProperty( ParentForm, ControlName, "CaretPos", nEndIndex )
SetProperty( ParentForm, ControlName, "BackColor", SP_nColor11() )
SetProperty( ParentForm, ControlName, "FontColor", SP_nColor12() )
hWndEdit := GetControlHandle( ControlName, ParentForm )
SendMessage( hWndEdit, EM_SETSEL, nStartIndex, nEndIndex )
ENDIF
RETURN
Code: Select all
STATIC PROCEDURE DeHilite( ParentForm, ControlName )
IF _IsControlDefined( ControlName, ParentForm )
SetProperty( ParentForm, ControlName, "BackColor", SP_nColor5() )
SetProperty( ParentForm, ControlName, "FontColor", SP_nColor6() )
ENDIF
RETURN
! Note : you must change Code to use "your" Color(s)
have fun
Jimmy
Jimmy
- Claudio Ricardo
- Posts: 367
- Joined: Tue Oct 27, 2020 3:38 am
- DBs Used: DBF, MySQL, MariaDB
- Location: Bs. As. - Argentina
Re: Seleccionar todo el texto en un TextBox
Hola Rafael, En los textbox yo pongo el valor predeterminado en la propiedad ' Value ' al crear el control
o después con SetProperty ("Form_Name" , "Text_Name" , "Value" , "Valor predeterminado")
Cuando el usuario accede a ese textbox con la tecla Tab se resalta (highlight) y cualquier tecla alfanumérica
que presione borra el valor predeterminado por mi y lo reemplaza por lo que está escribiendo.
Por ejemplo: para editar un artículo cargo todos los textbox de la ventana de editar artículo con los
valores actuales y el usuario sólo cambia el que necesita, luego se leen todos los textbox y se actualiza
la base de datos.
o después con SetProperty ("Form_Name" , "Text_Name" , "Value" , "Valor predeterminado")
Cuando el usuario accede a ese textbox con la tecla Tab se resalta (highlight) y cualquier tecla alfanumérica
que presione borra el valor predeterminado por mi y lo reemplaza por lo que está escribiendo.
Por ejemplo: para editar un artículo cargo todos los textbox de la ventana de editar artículo con los
valores actuales y el usuario sólo cambia el que necesita, luego se leen todos los textbox y se actualiza
la base de datos.
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
WhatsApp / Telegram: +54 911-63016162