| |
|
|
| Koordinaten des Cursors im RichEdit abfragen:
Stefan vite
-Begin----------------------------------------------------------- ------
-En-tête-Fichiers------------------------------------------------------
$H Windows.ph
$H RichEdit.ph
$H Structs.ph
$H Messages.ph
-Strukturen----------------------------------------------------------
Déclarer CharRange#
Struct CharRange = ~CHARRANGE
Faible CharRange#, CharRange
-Globale Variablen---------------------------------------------------
Déclarer Ende&, hButton&, hWin&, hRtf&
-Funktion GetCursorPosX (Spalte)-------------------------------------
Proc GetCursorPosX
SendMessage(hRtf&, ~EM_EXGETSEL, 0, CharRange#)
Retour Int(CharRange#.cpMax& - (SendMessage(hRtf&,
~EM_LINEINDEX, SendMessage(hRtf&, ~EM_EXLINEFROMCHAR, 0,
CharRange#.cpMin&), 0)) + 1)
ENDPROC
-Funktion GetCursorPosY (la ligne)--------------------------------------
Proc GetCursorPosY
SendMessage(hRtf&, ~EM_EXGETSEL, 0, CharRange#)
Retour Int(SendMessage(hRtf&, ~EM_EXLINEFROMCHAR, 0,
CharRange#.cpMin&) + 1)
ENDPROC
-Main----------------------------------------------------------------
-GUI---------------------------------------------------------------
hWin& = @Créer("Window", %hWnd, "Test", 100, 100, 320, 270)
Si hWin&
hRtf& = @Créer("RichEdit", hWin&, "Kein Text", 5, 5, 300, 200)
hButton& = @Créer("Button", hWin&, "Cursor-Position ermitteln",
5, 210, 300, 24)
EndIf
-Ereignisschleife--------------------------------------------------
Claire Ende&
Repeat
WaitInput
Si %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&
Dispose CharRange#
-Fin-------------------------------------------------------------------
Fin
Salve, iF. |
|
|
| |
|
|