Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Editing a sub-routine
Message
 
 
To
08/01/2005 10:49:40
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00975393
Message ID:
00975463
Views:
13
Hi Jim,

Ther's nothing built-in but you can use FoxTools to access the editor window. Below's the basic code that should get you started. See George's Extended Foxtools Help File #9333 for more info. You can call it from a ON KEY LABEL or from a custom toolbar after you select a program name you want to edit. It is not hard to extend the code to find the name under cursor so you don't have to select it.
LOCAL lcProgName, lnSelEnd, lnSelStart, lnResult, lnHandle
LOCAL ARRAY laEnv [25]
SET LIBRARY TO (HOME() + "FoxTools.fll") ADDITIVE
* Get the whandle for the current window
lnHandle = _WonTop()
lnResult = _EdGetEnv( lnHandle, @laEnv )

IF ( lnResult = 0 ) ;
		OR ( laEnv[17] = 0 ) ;
		OR ( laEnv[25] = 0 )
  RETURN
ENDIF

* Extract selected name from the editor window
lnSelStart = laEnv[17]
lnSelEnd   = laEnv[18]-1
lcProgName = ALLTRIM(_EdGetStr( lnHandle, lnSelStart, lnSelEnd ))

IF NOT EMPTY(lcProgName) ;
		AND FILE(DEFAULTEXT(lcProgName, "prg"))
	MODIFY COMMAND (lcProgName) NOWAIT
ENDIF	 
RETURN
>Is there some simple way, when editing a PRG, to begin editing a PRG that is called there?
>
>If I have
>
>   bla-bla-bla
>   MySubroutine(params)
>   bla-bal-bla
>
>is there some way to begin editing 'MySubroutine' other than be copying and pasting it to the command window where I can do MODI COMM?
>
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform