FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Improvement in the TGET class, LButtonDown method
Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM
Improvement in the TGET class, LButtonDown method
Posted: Fri Jan 23, 2026 12:53 PM

Adjust this so that when you click on a GET request (type == "C"), the cursor in the GET request is positioned at the end of the typed text.

 DATA   lLeftClickPosEndText INIT .F.


METHOD LButtonDown( nRow, nCol, nFlags, lTouch ) CLASS TGet

   local nLo, nHi, nLenText

   if ::lDrag
      return ::Super:LButtonDown( nRow, nCol, nFlags, lTouch )
   else
      CallWindowProc( ::nOldProc, ::hWnd, WM_LBUTTONDOWN, nFlags,;
                      nMakeLong( nCol, nRow ) )
      ::GetSelPos( @nLo, @nHi )
      ::nPos = nHi + 1
      if ::oGet:Type != "N" .and. ::nPos == 1
         ::oGet:Home()
         ::SetPos( ::oGet:Pos )
      else
         if ::oGet:type == "N" .and. ::lRightToLeft
            ::SetPos( ::nNumLen )
            ::Refresh()
         else
            if ::lLeftClickPosEndText .and. ::oGet:type == "C"
               nLenText := Len( RTrim( ::oGet:VarGet() ) )
               if ::nPos > nLenText
                  //clicou fora do texto ? vai para o final
                  ::oGet:Home()
                  ::oGet:End()
                  ::SetPos( ::oGet:Pos )
               else
                  //clicou no texto ? respeita
                  ::oGet:Pos = ::nPos
               endif
            else
               ::oGet:Pos = ::nPos
            endif
         endif
      endif
      if ::bLClicked != nil
         Eval( ::bLClicked, nRow, nCol, nFlags, Self, lTouch )
      endif
      if ::oBtn != nil
         ::oBtn:Refresh()
      endif
      if ::oBtnLeft != nil
         ::oBtnLeft:Refresh()
      endif
      return 1
   endif

return nil
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin

Continue the discussion