Jump to content
Sign in to follow this  
GeekS

Getting InputBox to automatically remove text when clicked.

Recommended Posts

GeekS

Lets say we have a GUI with an input box like this:

$BeltInput1 = GUICtrlCreateInput("FCR", 369, 281-20, 31, 20, $ES_CENTER, $WS_EX_TRANSPARENT)
GUICtrlSetFont(-1, 8, 1500, 0, "Arial")
GUICtrlSetBkColor(-1, 3223601)
GUICtrlSetColor(-1, 0xFFFFFF)

Now, whenever i want to insert something in the box instead of "FCR", i have to "Overwrite" it. I want it to automatically remove the "FCR" whenever i click a box.

Thanks in advance, Gnu / GeekS.

Share this post


Link to post
Share on other sites
YellowLab

GUICtrlSetData may be the function you are looking for.

GUICtrlSetData($BeltInput1,"The New Data") or

GUICtrlSetData($BeltInput1,"") for nothing

Bob

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Share this post


Link to post
Share on other sites
GeekS

It's not exactly the command GUICtrlSetData i'm searching for. However i want it to do the same as you wrote, only when i click on the inputbox.

Share this post


Link to post
Share on other sites
oren

Try using

GUIGetMsg (1)

This give you a array...

Try reading the array and then you'll know what to do...

Share this post


Link to post
Share on other sites
GeekS

Try using

GUIGetMsg (1)

This give you a array...

Try reading the array and then you'll know what to do...

Sadly it doesnt actually tell me anything out from this:

$array[0] = 0 or Event ID or Control ID
$array[1] = The window handle the event is from
$array[2] = The control handle the event is from (if applicable)
$array[3] = The current X position of the mouse cursor (relative to the GUI window)
$array[4] = The current Y position of the mouse cursor (relative to the GUI window)

Anyone who can help me actually read how to make that array usefull for my purpose?

Share this post


Link to post
Share on other sites
nuki

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("GUI", 434, 58, 193, 125)
$input = GUICtrlCreateInput("blub", 16, 16, 393, 21)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    $cmsg = GUIGetCursorInfo($gui)
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $cmsg[4] = 3 AND $cmsg[2] = 1 Then GUICtrlSetData($input,"")
WEnd

have fun =]

Share this post


Link to post
Share on other sites
nuki

/ sorry for double post :S forum bug

Edited by nuki

Share this post


Link to post
Share on other sites
GeekS

Thanks Nuki for helping, helped me out there :). Didnt end up exactly the way you said but something like it:

Case $msg = $GUI_EVENT_PRIMARYUP

Dim $Item[44] = ["", $HelmInput1, $HelmInput2, $HelmInput3, $HelmInput4, $AmuletInput1, $AmuletInput2, $AmuletInput3, $AmuletInput4, $WeaponInput1, $WeaponInput2, $WeaponInput3, $WeaponInput4, $ArmorInput1, $ArmorInput2, $ArmorInput3, $ArmorInput4, $ShieldInput1, $ShieldInput2, $ShieldInput3, $ShieldInput4, $GlovesInput1, $GlovesInput2, $GlovesInput3, $Ring1Input1, $Ring1Input3, $BeltInput1, $BeltInput2, $BeltInput3, $BeltInput4, $Ring2Input1, $Ring2Input3, $BootsInput2, $BootsInput3, $BootsInput4, $CharmsInput2, $CharmsInput3, $CharmsInput4, $SkillsInput3, $Skillsinput4]

$click=GUIGetCursorInfo()
For $count = 1 to 43
If $click[4] = $Item[$count] Then GUICtrlSetData($item[$count],"")

Next

This topic can be closed.

Edited by GeekS

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.