Jump to content

find a string and select it (GuiCtrlCreateEdit)


Recommended Posts

$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
Link to comment
Share on other sites

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
Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...