| |
|
|
|
Source wurde am 15.07.2007 aus qui MMJ-Quellcodesammlung (Dietmar Horn) dans qui Babyklappe sur XProfan.Com abgelegt:
RichEdit: Cursor 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(Fenêtre, %hWnd, Test, 100, 100, 320, 270)
Si hWin&
hRtf& = @Créer(RichEdit, hWin&, ne...aucune 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(la ligne: + @Str$(GetCursorPosY()) + @Chr$(13) +
@Chr$(10) + Spalte: + @Str$(GetCursorPosX()),
XY-Position, ~MB_OK)
EndIf
Until Ende&
Dispose CharRange#
-Fin-------------------------------------------------------------------
Fin
|
|
|
| |
|
|