Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command window

Status
Not open for further replies.

hyonos

Technical User
Apr 2, 2003
46
0
0
IT
how i can create a command window inside my app ?

i have find a command window form in foxite, but it don't work fine :(

for example i can't do this

x="ciccio" &&(press enter)
wait window x && (press enter)

with foxite command i get an error: variabl x not define

now, how i can create real command window inside my app ?
 
Hi

Copy the following as myCmdWin.PRG and from command window, DO myCmdWin

**************************************************
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
DEFINE CLASS form1 AS form

Top = 0
Left = 0
Height = 219
Width = 497
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
letout = .F.

ADD OBJECT edit1 AS editbox WITH ;
Height = 156, ;
Left = 36, ;
Top = 12, ;
Width = 336, ;
Name = "Edit1"

ADD OBJECT command1 AS commandbutton WITH ;
Top = 180, ;
Left = 36, ;
Height = 27, ;
Width = 84, ;
Caption = "Command1", ;
Name = "Command1"

PROCEDURE command1.Click
=EXECSCRIPT(ThisForm.Edit1.Value)
IF 6 = MESSAGEBOX("Clear commands ? ",4+16)
ThisForm.Edit1.Value = ""
ENDIF
ENDPROC

ENDDEFINE
*-- EndDefine
**************************************************

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
i can't open command window like foxpro ide?
 
Hallo, -VFP6 SP4
I didn't find the command in your example:EXECSCRIPT
-----------
=EXECSCRIPT(ThisForm.Edit1.Value)
--------------
Is it a function that we should develope or some other higher VFP command ?

 
Ramani,

I hope you don't mind. I made a few changes so that it performas as requested when {ENTER} is pressed...

KONUIK,

EXECSCRIPT() was added in VFP 7. It runs a PRG without needing to write it to a file and compile it... see code below.

Brian

**************************************************
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
DEFINE CLASS form1 AS form

Top = 0
Left = 0
Height = 219
Width = 497
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
letout = .F.

ADD OBJECT edit1 AS editbox WITH ;
Height = 156, ;
Left = 36, ;
Top = 12, ;
Width = 336, ;
Name = "Edit1"

ADD OBJECT command1 AS commandbutton WITH ;
Top = 180, ;
Left = 36, ;
Height = 27, ;
Width = 84, ;
Caption = "Clear Window", ;
Name = "command1"

PROCEDURE command1.Click
IF 6 = MESSAGEBOX("Clear commands ? ",4+16)
ThisForm.Edit1.Value = ""
ENDIF
ENDPROC

PROCEDURE edit1.InteractiveChange
if lastkey()=13
ALINES(TempArray,ThisForm.Edit1.Value,chr(13))
lcCmd=TempArray(occurs(chr(13),ThisForm.Edit1.Value))
lsTalk=set("Talk")
set talk off
if val(substr(version(),atc(".",version())-2,2))>=8
execscript(lcCmd)
else
thisform.lockscreen=.t.
strtofile(lcCmd,'cmd.prg')
compile cmd
do cmd
thisform.lockscreen=.f.
endif
set Talk &lsTalk
endif
endproc
ENDDEFINE
*-- EndDefine
**************************************************
 
You can replace the edit1.InteractiveChange with the one below. A macro replacement works better...

Brian

PROCEDURE edit1.InteractiveChange
if lastkey()=13
ALINES(TempArray,ThisForm.Edit1.Value,chr(13))
lcCmd=TempArray(occurs(chr(13),ThisForm.Edit1.Value))
if val(substr(version(),atc(".",version())-2,2))>=7
execscript(lcCmd)
else
&lcCmd
endif
endif
endproc
 
Hallo Baltman, thanks for the assistance
I was just about writing following :]

---------Text1.LostFocus
ThisForm.List1.AddItem(This.Text,1) && command window
xCommand=This.Value
&xCommand
This.Value=""
----------

I have a further Q: How to keep all the variables created in such a CommandWindow (CW) in memory
For example:
----------
xMemo=&quot;remember&quot; <Enter> && works
? xMemo <Enter> && do not work, would work in VFP CW
&& becouse xMemo cannot be assigned PUBLIC automatically
&& we need a command say like PUBLIC ALL NEXT CREATED :)
--------

PS: I think, your code must be something like this:
ALINES(TempArray,ThisForm.Edit1.Value)
instead:
*ALINES(TempArray,ThisForm.Edit1.Value,chr(13))

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top