Cursor position after tget:setfocus()
Cursor position after tget:setfocus()
Dear All,
I have a button get and working fine. I need to position the cursor at the end of tget test when receiving focus.
I tried with:
1. oGet:bGotFocus := {|| oGet:KeyDown(VK_END) }
2. oGet:bGotFocus := {|| oGet:oGet:end() }
3. oGet:bGotFocus := {|| oGet:Setpos( 10 ) } //assuming 10 is the lenght..
but unsuccessful..
can anybody help?
I have a button get and working fine. I need to position the cursor at the end of tget test when receiving focus.
I tried with:
1. oGet:bGotFocus := {|| oGet:KeyDown(VK_END) }
2. oGet:bGotFocus := {|| oGet:oGet:end() }
3. oGet:bGotFocus := {|| oGet:Setpos( 10 ) } //assuming 10 is the lenght..
but unsuccessful..
can anybody help?
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
-
- Posts: 531
- Joined: Wed Jul 31, 2013 1:14 pm
- Location: Maldonado - Uruguay
- Contact:
Re: Cursor position after tget:setfocus()
Hi, this way it's working fine here.
REDEFINE GET oGetNom VAR cNombre ID 130 OF oDlgSub1 FONT oFont2
oGetNom:SetPos(20)
If it's after the button action, is the same way.
ACTION(LoQueSea(), oGetNom:SetPos(20), oGetnom:Refresh())...
Saludos
REDEFINE GET oGetNom VAR cNombre ID 130 OF oDlgSub1 FONT oFont2
oGetNom:SetPos(20)
If it's after the button action, is the same way.
ACTION(LoQueSea(), oGetNom:SetPos(20), oGetnom:Refresh())...
Saludos
Dario Fernandez
FWH 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
FWH 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
- Antonio Linares
- Site Admin
- Posts: 42595
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 38 times
- Been thanked: 86 times
- Contact:
Re: Cursor position after tget:setfocus()
Hi Antonio,
I already tried it... all not working.
When user opens a dialog with get (with text on it) the cursor should be position on the last character so typing is continuous. But with TGET the cursor
is always at the beginning.. I even set oGet:Keydown(VK_END) but still not working..
I already tried it... all not working.
When user opens a dialog with get (with text on it) the cursor should be position on the last character so typing is continuous. But with TGET the cursor
is always at the beginning.. I even set oGet:Keydown(VK_END) but still not working..
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Re: Cursor position after tget:setfocus()
Hi Ruben,
oGet:Refresh() invokes oGet:GoHome() which always position the cursor to 1.
oGet:Refresh() invokes oGet:GoHome() which always position the cursor to 1.
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- Enrico Maria Giordano
- Posts: 8761
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 5 times
- Contact:
Re: Cursor position after tget:setfocus()
Frances,
this is a working sample:
EMG
this is a working sample:
Code: Select all | Expand
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet1, oGet2
LOCAL cVar1 := PADR( "This is a test", 35 )
LOCAL cVar2 := PADR( "This is a test", 35 )
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 1, 1 GET oGet1 VAR cVar1 OF oDlg
oGet1:bGotFocus = { || oGet1:SetPos( Len( RTrim( cVar1 ) ) + 1 ) }
@ 3, 1 GET oGet2 VAR cVar2 OF oDlg
oGet2:bGotFocus = { || oGet2:SetPos( Len( RTrim( cVar2 ) ) + 1 ) }
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
EMG
Re: Cursor position after tget:setfocus()
Hi Enrico,
This is what it needs to be done. the get in oBar fails..
This is what it needs to be done. the get in oBar fails..
Code: Select all | Expand
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet
LOCAL cVar := PADR( "This is a test", 35 )
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 5, 1 GET oGet VAR cVar OF oDlg;
picture "@!";
bitmap '';
action msginfo('1')
oGet:bGotFocus = { || oGet:SetPos( Len( RTrim( cVar ) ) + 1 ) } //works perfectly with Enrico's example
ACTIVATE DIALOG oDlg CENTER;
ON INIT uDlgBar( oDlg );
ON PAINT oDlg:oBar:aControls[1]:SetFocus()
RETURN NIL
STATIC FUNCTION uDlgBar( oDlg )
LOCAL oBar, oGet
LOCAL cVar := PADR( "This is a test", 35 )
DEFINE BUTTONBAR oBar SIZE 28, 28 OF oDlg TOP 3D 2010
@ 1, 1 GET oGet VAR cVar OF oBar;
picture "@!";
bitmap '';
action msginfo('1')
oGet:bGotFocus = { || oGet:SetPos( Len( RTrim( cVar ) ) + 1 ) } //epic fail...
RETURN
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- Enrico Maria Giordano
- Posts: 8761
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 5 times
- Contact:
Re: Cursor position after tget:setfocus()
Frances,
EMG
Code: Select all | Expand
oGet:bGotFocus = { || SysRefresh(), oGet:SetPos( Len( RTrim( cVar ) ) + 1 ) } //now works!
EMG
Re: Cursor position after tget:setfocus()
Enrico,
OMG... I never thought of Sysrefresh() on this situation. I thought it was a bug somewhere..
Thanks man!
OMG... I never thought of Sysrefresh() on this situation. I thought it was a bug somewhere..


Thanks man!
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15