FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oGet:Paste()
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
oGet:Paste()
Posted: Sat Jul 30, 2011 08:33 AM
Hi,
in this little samples ther is a problem.
Please try ths
1) select "Marco" from the first get using popget function selecting "Copia" (Copy)
2) then go to the second get.
3) you can note that text is selected ("Enrico")
4) click the right mouse and select "Incolla" (Paste)
5) the result is "EnricoMarco"
This is wrong the result would be "Marco" because "Enrico" was selected

Many thanks

Marco


Code (fw): Select all Collapse
#include "fivewin.ch"

#define EM_SETSEL 177


function main()
   local oDlg
   local oGet1 , cGet1 := "Marco                "
   local oGet2 , cGet2 := "Enrico               "
   local oGet3 , cGet3 := "                     "


   define dialog oDlg

   @ 1,1 get oGet1 var cGet1 of oDlg update

   oGet1:bGotFocus := { || oGet1:PostMsg( EM_SETSEL, Len( RTrim( cGet1 ) ), 0 ) }
   oGet1:bRClicked  := { || PopGet( oGet1 ) }

   @ 2,1 get oGet2 var cGet2 of oDlg update
   oGet2:bGotFocus := { || oGet2:PostMsg( EM_SETSEL, Len( RTrim( cGet2 ) ), 0 ) }
   oGet2:bRClicked  := { || PopGet( oGet2 ) }

   @ 3,1 get oGet3 var cGet3 of oDlg update
   oGet3:bGotFocus := { || oGet3:PostMsg( EM_SETSEL, Len( RTrim( cGet3 ) ), 0 ) }
   oGet3:bRClicked  := { || PopGet( oGet3 ) }

   activate dialog oDlg CENTER

return nil

FUNCTION POPGET( oGet )

 LOCAL oMen


 MENU oMen POPUP 2007

      MENUITEM "Taglia"           ACTION oGet:Cut()
      MENUITEM "Copia"            ACTION oGet:Copy()
      MENUITEM "Incolla"          ACTION oGet:Paste()
      MENUITEM "Annulla"          ACTION oGet:Undo()
      MENUITEM "Svuota"           ACTION svuota( oget )
      MENUITEM "Seleziona"        ACTION oGet:PostMsg( EM_SETSEL, Len( RTrim( oGet:varget() ) ), 0 )
      MENUITEM "Seleziona tutto"  ACTION oGet:SelectAll()


 ENDMENU

 oMen:Activate( oGet:nBottom , oGet:nLeft , oGet )


RETURN NIL


FUNCTION SVUOTA( oGet )
M->xSvuotata := oget:varget()
M->cGetCargo := oget:cargo
oGet:VarPut( uValBlank( oGet:VarGet() ) )
oGet:refresh()

RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: oGet:Paste()
Posted: Sat Jul 30, 2011 09:56 AM
Code (fw): Select all Collapse
MENUITEM "Incolla" ACTION INCOLLA( oGet )


Code (fw): Select all Collapse
FUNCTION INCOLLA( oGet )

    LOCAL nLo, nHi

    oGet:GetSelPos( @nLo, @nHi )

    IF nHi != nLo
        oGet:GetDelSel( nLo, nHi )
    ENDIF

    oGet:EditUpdate()

    oGet:Paste()

    RETURN NIL


EMG
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: oGet:Paste()
Posted: Sat Jul 30, 2011 02:23 PM

Thank you Enrico!

Marco Boschi
info@marcoboschi.it

Continue the discussion