找回密码
 加入
搜索
查看: 1227|回复: 2

在来一问,变量赋值问题

[复制链接]
发表于 2009-7-21 13:08:59 | 显示全部楼层 |阅读模式
本帖最后由 xg911335 于 2009-7-21 13:50 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $x
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 167, 94, 192, 114)
$Input1 = GUICtrlCreateInput($x, 24, 16, 121, 21)
$Button1 = GUICtrlCreateButton("test", 40, 56, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        t()
        EndSwitch
WEnd

Func t()
        $t = "123"
        $x = $t
EndFunc
按下$Button1,func里面执行代码,怎样才能把func里面的结果传递给$Input1里的$x变量上?
发表于 2009-7-21 13:22:41 | 显示全部楼层
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $x
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 167, 94, 192, 114)
$Input1 = GUICtrlCreateInput($x, 24, 16, 121, 21)
$Button1 = GUICtrlCreateButton("test", 40, 56, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        t()
        EndSwitch
WEnd

Func t()
        $t = "123"
        GUICtrlSetData($Input1,$t)
EndFunc

评分

参与人数 1金钱 +10 贡献 +10 收起 理由
kn007 + 10 + 10 原创内容,感谢你对论坛的支持;希望继续发 ...

查看全部评分

 楼主| 发表于 2009-7-21 13:50:29 | 显示全部楼层
非常感谢。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-7 11:20 , Processed in 0.077438 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表