Local cChar := GetCharHdr( nPtrNMHDR )
.../...
//----------------------------------------------------------------------------//
static int GetCharHdr( LPARAM lParam )
{
struct SCNotification * pMsg = ( struct SCNotification * )lParam;
return ( pMsg->ch );
}
//----------------------------------------------------------------------------//
HB_FUNC( GETCHARHDR )
{
hb_retni( GetCharHdr( hb_parnl( 1 ) ));
}
//----------------------------------------------------------------------------//
Antonio Linares wrote:Cristobal,
Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias
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 := ""
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
*/
nPosInd := 0
else
nIndentation := nIndentation + nInd
endif
if ::GetLineCount() > nCurLine
::GoLine( nCurLine + 1 )
endif
::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
::GotoPos( ::GetCurrentPos() + nIndentation )
return nil
Antonio Linares wrote:Samir,
Thanks for your sugegstions, but for now we are focusing on the basic functionality.
Once it is complete, then we will enhance Fivedit.
Our goal now is to complete it and that it works properly
Antonio Linares wrote:Cristobal,
la implementación Alt-C y las otras combinaciones:
- Code: Select all Expand view
METHOD SysCommand( nType, nLoWord, nHiWord ) CLASS TScintilla
.../...
case nLoWord == Asc( "i" ) .or. nLoWord == Asc( "I" )
I think it is quite useful to have methods listed twice, one for the Class header and another for the implementation.
sambomb wrote:Antonio Linares wrote:Samir,
Thanks for your sugegstions, but for now we are focusing on the basic functionality.
Once it is complete, then we will enhance Fivedit.
Our goal now is to complete it and that it works properly
The bookmark looks simple, I could do it myself but I don't have the last edition of fivewin.
cnavarro wrote:Antonio Linares wrote:Cristobal,
la implementación Alt-C y las otras combinaciones:
- Code: Select all Expand view
METHOD SysCommand( nType, nLoWord, nHiWord ) CLASS TScintilla
.../...
case nLoWord == Asc( "i" ) .or. nLoWord == Asc( "I" )
Habria que añadir las mayúsculas, no?
Antonio, por qué crear un nuevo Metodo y no utilizar el que ya existe? -> HandleEvent
Hay algun motivo?
Gracias
cnavarro wrote:Antonio Linares wrote:Cristobal,
Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias
Antonio, en mi anterior post te preguntaba como funcionaba el cierre de indentacion, mira a ver si me puedes decir algo para seguir
Hacia la derecha ya funciona bastante bien
--------------------------------------------- EDITADO
De momento, esto funciona muy bien
Currently, this works very well
- Code: Select all Expand view
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 := ""
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
*/
nPosInd := 0
else
nIndentation := nIndentation + nInd
endif
if ::GetLineCount() > nCurLine
::GoLine( nCurLine + 1 )
endif
::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
::GotoPos( ::GetCurrentPos() + nIndentation )
return nil
METHOD AutoIndent() CLASS TScintilla
local nPrevLine := ::GetCurrentLineNumber() - 1
local nIndentation := ::GetLineIndentation( nPrevLine )
local nPos := ::GetCurrentPos()
::Send( SCI_SETLINEINDENTATION, nPrevLine + 1, nIndentation )
::InsertText( nPos, Space( nIndentation ) )
::Send( SCI_GOTOPOS, nPos + nIndentation )
return nil
Antonio Linares wrote:Cristobal,cnavarro wrote:Antonio Linares wrote:Cristobal,
Antonio, por qué crear un nuevo Metodo y no utilizar el que ya existe? -> HandleEvent
Hay algun motivo?
Gracias
Las pulsaciones Alt+... son rutadas automaticamente al método SysCommand, pues Windows genera un mensaje WM_SYSCOMMAND.
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TEdtScint
.../...
Case nMsg == WM_SYSCOMMAND
Do Case
Case nWParam == SC_KEYMENU
.../...
Antonio Linares wrote:Cristobal,cnavarro wrote:Antonio Linares wrote:Cristobal,
Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias
Antonio, en mi anterior post te preguntaba como funcionaba el cierre de indentacion, mira a ver si me puedes decir algo para seguir
Hacia la derecha ya funciona bastante bien
--------------------------------------------- EDITADO
De momento, esto funciona muy bien
Currently, this works very well
- Code: Select all Expand view
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 := ""
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
*/
nPosInd := 0
else
nIndentation := nIndentation + nInd
endif
if ::GetLineCount() > nCurLine
::GoLine( nCurLine + 1 )
endif
::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
::GotoPos( ::GetCurrentPos() + nIndentation )
return nil
La clave me la distes con usar el método Notify Ya lo tengo funcionando asi:
- Code: Select all Expand view
METHOD AutoIndent() CLASS TScintilla
local nPrevLine := ::GetCurrentLineNumber() - 1
local nIndentation := ::GetLineIndentation( nPrevLine )
local nPos := ::GetCurrentPos()
::Send( SCI_SETLINEINDENTATION, nPrevLine + 1, nIndentation )
::InsertText( nPos, Space( nIndentation ) )
::Send( SCI_GOTOPOS, nPos + nIndentation )
return nil
::InsertText( nPos, Space( nIndentation ) )
Antonio Linares wrote:Cristobal,
A mi sin el InsertText() el cursor se va varias líneas más abajo.
.../...
::SendEditor( SCI_SETUSETABS, 0 )
::SendEditor( SCI_SETTABWIDTH, 3, 0 )
//Set autoindentation con 3 spaces
::SendEditor( SCI_SETINDENT, ::SendEditor( SCI_GETTABWIDTH, 0, 0 ), 0 )
::SendEditor( SCI_SETTABINDENTS, 0, 0 )
::SendEditor( SCI_SETBACKSPACEUNINDENTS, 1, 0 )
.../...
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 36 guests