DEFINE CLASS frmcmdwindow AS form1 Top = 0 Left = 0 Height = 237 Width = 468 DoCreate = .T. Caption = "Command Window" Name = "frmCmdWindow" DIMENSION acommands[1] ADD OBJECT lstcommand AS listbox WITH ; RowSourceType = 5, ; RowSource = "ThisForm.aCommands", ; Height = 188, ; Left = 11, ; TabIndex = 3, ; Top = 10, ; Width = 447, ; Name = "lstCommand" ADD OBJECT lblcommand AS label WITH ; Caption = "Command", ; Left = 9, ; Top = 208, ; Width = 61, ; TabIndex = 1, ; Name = "lblCommand" ADD OBJECT txtcommand AS textbox WITH ; Height = 22, ; Left = 74, ; TabIndex = 2, ; Top = 206, ; Width = 384, ; Name = "txtCommand" PROCEDURE Init Dimension This.aCommands(1) This.aCommands(1) = space(200) ENDPROC PROCEDURE lstcommand.InteractiveChange DoDefault() ThisForm.txtCommand.Value = This.Value ENDPROC PROCEDURE lstcommand.KeyPress LPARAMETERS nKeyCode, nShiftAltCtrl if nKeyCode = 13 with ThisForm.txtCommand .SetFocus() .LostFocus() endwith return endif DoDefault() ENDPROC PROCEDURE txtcommand.Refresh This.Value = ThisForm.lstCommand.Value ENDPROC PROCEDURE txtcommand.LostFocus local lcValue lcValue = alltrim(Transform(This.Value)) if empty(lcValue) DoDefault() return endif if upper(This.Value) = "EXIT" ThisForm.QueryUnload() NoDefault Return endif local lnLength, lnRetVal lnLength = alen(ThisForm.aCommands, 1) lnRetVal = ascan(ThisForm.aCommands, lcValue) if lnRetVal = 0 Dimension ThisForm.aCommands(lnLength + 1) ThisForm.aCommands(lnLength) = lcValue ThisForm.aCommands(lnLength + 1) = space(200) lnLength = lnLength + 1 endif if inlist(left(lcValue, 1), "?", "@", "*") activate screen if left(lcValue, 1) = "*" lcValue = substr(lcValue, 2) endif endif &lcValue This.Value = space(200) with ThisForm.lstCommand .Requery() .Value = space(200) endwith This.SetFocus() NoDefault Return ENDPROC PROCEDURE txtcommand.Error LPARAMETERS nError, cMethod, nLine wait window nowait "Error" ENDPROC ENDDEFINE