Jump to content

value of GUI item in variable


jakub
 Share

Recommended Posts

ive got 3 inputs, and i want to set data in depends of condition $c

Switch $c

Case 1

$v=$input1

Case 2

$v=$input2

Case 3

$v=$input3

Endswitch

GUICtrlSetdata($v,$m)

but it doesnt work like that :/

Expected a "=" operator in assignment statement.:

$v=$input1

and i wont do it this way:

Case 1

GUICtrlSetdata($input1,$m)

casue my script is a lot more complicated

so if there is better option i would be gratefull for help

Link to comment
Share on other sites

ive got 3 inputs, and i want to set data in depends of condition $c

Switch $c

Case 1

$v=$input1

Case 2

$v=$input2

Case 3

$v=$input3

Endswitch

GUICtrlSetdata($v,$m)

but it doesnt work like that :/

Expected a "=" operator in assignment statement.:

$v=$input1

and i wont do it this way:

Case 1

GUICtrlSetdata($input1,$m)

casue my script is a lot more complicated

so if there is better option i would be gratefull for help

A simple look would be work, but we don't know the types of values in the ID's. Maybe you need some tests for encounter the problem.

A suggestion: Adding an Else statement to Switch and checking the result in $v and $c vars.

Link to comment
Share on other sites

variable $input1 is created as a

$input1=GUICtrlCreateInput("",...)

so i can set data in this input by

GUICtrlSetData($input,"")

but cause i dont know in wich input data should be set i use

GUICtrlSetData($v,"")

and function data chose input

func choseinput()

$v=$input1

endfunc

[its example to show in simple way what the problem is]

Link to comment
Share on other sites

It works for me.

$gui = GUICreate('', 200, 200)
$input1 = GUICtrlCreateInput('', 0, 0, 100, 20)
$input2 = GUICtrlCreateInput('', 0, 20, 100, 20)
$input3 = GUICtrlCreateInput('', 0, 40, 100, 20)
GUISetState()

$c = 1
Switch $c
    Case 1
        $v = $input1
    Case 2
        $v = $input2
    Case 3
        $v = $input3
EndSwitch

$m = 'Text'
GUICtrlSetData($v, $m)

While 1
    $gm = GUIGetMsg()
    Switch $gm
        Case -3 ; $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
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...