Jump to content

Getting InputBox to automatically remove text when clicked.


GeekS
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

#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 =]

Link to comment
Share on other sites

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
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...