找回密码
 加入
搜索
查看: 2440|回复: 5

修改时间控件[GUICtrlCreateDate]错误

  [复制链接]
发表于 2010-1-2 12:57:43 | 显示全部楼层 |阅读模式
本帖最后由 afan 于 2010-1-3 15:24 编辑

刚刚发现这样一个问题:
在GUI界面上一个时间控件、一个Input和一个按钮控件
时间控件根据input控件的改变来改变
年份和月份都可以修改,日就不对!
修改数据用GUICtrlSetData没错,不会是AU3本身问题?
如图所示:


源码:
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("时间修改", 248, 159, 192, 114)
$Date1 = GUICtrlCreateDate("", 16, 16, 217, 25,0)
$Input1 = GUICtrlCreateInput("2009-2-15", 16, 56, 217, 21)
$Button1 = GUICtrlCreateButton("修改时间", 8, 96, 233, 41, BitOR($BS_FLAT,$WS_GROUP))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        GUICtrlSetData($Date1,GUICtrlRead($Input1))
        EndSwitch
WEnd

本帖子中包含更多资源

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

×
发表于 2010-1-2 13:09:50 | 显示全部楼层
本帖最后由 sak47 于 2010-1-2 13:11 编辑

$Input1 = GUICtrlCreateInput("2009- 2-15", 16, 56, 217, 21)

或者
$Input1 = GUICtrlCreateInput("2009-02-15", 16, 56, 217, 21)
输入框里的格式不合格. 位数有差错. 换成这样就行了

评分

参与人数 1金钱 +10 收起 理由
afan + 10

查看全部评分

发表于 2010-1-2 13:36:41 | 显示全部楼层
本帖最后由 afan 于 2010-1-2 13:37 编辑
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("时间修改", 248, 159, 192, 114)
$Date1 = GUICtrlCreateDate("", 16, 16, 217, 25, 0)
$Input1 = GUICtrlCreateInput("2009-2-15", 16, 56, 217, 21)
$Button1 = GUICtrlCreateButton("修改时间", 8, 96, 233, 41, BitOR($BS_FLAT, $WS_GROUP))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $str = StringSplit(GUICtrlRead($Input1), '-')
                        GUICtrlSetData($Date1, StringFormat('%4s-%2s-%2s', $str[1], $str[2], $str[3]))
        EndSwitch
WEnd
 楼主| 发表于 2010-1-2 15:20:07 | 显示全部楼层
本帖最后由 jycel 于 2010-1-2 15:26 编辑

看来只有把时间通过StringFormat处理一下才行,因为我是做一个资金统计表,保存时月份不满10就只有一位,所以才导致在修改表时出现时间改不了的情况!
发表于 2016-3-3 15:09:21 | 显示全部楼层
回复 3# afan


    hh:mm:ss  这种格式的时间如何修改呢,怎么弄都不行。
发表于 2016-3-3 15:58:51 | 显示全部楼层
回复  afan


    hh:mm:ss  这种格式的时间如何修改呢,怎么弄都不行。
1361739590 发表于 2016-3-3 15:09



    谁知道你是怎么改的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-29 02:13 , Processed in 0.119119 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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