function updateOutput(){
var h=app.pageFragments.TimePicker2.properties.hour||'00';
var m=app.pageFragments.TimePicker2.properties.minute||'00';
var s=app.pageFragments.TimePicker2.properties.second||'00';
var t=h + ':' + m + ':' + s;
app.pageFragments.TimePicker2.descendants.timeLBL.text=t;
return t;
}
function updateHour(v){
app.pageFragments.TimePicker2.properties.hour=v;
updateOutput();
}
function updateMinute(v){
app.pageFragments.TimePicker2.properties.minute=v;
updateOutput();
}
function updateSecond(v){
app.pageFragments.TimePicker2.properties.second=v;
updateOutput();
}
这是我的时间选择器的样子:
是 . 添加所有按钮是令人讨厌的,但有 a few features about AppMaker that make it more tolerable.
I just figured out how to grab the buttons all a one time by pushing shift and selecting with the mouse
使用 updateMinute(widget.text) 和 updateSecond(widget.text);This saves you a lot of time typing all of the functions into each widget control panel. 对分钟和秒按钮执行相同的操作 . 此外,您不必费心给出所有按钮特殊名称,就像我一样 .
Here's a demo:处于预览模式 . 抱歉24小时制 . 我总是将它用于我自己的东西,因为它可能需要上午和下午 . 我可能会回去做那件事 .
对于AM / PM Picker,我使用了以下功能:
function updateOutputAP(){
var h=app.pageFragments.TimePicker3.properties.hour||'00';
var m=app.pageFragments.TimePicker3.properties.minute||'00';
var s=app.pageFragments.TimePicker3.properties.second||'00';
var ap=app.pageFragments.TimePicker3.properties.ap||' ';
var t=h + ':' + m + ':' + s + ' ' + ap;
app.pageFragments.TimePicker3.descendants.timeLBL.text=t;
return t;
}
function updateHourPM(v){
app.pageFragments.TimePicker3.properties.hour=v;
app.pageFragments.TimePicker3.properties.ap='PM';
updateOutputAP();
}
function updateHourAM(v){
app.pageFragments.TimePicker3.properties.hour=v;
app.pageFragments.TimePicker3.properties.ap='AM';
updateOutputAP();
}
function updateMinuteAP(v){
app.pageFragments.TimePicker3.properties.minute=v;
updateOutputAP();
}
function updateSecondAP(v){
app.pageFragments.TimePicker3.properties.second=v;
updateOutputAP();
}
3 回答
此时App Maker不提供开箱即用的时间或日期/时间选择器小部件,这意味着您需要自己实现一个 . 至少有两种方法可以完成此任务:
App Maker way
等待并希望App Maker将引入时间或日期/时间选择器窗口小部件或使用现有的App Maker窗口小部件来模拟时间选择器 . Calendar Sample可以是一个很好的起点:
Hack into DOM/JS
如果您不担心跨浏览器兼容性,并且您可以通过javascript使用DOM操作,创建事件监听器和其他很酷的东西,那么您可以使用HTML widget和本机date/time或time输入,甚至是第三个党的图书馆 .
App Maker的时间选择器
我读了你的问题,并认为我会尝试自己的角色,这就是我想出的 . 我将所有按钮放在pageFragment上并用
app.showDialog(app.pageFragments.timePicker2);
调用它我只使用客户端脚本 .
这是我的时间选择器的样子:
是 . 添加所有按钮是令人讨厌的,但有 a few features about AppMaker that make it more tolerable.
首先,您可以指定我用作全局属性的TimePicker表单属性 . 我有三小时,一分钟和一秒钟 .
I just figured out how to grab the buttons all a one time by pushing shift and selecting with the mouse
使用
updateMinute(widget.text)
和updateSecond(widget.text);
This saves you a lot of time typing all of the functions into each widget control panel. 对分钟和秒按钮执行相同的操作 . 此外,您不必费心给出所有按钮特殊名称,就像我一样 .但您可能希望使用以下css格式化它们 .
这样您就可以同时设置所有按钮的样式 .
我的保存按钮只是将最终字符串复制到主面板上的标签中 .
你可能想要做一些更优雅的事情 .
Here's a demo:处于预览模式 . 抱歉24小时制 . 我总是将它用于我自己的东西,因为它可能需要上午和下午 . 我可能会回去做那件事 .
对于AM / PM Picker,我使用了以下功能:
这就是我的选择器的样子:
现在我知道如何使用鼠标轻松选择组件,这是一个休息时间来进行此更改 .
Three AppMaker Time Pickers:
一个简单的选择是简单地使用文本框并在模型字段中设置验证 . 您可以在保存时更新Date对象,也可以按原样使用,具体取决于您的应用程序 . 您可以在UI中获得自动验证错误的好处,以指导您的用户,并且只需几秒钟即可完成设置 .
正则表达式: