如何控制EDIT中输入的数值在0~59之间?
解决方案 »
- delphi listview与数据库的问题!
- socket的data属性的作用是什么?
- 是男人都看看
- 创建表的问题
- NMSMTP控件发EMAIL问题(SMTP服务器需要身份验证)
- 散分 =》 大专 + 三年Delphi + 深圳 = 找不到工作!
- 本人写的一份作品,请大家多多指教(局域网办公系统LANOA)
- 调用DLL中MDIChild的难题解决了,更大的难题又来了。
- ADO已坏,如何重装,去哪里下载ADO软件?????????????????????
- 菜鸟问题:如何使Label在鼠标进入时发生变化?
- 小弟急呀!如何进行小票打印呀!!!请大家帮帮忙了!
- 装DELPHI时有一个Java Plug-in Control Panel是做什么用的?
begin
//your code
end;
我倒Key in ['0'..'59'])),有这样的?
首先用SetWindowLong(Edit1.Handle, GWL_STYLE,
GetWindowLong(Edit1.Handle, GWL_STYLE) or
ES_NUMBER);
限制edit只能输入数字
然后在change事件中判断
if edit.text<>'' and strtoint(edit1.text)>=0 and strtoint(edit1.text)<=59 then
.........
高手,呵呵
begin if Not (Key In [#8, #48 .. #57]) then Key := #0;
if Length(Edit1.Text) > 2 then Key := #0;
if StrToIntDef(Edit1.Text + Key, 0) > 59 then Edit1.Text := '';end;
看来真的是晚上了,一下冒了好多星星出来
begin
if not (Key in ['0'..'9',#8]) then Key:=#0;
end;procedure TForm1.Edit1Exit(Sender: TObject);
var
num,rflag:Integer;
begin
Val(Edit1.Text,num,rflag);
if num>59 then num:=59;
Edit1.Text:=IntToStr(num);
end;