Sign in to follow this  
Followers 0
ludocus

find a string and select it (GuiCtrlCreateEdit)

6 posts in this topic

#1 ·  Posted (edited)

$gui = GUICreate("Easy Editor", 613, 424, 193, 125)

$Edit1 = GUICtrlCreateEdit("", 0, 0, 615, 421)

$read = GUICtrlRead ( $Edit1 )

for instence: I type: hello

in $Edit1

now I want to find the string hello and select it if I press a button.

Finding the string would be: If StringInStr ( $read, 'hello' ) then .... I don't know how to select the string?

(you know dragging your mouse over it and making it blue)

I want the program to do that.. (select a string)

Edited by ludocus

Share this post


Link to post
Share on other sites



Found this in the helpfile:

#Include <GuiEdit.au3>

_GUICtrlEdit_SetSel($hWnd, $iStart, $iEnd)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

GREAT!!!!

THANK YOU VERY MUCH!!!!!!!!! :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

wait..

I am trying this now..

but I don't really know how to use it..

A little more help please?

-edit

I am making a text editor and I want: A string find select func

a: Select all func

Edited by ludocus

Share this post


Link to post
Share on other sites

but I don't really now how to use it..

its: Know, not now :)

example:

#include <GUIConstants.au3>
#include <GuiEdit.au3>

$EditString = StringFormat("Hallo ludo \r\n\r\ntekstjes, tekst\r\nVinkeveen rocks :P")
$SearchString = "Vinkeveen rocks"

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125)

    $hEdit = GUICtrlCreateEdit("", 48, 48, 545, 353)
    $hEdit = GUICtrlGetHandle($hEdit)
    GUICtrlSetData(-1, $EditString)
    
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


$Start = StringInStr($EditString,$SearchString)-1
$Length = StringLen($SearchString)

_GUICtrlEdit_SetSel ($hEdit, $Start, $Start+$Length)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

thnx kip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0