# Mark/Highlight text in inputbox

## Recommended Posts

Hey there

I want to mark the content of an inputbox when you click on the text inside.

Excample: I have an inputbox which has the data "a". When I click inside the inputbox I want the "a" to be highlighted blue, so I can easily copy-paste it out.

GUICreate("",300,100)
$Input1 = GUICtrlCreateInput("",10,10,50,30)$Input2 = GUICtrlCreateInput("a",100,10,50,30)
GUISetState()
While True
Switch GUIGetMsg()
Case -3
Exit
EndSwitch
WEnd

I searched google and the forum and did not find anything.

Thanks!

Edited by Quegga

##### Share on other sites

I'm not sure this is possible with GUICtrlCreateInput. But maybe _GUICtrlEdit_SetSel is what you are looking for. Try the example script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:

##### Share on other sites

Thanks a lot,
this was exactely what I was searching for.

It is possible to use _GUICtrlEdit_SetSel on a GUICtrlCreateInput

Edited by Quegga

##### Share on other sites

Don't know. Did you try it?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:

## Create an account

Register a new account

• ### Similar Content

• HI everybody! It's been a (very) long time since I posted something useful!
Here I come with a new functions that I needed in a project that needs many different forms to insert different data into a database. Instead of creating a different Koda form for each data type, I decided to create this function, inspired by this one (from the excellent IUP GUI library).
To create an input dialog, you first must create a JSON definition of this dialog. Simple example of a login form:
{ title: "Dialog Title", controls: [ {type:"label", value:"Please login"}, {type:"input", id:"user", label:"User name"}, {type:"input", id:"pass", label:"Password", style:$ES_PASSWORD}, {type:"check", id:"remember", label:"Remember me", value:true} ] } Then pass it to the advInputBox function: #include "advInputBox.au3" Dim$oRet = advInputBox($sJSON) If @error Then MsgBox(64, "Example1", "Dialog canceled") Else MsgBox(64, "Example1", "Return: " & Json_Encode($oRet, 128)) ; you can access individual values by ids: ; Json_ObjGet($oRet, "username") ; Json_ObjGet($oRet, "password") ; Json_ObjGet(oRet, "remember") EndIf And you will get an InputBox like this one: The code is on GutHub Enjoy! • Good morning, I am trying to align a two-line text in a button so that it would be centered in the button but can't succeed to do it for the vertical part. Can someone tell me what I do wrong ? Here is my code:btn3 = GUICtrlCreateButton("Execute " & @LF & " file 1", 100, 65, 60, 50, _ BitOr($BS_CENTER,$BS_BOTTOM,$BS_MULTILINE)) and here is the resulting layout I get in my window. I tried to follow the help, made a lot of different parameter combinations (here it's $BS_BOTTOM, but I tried $BS_VCENTER and $BS_TOP), still get the same result : vertical alignement is a no go for me.
Can someone help ?
TIA
Gilles

• So basically need to pull text from a .txt file or .sql and use that text to replace something within a different file.

First File:
jumps

Or:
Text1 = jumps
Text2 = fence
Second File:
My Dog XXXXX over the YYYYY.

After Script:
My Dog jumps over the fence

I have found a good start, I'm basic programmer at best, I have some experience but this gets out of my wheel house.

Any help is appreciated.

• By misioooo
Hi!

I am writing some GUI and i need to use images as buttons, but with text on them (text is from INI file).
Part with button looks like this:
$ankieta1 = GUICtrlCreateButton($txtAnk1, 100,350,765,164) GUICtrlSetFont(-1, 22, 800, -1, "Arial") ;GUICtrlSetColor(-1,0xffffff) $hImageBtn_1 = _GUIImageList_Create(765, 164) _GUIImageList_AddBitmap($hImageBtn_1, "c:\path\to\ankieta_clean.bmp") _GUICtrlButton_SetImageList($ankieta1,$hImageBtn_1, 4) GUICtrlSetOnEvent(-1, "On_Ankieta1") The problem - if i uncomment GUICtrlSetColor, color of text changes, but button is just plain gray (no image). How i can change text color not touching image on a button here?
• By vin1
i have a script that selects  a text file and deletes a line (text input required) in the text file selected
i have to make it remove all lines found on a file i name, toRemoveLines.txt
it has to remove lines from all text files found in a folder
this is the script that has to be modified
where it says "select file" it has to be "select folder"
where it says "line text input" it has to be all lines from a text file
#Include <File.au3> Global $success = False$file_name = FileOpenDialog("Select file", @ScriptDir, "All files (*.*)", 1+4) $line_text_input = InputBox("Line's text", "Line must contain following text:", "line contains this text")$file_count_lines = _FileCountLines($file_name) for$i = 0 to $file_count_lines$Lines_text_output = FileReadLine($file_name,$i) if StringInStr($Lines_text_output,$line_text_input) then _FileWriteToLine($file_name,$i, "", 1) $success = True ExitLoop EndIf Next if$success = True Then MsgBox(0, "Success", "Line has been deleted") Else MsgBox(0, "Failure", "Line wasn't found") EndIf
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...