Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Misc > DBGrid and TDat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 6030 of 6114
Post > Topic >>

DBGrid and TDateTimePicker

by "FrancoJommi" <franco.jommi@[EMAIL PROTECTED] > Apr 2, 2008 at 04:06 PM

I am using the following routine to  show a TDateTimePicker component on a 
Date field in a DBGrid. It works but it has a quirk which makes it
unusable. 
When the user gets into the cell, a comboBox is shown and he can click on
it 
to choose the date in the Calendar; but as soon as the date is chosen and 
gets into the cell, the combo box cannot be shown anymore.
What is it that I am doing wrong ?

with Sender as TDBGrid do
  begin
  // make sure our cell has focus
  if ( gdFocused in State ) then
  begin
    // make sure we are on the proper column
    if Column.Field.DataType = ftDate then
    begin
      SetWindowPos(DateTimePicker.Handle, // handle
                   0, // change z-order
                   Rect.Left + Left + 1,
                   Rect.Top + top + 1,
                   Rect.Right - Rect.Left + 2,
                   Rect.Bottom - Rect.top + 2,
                   SWP_NOZORDER or SWP_SHOWWINDOW);
      // set the date in the datetimepicker to the date if the current 
record
      if Column.Field.IsNull then
        DateTimePicker.Date := Date
      else
        DateTimePicker.Date := Column.Field.AsDateTime;
    end;
  end;
 




 1 Posts in Topic:
DBGrid and TDateTimePicker
"FrancoJommi" &  2008-04-02 16:06:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 5:50:33 CDT 2008.