Antonio
El Metodo Autoindent lo tenia asi
METHOD AutoIndent() CLASS TEdtScint
Local nCurLine 聽 聽 := ::GetCurrentLine()
Local nIndentation := ::SendEditor( SCI_GETLINEINDENTATION, nCurLine-1 , 0 )
聽 聽if ::GetLineCount() > nCurLine
聽 聽 聽 ::GoToLine( nCurLine+1 )
聽 聽endif
聽 聽::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nIndentation )
聽 聽::GotoPos( ::GetCurrentPos() + nIndentation )
return nil
Y lo tengo implementado en el Metodo Notify(
聽 聽 聽 case nCode == SCN_CHARADDED聽 聽 聽 聽 聽 聽// 2001
聽 聽 聽 聽 聽 聽cLine 聽 聽 := ::GetLine( nLine - 1 )
聽 聽 聽 聽 聽 聽Do Case
聽 聽 聽 聽 聽 聽 聽 Case cChar = 13 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽.../...
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::AutoIndent( cLine )
Pero ahora, como pruebas inciales, para poder implementar la indentacion inteligente estaba desarrollando lo siguiente
But now, as initials tests, in order to implement the smart indentation was developing the following
METHOD AutoIndent( cLine ) CLASS TEdtScint
Local nCurLine 聽 聽 := ::GetCurrentLine()
Local nIndentation := ::SendEditor( SCI_GETLINEINDENTATION, nCurLine-1 , 0 )
Local x
Local nPos 聽 聽 聽 聽 := 0
Local nInd 聽 聽 聽 聽 := ::SendEditor( SCI_GETINDENT, 0, 0 )
Local aCad1 聽 聽 聽 聽:= {"for ", "while ", "if ", "with ", "case " }
Local aCad2 聽 聽 聽 聽:= {"next ", "enddo ", "endif ", "end ", "endcase ", ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽"endwhile ", "endwith ", "else ", "otherwise " }//loop switch "
Local nPosInd 聽 聽 聽:= ::SendEditor( SCI_GETLINEINDENTPOSITION, nCurLine, )
DEFAULT cLine 聽 聽 聽:= "" 聽 聽 //::GetLine( nCurLine - 1 ) 聽// OJO con el nCurLine - 1
聽 聽For x = 1 to Len( aCad1 )
聽 聽 聽 聽nPos := At( aCad1[ x ], Lower( cLine ) )
聽 聽 聽 聽if !Empty( nPos )
聽 聽 聽 聽 聽 x := Len( aCad1 ) + 1
聽 聽 聽 聽endif
聽 聽Next x
聽 聽if Empty( nPos )
聽 聽 聽 For x = 1 to Len( aCad2 )
聽 聽 聽 聽 聽 nPos := At( aCad2[ x ], Lower( cLine ) )
聽 聽 聽 聽 聽 if !Empty( nPos )
聽 聽 聽 聽 聽 聽 聽x := Len( aCad2 ) + 1
聽 聽 聽 聽 聽 endif
聽 聽 聽 Next x
聽 聽 聽 if !Empty( nPos )
聽 聽 聽 聽 聽nIndentation 聽:= nIndentation - nInd
聽 聽 聽 endif
聽 聽else
聽 聽 聽 nIndentation 聽:= nIndentation + nInd
聽 聽endif
聽 聽
聽 聽if ::GetLineCount() > nCurLine
聽 聽 聽 ::GoLine( nCurLine+1 )
聽 聽endif
聽 聽
聽 聽::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nIndentation )
聽 聽//::GotoPos( ::GetCurrentPos() + nIndentation )
聽 聽::GotoPos( nPosInd + nIndentation )
return nil
Seguimos "hablando"