>>> >>> PROCEDURE command1.Click >>> With Thisform.Edit1 >>> nStart = .SelStart >>> nEnd = Len(.Value) >>> >>> .SelStart = nStart >>> .SelLength = nEnd - nStart >>> .SetFocus() >>> Endwith >>> ENDPROC >>> >>> >>>>>>If the memo field already has data, one can click anywhere in the memo field, and then on the button. The text from the current position to the end is highlighted correctly.
>>PUBLIC oform1 >> >>oform1=NEWOBJECT("form1") >>oform1.Show >>RETURN >> >>DEFINE CLASS form1 AS form >> >> Height = 525 >> Width = 630 >> DoCreate = .T. >> Caption = "Form1" >> Name = "Form1" >> >> >> ADD OBJECT edit1 AS editbox WITH ; >> Height = 210, ; >> HideSelection = .F., ; >> Left = 78, ; >> Top = 127, ; >> Width = 261, ; >> ControlSource = "tt.mm", ; >> Name = "Edit1" >> >> >> ADD OBJECT command1 AS commandbutton WITH ; >> Top = 49, ; >> Left = 85, ; >> Height = 27, ; >> Width = 84, ; >> Caption = "Command1", ; >> Name = "Command1" >> >> >> PROCEDURE Load >> CREATE CURSOR tt (mm memo) >> APPEND BLANK >> replace mm WITH "some text"+CHR(13)+"other" >> ENDPROC >> >> >> PROCEDURE command1.GotFocus >> this.Caption = thisform.edit1.SelText >> ENDPROC >> >> >>ENDDEFINE >>>
>Public oform1 > >oform1=Newobject("form1") >oform1.Show >Return > >Define Class form1 As Form > > Height = 525 > Width = 630 > DoCreate = .T. > Caption = "Form1" > Name = "Form1" > > > Add Object edit1 As EditBox With ; > Height = 210, ; > HideSelection = .F., ; > Left = 78, ; > Top = 127, ; > Width = 261, ; > ControlSource = "tt.mm", ; > Name = "Edit1" > > > Add Object command1 As CommandButton With ; > Top = 49, ; > Left = 85, ; > Height = 27, ; > Width = 84, ; > Caption = "Command1", ; > Name = "Command1" > > > Procedure Load > Create Cursor tt (mm Memo) > Append Blank > Replace mm With "some text"+Chr(13)+"other" >Endproc > > >*!* PROCEDURE command1.GotFocus >*!* this.Caption = thisform.edit1.SelText >*!* ENDPROC > > Procedure command1.Click > With Thisform.edit1 > nStart = .SelStart > nEnd = Len(.Value) > > .SelStart = nStart > .SelLength = nEnd - nStart > .SetFocus() > Endwith >Endproc > > >Enddefine >>(Note for Dan:- the SetFocus is there, tried it in a few places, doesn't help).