Text-Editor

Veröffentliche deine funktionierenden Skripte und Funktionen

Moderator: jNizM

User avatar
Gerdi
Posts: 185
Joined: 03 Aug 2015, 18:48
Location: Germany
Contact:

Re: Text-Editor

06 Aug 2015, 10:39

Danke Just Me,
das war genau das was ich benötigte.

@Garry mit den bisherigen Antworten und mit

Code: Select all

Gui Add, Edit, w300 h300 x5 y5 vText	; Edit1
Text= Hallo Welt hello world
Loop 5
	Text .= A_Space Text
GuiControl,, Text, %Text% 
Gui Show, w310 h310, SelTest
Return

#a::			; druecke Win + a um das 2. Wort zu markieren
Gui Submit,NoHide
pos1:=InStr(Text,A_Space)
pos2:=InStr(SubStr(Text,Pos1+1),A_Space)+pos1-1
FirstSel1:=pos1+1
LastSel1:=pos2
TrayTip Markiert , von %FirstSel1% bis %LastSel1%
SendMessage 0xB1, %pos1%, %pos2%, Edit1, SelTest ; EM_SetSel
return

#b::			; druecke Win + b um die erste und die letzte markierte Position zu erhalten.
StartPos := -1
EndPos := -1
SendMessage 0xB0,&StartPos,&EndPos,Edit1,SelTest  ; EM_GetSel
FirstSel2 := NumGet(&StartPos)+1
LastSel2 := NumGet(&EndPos)
MsgBox % ">" FirstSel2 "<	>" LastSel2 "<" ; "< 	>"		&StartPos "<	>" &EndPos
return
solltest Du alles haben was Du brauchst um dein Problem lösen zu können.
Win 10 Home (x64) and Win 11 Pro N
https://github.com/Grrdi/ZackZackOrdner/archive/master.zip --> get folders on the quick
garry
Posts: 3763
Joined: 22 Dec 2013, 12:50

Re: Text-Editor

06 Aug 2015, 17:03

Vielen Dank
ich weiss nicht wie ich den Cursor setzen soll
Beispiel unten markiert einen bestimmten Position blau

Code: Select all

modified =20150806
filename1=Editor_Test
Gui,2:Color, ControlColor, Black
Gui,2:Font,S15 cYellow,Terminal
GUI,2:show,      x20  y10  w420  h220 , %filename1%
loop,20
  {
  aa:=% SubStr("00" A_Index, -2)
  e4x .= "Line-" aa " This is Line-" aa " COL-01 This is Line-" aa " COL-02 This is Line-" aa " COL-03`r`n"
  }
Gui,2:Add, Edit, x5   y5   w410  h205 vEdit1a hwndEditx1 hscroll  -wrap  +0x100,%e4x%
sleep,1000
gosub,a1
return

2Guiclose:
exitapp

;- statt blau markieren sollte hier der Cursor erscheinen
;- von Holle's script 'Zeichen' in ini file speichern und denn beim starten dieses scriptes auslesen
;- ( Holle's script zählt auch `r`n )
a1:
Gui,2:submit,nohide
SendMessage, 0xB1, 860, 861  ,, ahk_id %Editx1%   ;- EM_SETSEL            ;<< mark blue
SendMessage  0xB7,   0,   0  ,, ahk_id %Editx1%   ;- EM_SCROLLCARET       ;<< scroll
return
;==========================================================================================
just me
Posts: 9451
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Text-Editor

06 Aug 2015, 23:11

Moin garry,

wenn Du nur das caret setzen willst, müssen Anfangs- und Endposition identisch sein, also entweder 860, 860 oder 861, 861
User avatar
Gerdi
Posts: 185
Joined: 03 Aug 2015, 18:48
Location: Germany
Contact:

Re: Text-Editor

07 Aug 2015, 01:48

Hallo Garry,

füge beispiesweise zwischen die Sendmessage Befehle noch

Code: Select all

ControlFocus,Edit1,%filename1%
ein und mach den Anfang der Selektierung gleich dem Ende z.B.

Code: Select all

SendMessage, 0xB1, 861, 861  ,, ahk_id %Editx1%   ;- EM_SETSEL            ;<< mark blue
Win 10 Home (x64) and Win 11 Pro N
https://github.com/Grrdi/ZackZackOrdner/archive/master.zip --> get folders on the quick
garry
Posts: 3763
Joined: 22 Dec 2013, 12:50

Re: Text-Editor

07 Aug 2015, 06:15

Vielen Dank 'just me' und 'Gerdi' , es funktioniert

Code: Select all

modified =20150807        ;- springt/scrollt zur bestimmten Position und siehe Cursor
filename1=Editor_Test
Gui,2:Color, ControlColor, Black
Gui,2:Font,S15 cYellow,Terminal
GUI,2:show,      x20  y10  w420  h220 , %filename1%
loop,20
  {
  aa:=% SubStr("00" A_Index, -2)
  e4x .= "Line-" aa " This is Line-" aa " COL-01 This is Line-" aa " COL-02 This is Line-" aa " COL-03`r`n"
  }
Gui,2:Add, Edit, x5   y5   w410  h205 vEdit1a hwndEditx1 hscroll  -wrap  +0x100,%e4x%
sleep,1000
gosub,a1
return

2Guiclose:
exitapp

a1:
Gui,2:submit,nohide
SendMessage, 0xB1, 861, 861  ,, ahk_id %Editx1%   ;- EM_SETSEL            ;
ControlFocus,Edit1,%filename1%
SendMessage  0xB7,   0,   0  ,, ahk_id %Editx1%   ;- EM_SCROLLCARET       ;<< scroll
return
;==========================================================================================

Return to “Skripte und Funktionen”

Who is online

Users browsing this forum: No registered users and 50 guests