找回密码
 加入
搜索
楼主: cashiba

[GUI管理] 如何实现输入框之间的数据互相随之即时改变?[已解决]

 火.. [复制链接]
 楼主| 发表于 2017-4-16 23:31:58 | 显示全部楼层
回复  cashiba
不就是這個的 變化應用而已??
kk_lee69 发表于 2017-4-16 22:05

嗯,用到了消息函数,去学习学习...
发表于 2017-4-16 23:50:46 | 显示全部楼层
回复 14# cashiba


    这样就行的了




#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("", 64, 32, 201, 21)
$Input2 = GUICtrlCreateInput("", 64, 80, 201, 21)
$Input3 = GUICtrlCreateInput("", 64, 128, 201, 21)
$Input4 = GUICtrlCreateInput("", 64, 176, 201, 21)
$Inputx = GUICtrlCreateEdit("", 64, 240, 500, 89, $ws_border)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Local $aaa = GUICtrlRead($Inputx)
        Local $bbb = GUICtrlRead($Input1) & "/" & GUICtrlRead($Input2) & "/" & GUICtrlRead($Input3) & "/" & GUICtrlRead($Input4)
        If $aaa <> $bbb Then
                If _GUICtrlEdit_GetModify($Inputx) = True Then
                        Local $arr = StringSplit($aaa, "/")
                        If $arr[0] = 4 Then
                                GUICtrlSetData($Input1, $arr[1])
                                GUICtrlSetData($Input2, $arr[2])
                                GUICtrlSetData($Input3, $arr[3])
                                GUICtrlSetData($Input4, $arr[4])
                        EndIf
                Else
                        GUICtrlSetData($Inputx, GUICtrlRead($Input1) & "/" & GUICtrlRead($Input2) & "/" & GUICtrlRead($Input3) & "/" & GUICtrlRead($Input4))
                EndIf
        EndIf
        

        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

评分

参与人数 1金钱 +19 收起 理由
cashiba + 19

查看全部评分

发表于 2017-4-16 23:55:44 | 显示全部楼层
回复 1# cashiba



這樣的效果嗎??

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2017-4-17 00:38:40 | 显示全部楼层
回复  cashiba
这样就行的了
绿色风 发表于 2017-4-16 23:50

还是风侠厉害,就是这个效果.....
 楼主| 发表于 2017-4-17 00:39:07 | 显示全部楼层
回复  cashiba
這樣的效果嗎??
kk_lee69 发表于 2017-4-16 23:55

这个也还是单向变化
发表于 2017-4-18 10:26:18 | 显示全部楼层
回复 20# cashiba

还是有点问题
把编辑框里的“/”删除掉,再删除编辑框里的其它数据,输入框就不起作用了
 楼主| 发表于 2017-4-18 17:42:57 | 显示全部楼层
嗯,经过后面的测试,是有些不完美。看样子还是要用注册消息最好
 楼主| 发表于 2017-4-18 17:44:34 | 显示全部楼层
算是半解决吧,也不能再改成未解决状态了,以后再慢慢研究....
发表于 2017-4-20 09:52:59 | 显示全部楼层
回复 15# cashiba


我一般也是使用 #13 的方法,定义一个变量等于起始值,起始值变化则变化。多个输入框检测同样道理,只是语句多一点而已。
发表于 2017-4-20 10:19:38 | 显示全部楼层
回复 23# cashiba

這是簡單的  檢查核對問題而已.......  不是要求 問個問題  人家要寫到 完全一模一樣  才算問題解決吧.............

依據 上面 你說的 半解決的程式碼.........稍微改一下 不就好了......

我只能說  人家回答問題.....只能解決你無法解決的關鍵..... 其他 基礎的花心思 就可以做的事情,不應該是回答妳問題的人要解決的

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <Array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("", 64, 32, 201, 21)
$Input2 = GUICtrlCreateInput("", 64, 80, 201, 21)
$Input3 = GUICtrlCreateInput("", 64, 128, 201, 21)
$Input4 = GUICtrlCreateInput("", 64, 176, 201, 21)
$Inputx = GUICtrlCreateEdit("", 64, 240, 500, 89, $ws_border)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 
While 1
        Local $aaa = GUICtrlRead($Inputx)
        Local $bbb = GUICtrlRead($Input1) & "/" & GUICtrlRead($Input2) & "/" & GUICtrlRead($Input3) & "/" & GUICtrlRead($Input4)
        If $aaa <> $bbb Then
                If _GUICtrlEdit_GetModify($Inputx) = True Then
                        Local $arr = StringSplit($aaa, "/")
                                                _ArrayAdd($arr,"")
                                                _ArrayAdd($arr,"")
                                                _ArrayAdd($arr,"")
                                                _ArrayAdd($arr,"")

                        GUICtrlSetData($Input1, $arr[1])
                        GUICtrlSetData($Input2, $arr[2])
                        GUICtrlSetData($Input3, $arr[3])
                        GUICtrlSetData($Input4, $arr[4])


                                                GUICtrlSetData($Inputx, $arr[1] & "/" & $arr[2] & "/" & $arr[3] & "/" & $arr[4])
                Else
                        GUICtrlSetData($Inputx, GUICtrlRead($Input1) & "/" & GUICtrlRead($Input2) & "/" & GUICtrlRead($Input3) & "/" & GUICtrlRead($Input4))
                EndIf
        EndIf
        
 
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

评分

参与人数 1金钱 +40 收起 理由
chzj589 + 40 赞!

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-19 08:12 , Processed in 0.068597 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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