| |
|
|
| Koordinaten des Cursors en el RichEdit 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("Window", %hWnd, "Test", 100, 100, 320, 270)
If hWin&
hRtf& = @Crear("RichEdit", hWin&, "Kein Text", 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("Zeile: " + @Str$(GetCursorPosY()) + @Chr$(13) +
@Chr$(10) + "Spalte: " + @Str$(GetCursorPosX()),
"XY-Position", ~MB_OK)
EndIf
Until Ende&
Disponer CharRange#
-End-------------------------------------------------------------------
End
Salve, IF. |
|
|
| |
|
|