Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CEE-clone for VFP7
Message
 
To
06/02/2002 07:43:57
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00615920
Message ID:
00617879
Views:
31
Andy,

I could include DeclVars almost left unchanged. The only major change was made in the UpdateLocalDeclaration-function and takes care of the issue that someone breaks to the next line using ";"
*************************************************************************************
FUNCTION     UpdateLocalDeclaration( tnHandle, tnSelStart, taLines, tnLine, tcVarName )
*************************************************************************************
LOCAL lcPreFix, lcStr, lcSuffix, lnLen, lnPos, lnTmpPos

if .T. and .F.
    *-- Just to trick projectManager
    dimension taLines[1]
endif    

*** Get the position where we need to insert the variable

*-- DD changed on 09.02.02
*=====================================*
*  Breaking line with ";" ?           *
*  if so, get the position            *
*  in front of that and the last ","  *
*=====================================*
lcPreFix = ", "
lcSuffix = ""

if at(";", taLines[tnLine]) # 0
    lnTmpPos = rat(",", taLines[ tnLine ])-1
    
    *=================================*
    *  OK, just in case someone does  *
    *  something like this            *
    *  LOCAL ;                        *
    *    var1, var2...                *
    *=================================*
    if lnTmpPos <= 0
        lnTmpPos = rat(";", taLines[ tnLine ])-1
        lcPreFix = ""
        lcSuffix = ", "
    endif        
    
else  && at(";", ...)
    lnTmpPos = len( taLines[ tnLine ] )
endif && at(";", ...)

lnPos = _EdGetLPos( tnHandle, tnLine - 1 ) + lnTmpPos
_EdSetPos( tnHandle, lnPos )

*** Go ahead and update the local declaration

*-- DD changed on 09.02.02
*lcStr = ', ' + tcVarName 

lcStr = lcPreFix + tcVarName + lcSuffix
lnLen = LEN( lcStr ) 

_EdInsert( tnHandle, lcStr, lnLen )
WAIT WINDOW 'Local Declaration Inserted' NOWAIT

*** And reposition the cursor
lnPos = tnSelStart + lnLen
_EdSetPos( tnHandle, lnPos )

*-- DD changed on 09.02.02
*-- and show it
_EdStoPos( tnHandle, lnPos, .T. )

ENDFUNC
I did not want to go into all that reposition stuff in order to place the cursor at the end of the command. So this was the easiest way to do it.

My "Inline-Sorting"-Feature will take care of multiple rows and "local"-statements anyway.

The second thing I will do, is take care of an indented method when inserting the "local"-statements.

Maybe later I will extend this to work with "private" as well. But for now I think that's all what's needed to do.
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Previous
Reply
Map
View

Click here to load this message in the networking platform