Hi Tracy,

Possibly using a toolbar is part of the problem. There are issues with 
focus with some controls on a toolbar.

Try this:

*** Program: Type Test ***
PUBLIC oForm

oForm = CREATEOBJECT("TypeForm")

oForm.AddObject("Edit1","EditBox")

WITH oForm.Edit1
      .Top = 5
      .Left = 5
      .Width = 300
      .Height = 100
      .Visible = .T.
ENDWITH

oForm.AddObject("ButtA","TypeKey")

WITH oForm.ButtA
      .Top = 115
      .Left = 5
      .Caption = "A"
      .Visible = .T.
ENDWITH

oForm.AddObject("ButtB","TypeKey")

WITH oForm.ButtB
      .Top = 115
      .Left = 50
      .Caption = "B"
      .Visible = .T.
ENDWITH

oForm.AddObject("ButtC","TypeKey")

WITH oForm.ButtC
      .Top = 115
      .Left = 95
      .Caption = "C"
      .Visible = .T.
ENDWITH

oForm.AddObject("ButtBKSP","TypeKey")

WITH oForm.ButtBKSP
      .Top = 115
      .Left = 150
      .Caption = "BKSP"
      .Visible = .T.
ENDWITH

oForm.AddObject("ButtDEL","TypeKey")

WITH oForm.ButtDEL
      .Top = 115
      .Left = 200
      .Caption = "DEL"
      .Visible = .T.
ENDWITH

oForm.AddObject("ButtLArrow","TypeKey")

WITH oForm.ButtLArrow
      .Top = 115
      .Left = 250
      .Caption = "<-"
      .Visible = .T.
ENDWITH

oForm.Show

DEFINE CLASS TypeForm AS Form
      PROCEDURE TypeSomething
           LPARAMETERS cValue

           LOCAL oPaper, caretat

           oPaper = .NULL.
           caretat = 0

           oPaper = THISFORM.Edit1

           IF LEN(cValue) = 1
                oPaper.Value = ;
                STUFF(ALLTRIM(oPaper.Value),oPaper.SelStart + 1,0,cValue)

                oPaper.SelStart = oPaper.SelStart + 1
           ELSE
                DO CASE
                     CASE cValue == "BKSP"
                          caretat = oPaper.SelStart

                          oPaper.Value = 
STUFF(ALLTRIM(oPaper.Value),oPaper.SelStart,1,"")

                          oPaper.SelStart = caretat - 1

                     CASE cValue == "DEL"
                          caretat = oPaper.SelStart

                          oPaper.Value = 
STUFF(ALLTRIM(oPaper.Value),oPaper.SelStart + 1,1,"")

                     CASE cValue == "<-"
                          caretat = oPaper.SelStart

                          IF caretat > 1
                               oPaper.SelStart = caretat -1
                          ENDIF

                ENDCASE
           ENDIF

           oPaper.SetFocus()
      ENDPROC
ENDDEFINE

DEFINE CLASS TypeKey AS CommandButton
      Width = 40
      Height = 26

      PROCEDURE Click
           THISFORM.TypeSomething(THIS.Caption)
      ENDPROC
ENDDEFINE
*** End Program ***

Ken Dibble
www.stic-cil.org


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to