| |
|
|
|
Source wurde al 15.07.2007 de el MMJ-Quellcodesammlung (Dietmar Horn) en el Babyklappe en XProfan.Com abgelegt:
RichEdit: Cursor abfragen
Stefan Rápidamente
-Begin----------------------------------------------------------- ------
-Encabezamiento-Archivos------------------------------------------------------
$H Windows.ph
$H RichEdit.ph
$H Structs.ph
$H Messages.ph
-Estructuras----------------------------------------------------------
Declarar CharRange#
Struct CharRange = ~CHARRANGE
Dim CharRange#, CharRange
-Globale Variables---------------------------------------------------
Declarar Ende&, hButton&, hWin&, hRtf&
-Función GetCursorPosX (Spalte)-------------------------------------
Proc GetCursorPosX
SendMessage(hRtf&, ~EM_EXGETSEL, 0, CharRange#)
Volver Int(CharRange#.cpMax& - (SendMessage(hRtf&,
~EM_LINEINDEX, SendMessage(hRtf&, ~EM_EXLINEFROMCHAR, 0,
CharRange#.cpMin&), 0)) + 1)
ENDPROC
-Función GetCursorPosY (Línea)--------------------------------------
Proc GetCursorPosY
SendMessage(hRtf&, ~EM_EXGETSEL, 0, CharRange#)
Volver Int(SendMessage(hRtf&, ~EM_EXLINEFROMCHAR, 0,
CharRange#.cpMin&) + 1)
ENDPROC
-Main----------------------------------------------------------------
-GUI---------------------------------------------------------------
hWin& = @Crear(Ventana, %hWnd, Test, 100, 100, 320, 270)
If hWin&
hRtf& = @Crear(RichEdit, hWin&, Kein Texto, 5, 5, 300, 200)
hButton& = @Crear(Button, hWin&, Cursor-Position ermitteln,
5, 210, 300, 24)
EndIf
-Ereignisschleife--------------------------------------------------
Claro Ende&
Repeat
WaitInput
If %Key = 2
Ende& = 1
ElseIf @Clicked(hButton&)
@MessageBox(Línea: + @Str$(GetCursorPosY()) + @Chr$(13) +
@Chr$(10) + Spalte: + @Str$(GetCursorPosX()),
XY-Position, ~MB_OK)
EndIf
Until Ende&
Disponer CharRange#
-End-------------------------------------------------------------------
End
|
|
|
| |
|
|