Sign in to follow this  
Followers 0
Mikeman27294

Indentation in Input form (GUICtrlCreateInput)

7 posts in this topic

#1 ·  Posted (edited)

Hello everyone.

The name says it all. How do I indent text in an input form without it selecting text?

Here is a small script I whipped up for anybody who doesnt understand what I mean. Just run the script, and go to the bottom of the text input box and press tab to attempt to indent.

GUICreate("")
GUICtrlCreateInput("Input", 0, 0, 500, 500, 0x1404)
GUISetState()

While 1
    Select
        Case GUIGetMsg()=-3
            Exit
    EndSelect
WEnd

Oh, and the textbox is multi-line enabled.

Thanks.

EDIT

Oh, and btw, would it be better to use an editbox in the instance of a notepad like program, or should I stick with the input box?

Thanks again.

Edited by Mikeman27294

Share this post


Link to post
Share on other sites



You can try this way:

$hGUI = GUICreate("")
$idInp = GUICtrlCreateInput("Input", 0, 0, 500, 500, 0x1404)
$idDummy = GUICtrlCreateLabel("", 0, 0, 0, 0)
GUISetState()
ControlFocus("", "", $idDummy)

While 1
    Select
        Case GUIGetMsg()=-3
            Exit
    EndSelect
WEnd

Use a EditBox control if you want someting like a Notepad program.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

You can try this way:

$hGUI = GUICreate("")
$idInp = GUICtrlCreateInput("Input", 0, 0, 500, 500, 0x1404)
$idDummy = GUICtrlCreateLabel("", 0, 0, 0, 0)
GUISetState()
ControlFocus("", "", $idDummy)

While 1
    Select
        Case GUIGetMsg()=-3
            Exit
    EndSelect
WEnd

Use a EditBox control if you want someting like a Notepad program.

Br,

UEZ

Thanks for your help. Unfortunately, that did not work, as it seems to keep focus on the input part. I moved the ControlFocus line inside the while loop and that just prevented input. I will change it to an EditBox, but that will not help with using the tab to indent.

Thanks again though.

Share this post


Link to post
Share on other sites

I cannot fully understand what you want to do but is this what you looking for?

$WS_TABSTOP = 0x00010000
$hGUI = GUICreate("", 500, 500, -1, -1, $WS_TABSTOP)
$idDummy = GUICtrlCreateButton("", 0, 0, 1, 1)
$idInp = GUICtrlCreateInput("Input", 0, 0, 500, 500, 0x1404)
GUISetState()
ControlFocus("", "", $idDummy)

While 1
    Select
        Case GUIGetMsg()=-3
            Exit
    EndSelect
WEnd

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I think what he means is he's attempting to insert @Tab into the input control and instead it takes the default Tab action which in this case will just select the control contents.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

You could do something like this:

GUICreate("")
GUICtrlCreateInput("Input", 0, 0, 500, 500, 0x1404)
GUISetState()
HotKeySet("{TAB}", "_TabIn")
While 1
    Select
        Case GUIGetMsg()=-3
            Exit
    EndSelect
WEnd
Func _TabIn()
    Send("{Space 4}")
EndFunc

You might want to make the HotKeySet conditional on whether the GUI and the Input/Edit control has focus at the time, otherwise TAB will always just Send 4 spaces to whatever window is active at the time.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I think what he means is he's attempting to insert @Tab into the input control and instead it takes the default Tab action which in this case will just select the control contents.

Yep... I mean exactly that.

You could do something like this:

GUICreate("")
GUICtrlCreateInput("Input", 0, 0, 500, 500, 0x1404)
GUISetState()
HotKeySet("{TAB}", "_TabIn")
While 1
    Select
        Case GUIGetMsg()=-3
            Exit
    EndSelect
WEnd
Func _TabIn()
    Send("{Space 4}")
EndFunc

You might want to make the HotKeySet conditional on whether the GUI and the Input/Edit control has focus at the time, otherwise TAB will always just Send 4 spaces to whatever window is active at the time.

Hmmm... Interesting... that worked perfectly for me. I thought about doing it like that myself but thought that it would select all of the text aswell, and therefore, remove all data in the editbox.

Thankyou guys, big help as you all usually are.

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