Sign in to follow this  
Followers 0
toddcbrf2

GUICtrlSetData to set string value

5 posts in this topic

#1 ·  Posted (edited)

Hi All.

I'm a noob and would like to get some help with the command GUICtrlSetData and how to use it to set a string value.

ie,

say if aaa is selected, than change a string to "1234", or if bbb is selected, than change the same string value to "4567"

$Platform = GUICtrlCreateCombo("Platform", 8, 8, 97, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))

GUICtrlSetData(-1, "aaa|bbb|ccc")

Can I do something like this?

If GUICtrlRead($Platform) = "aaa" Then $Analyzer = string(1234)

Any help would be appreciated! Thanks in advance!

Todd

Edited by toddcbrf2

“Anyone who has never made a mistake has never tried anything new.”― Albert Einstein

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Hi All.

I'm a noob and would like to get some help with the command GUICtrlSetData and how to use it to set a string value.

ie,

say if aaa is selected, than change a string to "1234", or if bbb is selected, than change the same string value to "4567"

$Platform = GUICtrlCreateCombo("Platform", 8, 8, 97, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))

GUICtrlSetData(-1, "aaa|bbb|ccc")

Can I do something like this?

If GUICtrlRead($Platform) = "aaa" Then $Analyzer = string(1234)

Any help would be appreciated! Thanks in advance!

Todd

yes you can do like this. This will work for sure. I have a code in the same way. But all i wanted to know is whether you wanted to this happen after clicking a button kind of "OK" or "Check"? For example,

i have a Combobox created with the value of "aaa|bbb|ccc" after selecting this if i wanted to set the value as "1234" i will be calling in a different function. As shown below,

If $nmsg = $Button (which is "ok or "Check") then call("check")

Func check()

Global $plat = GUICtrlRead($Platform)

If $plat = "aaa" then $val = "1234"

..

.

.

.

.

so on you can continue..

EndFunc

please let me know if i made u confused i will try to explain in another way... :x

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

here i have the example code which i tied and work for me....

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 633, 447, 192, 124)

$Combo1 = GUICtrlCreateCombo("", 120, 72, 265, 25)

GUICtrlSetData(-1, "aaa|bbb|ccc")

$Button1 = GUICtrlCreateButton("Check", 128, 144, 257, 33, $WS_GROUP)

$Input1 = GUICtrlCreateInput("", 128, 232, 257, 21)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

Call("check")

EndSwitch

WEnd

Func check()

$plat = GUICtrlRead($Combo1)

If $plat = "aaa" Then $value = "1234"

GUICtrlSetData($Input1,$value)

EndFunc


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

Thanks Syed and JohnOne. I really appreciate your feedback.

I think I understand what you are saying. My original plans were to create a very simple three pulldown and perform a function when hitting an OK button just like you mention. Depending on the combination of items, it will perform a function.

Thanks again for your help, this AutoIT is an awesome tool! Now I just need to learn and become more proficient with the basics of programming.

Cheers!


“Anyone who has never made a mistake has never tried anything new.”― Albert Einstein

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