Sign in to follow this  
Followers 0
schilbiz

Is it possible to have the dispaly text change what it inputs?

5 posts in this topic

How could this be possible?

#include <GUIConstants.au3>

GUICreate("My GUI",310,225)

$I_Machine = GUICtrlCreateInput("", 10,10,100,120)


$list = GUICtrlCreateList("",200,10,100)
GUICtrlSetData($list, "User Bob")
GUICtrlSetData($list, "User Mary")
GUICtrlSetData($list, "User Dole")

$selectbutton = GUICtrlCreateButton ("Select Username", 200,120,100)
$Text = GUICtrlCreateLabel("When you have a username selected and you hit Select Username, "& _
         "I want predetermined text to appear in the left box to be something other than what is selected." & _
         "So like User Bob would input his computer name Bobs PC instead of User Bob.", 5, 150, 300, 64)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    $one = GUICtrlRead ($list)
    If $msg = $selectbutton Then
        GUICtrlSetData ($I_Machine , "")
        GUICtrlSetData ($I_Machine ,$one)
    EndIf
Wend

Share this post


Link to post
Share on other sites



I'm not fully understanding what you are asking. If you want the user to input data then when clicking the btn go to a inputbox. But if you just need to use some preset text based on the name you would need to set it up in variable. What are you looking for in the end?

Share this post


Link to post
Share on other sites

I'm not fully understanding what you are asking. If you want the user to input data then when clicking the btn go to a inputbox. But if you just need to use some preset text based on the name you would need to set it up in variable. What are you looking for in the end?

Preset text based on the name setup in the variable is exactly what I am looking for. I was having a hard time trying to describe it.

Share this post


Link to post
Share on other sites

Obviously this isn't the cleanest code, but the idea your looking for is something like this. The output could be in a variable ahead of time, or read from a file etc.

#include <GUIConstants.au3>

GUICreate("My GUI",310,225)

$I_Machine = GUICtrlCreateInput("", 10,10,100,120)


$list = GUICtrlCreateList("",200,10,100)
GUICtrlSetData($list, "User Bob")
GUICtrlSetData($list, "User Mary")
GUICtrlSetData($list, "User Dole")

$selectbutton = GUICtrlCreateButton ("Select Username", 200,120,100)
$Text = GUICtrlCreateLabel("When you have a username selected and you hit Select Username, "& _
         "I want predetermined text to appear in the left box to be something other than what is selected." & _
         "So like User Bob would input his computer name Bobs PC instead of User Bob.", 5, 150, 300, 64)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    $one = GUICtrlRead ($list)
    If $msg = $selectbutton Then
        GUICtrlSetData ($I_Machine , "")
    if $one = "User Bob" Then GUICtrlSetData ($I_Machine ,"Bob's PC")
    if $one = "User Mary" Then GUICtrlSetData ($I_Machine ,"Mary's PC")
    if $one = "User Dole" Then GUICtrlSetData ($I_Machine ,"Dole's PC")
        
    EndIf
Wend

Share this post


Link to post
Share on other sites

Hey thanks stampy! It works for what I need it for and gives me some ideas on new things to try. I appreciate it.

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