FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Cursor position in a Get
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Cursor position in a Get
Posted: Sat Oct 05, 2013 08:30 PM

I have a multiline get. If the user clicks into it, the cursor will be placed where they clicked.
How can I force the cursor to go the the start of the get but only when the get receives the focus.
If the get has the focus, the user should be able to click anywhere they want in the get.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Cursor position in a Get
Posted: Sun Oct 06, 2013 02:00 AM

Jeff:

Pls Have a look to Antonio's answer. perhaps it can help you.

viewtopic.php?f=3t=25979p=142184hilit=cursor#p142184

Regards

&&&

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Cursor position in a Get
Posted: Sun Oct 06, 2013 03:13 PM
Jeff

Consider this code .... the cursor is moved to the first character of the text within the get.

Rick Lipkin
Code (fw): Select all Collapse
cMEMO  := StrTran( oRs:Fields(cField):Value, Chr( 141 ) + Chr( 10 ), "" )

If empty( cMemo) .or. cMemo = "  "
Else
   cMemo := alltrim( cMemo )
Endif


DO CASE
CASE cMODE = "A"
     cTITLE := cTitle +"      ADD"
CASE cMODE = "E"
     cTITLE := cTitle +"     EDIT"
CASE cMODE = "V"
     cTITLE := cTitle +"     VIEW"
ENDCASE


DEFINE DIALOG oUSERS RESOURCE "MEMO" ;
       TITLE cTITLE              ;


IF cMODE = "E"

   REDEFINE GET oMEMO      VAR cMEMO MEMO ID 130 of oUSERS UPDATE

ELSE     // view

   REDEFINE GET oMEMO      VAR cMEMO ID 130 of oUSERS READONLY

ENDIF


     IF cMODE = 'E'
        oMemo:bGotFocus = { || oMemo:SetSel( 0, 0 ),;
                         oMemo:Goto( oMemo:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }
     ENDIF

REDEFINE BTNBMP oBtn1 ID 111 of oUSERS   ;     // ok
         RESOURCE "OK", "DOK", "DOK" ;
         PROMPT "  &Ok    " LEFT 2007;
         ACTION (IF(cMODE ="E", _DOIT(cMemo,oRs,cField), ),    ;
                  oUSERS:END()  )

REDEFINE BTNBMP oBtn2 ID 112 of oUSERS   ;    // cancel
         RESOURCE "CANCEL", "DCANCEL", "DCANCEL" ;
         PROMPT "&Cancel   " LEFT 2007;
         ACTION oUSERS:END()

ACTIVATE DIALOG oUSERS

RETURN( NIL )
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Cursor position in a Get
Posted: Sun Oct 06, 2013 06:43 PM

Thanks Guys.
Got it working with: oGet1:bGotFocus := {|| oGet1:SetPos(0,0) }

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion