[DUG] hour / minute component
John Bird
johnkbird at paradise.net.nz
Fri Feb 5 13:52:57 NZDT 2010
Incidentally I have taken to doing something similar with date entry. An edit box, but in this case I put a little arrow button at the end of it, and clicking that superimposes a date picker over the edit box. Its rather more work but it works really neatly, and can be easily repeated.
Date entry is flexible, as a string today could be
5-feb-10
5.2.10
5.2.2010
5/2/10
on exit the date is verified, and the date picker if clicked populates the text field with the first format above.
Entering dates like this is very flexible, caters for those who like to use the keyboard and those who like to use the mouse.
Using the date picker is especially cool under Vista/Windows 7 as the newer Date picker is really really nice - anyone else noticed that?
Means doing something like:
(DateTimePicker is normally invisible)
procedure Tform1.btnStartDateClick(Sender: TObject);
begin
DateTimePicker1.left:=edtStartDate.Left;
DateTimePicker1.top:=edtStartDate.Top;
DateTimePicker1.width:=edtStartDate.width+btnStartDate.Width;
DateTimePicker1.Date:=xfAdateToDTDate(edtStartDate.Text);
DateTimePicker1.Visible:=true;
PickStartOrFin:=1;
DateTimePicker1.Perform(WM_SYSKEYDOWN, VK_DOWN, 0);
end;
//this code handles two separate edit boxes
procedure Tform1.DateTimePicker1CloseUp(Sender: TObject);
begin
if PickStartOrFin=1 then edtStartDate.Text:=xfdtDateToAdate(DateTimePicker1.Date);
if PickStartOrFin=2 then edtFinDate.Text:=xfdtDateToAdate(DateTimePicker1.Date);
DateTimePicker1.Visible:=false;
//redisplay data to reflect new date
Redisplay data;
end;
(the xfDTDatetoADate and xfADatetoDTDate are my library routines to convert between string dates and TDateTime)
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100205/8061adb2/attachment.html
More information about the Delphi
mailing list