找回密码
 加入
搜索
查看: 1934|回复: 6

如何使用已有的变量替换combo框中的文字?

[复制链接]
发表于 2008-7-10 20:53:30 | 显示全部楼层 |阅读模式
比如原先是GUICtrlCreateCombo("test1|test2|test3"),如何才能将test1,test2,test3换成我已有变量$A1,$A2,$A3呢?

[ 本帖最后由 pailfj 于 2008-7-13 14:22 编辑 ]
发表于 2008-7-10 20:58:56 | 显示全部楼层
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
dim $A1="1",$A2="2",$A3="3"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 298, 205, 193, 115)
$Combo1 = GUICtrlCreateCombo("", 72, 40, 145, 25)
GUICtrlSetData(-1, "test1|test2|test3")
$Button1 = GUICtrlCreateButton("更改", 96, 112, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Combo1
                Case $Button1
GUICtrlSetData($Combo1, "")  ;清空
GUICtrlSetData($Combo1, $A1&"|"&$A2&"|"&$A3) ;修改
        EndSwitch
WEnd
 楼主| 发表于 2008-7-11 15:10:16 | 显示全部楼层
回答得很详细,受教了,谢谢小三
发表于 2008-7-11 16:41:42 | 显示全部楼层
不用清空,直接GUICtrlSetData($Combo1, "|"&$A1&"|"&$A2&"|"&$A3)也行

评分

参与人数 2金钱 +10 贡献 +1 收起 理由
komaau3 + 10
autoit3CN + 1

查看全部评分

发表于 2008-7-11 16:48:02 | 显示全部楼层
pcbar超版总有些与众不同的东西。谢谢,又学到一招。
发表于 2009-8-5 21:29:22 | 显示全部楼层
pcbar版主果然厉害,又学了一招
发表于 2009-10-15 12:46:35 | 显示全部楼层
学习了~谢谢楼主~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-4 14:08 , Processed in 0.086258 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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