Question : DateTimePicker question

Hi,

I have a datetimepicker on my form, that I don't get on the current date.
I have put: GotoDatePicker.Date := Date; in the OnShow-event, but the
datetimepicker gets the date of my component JvDays1 from JediVCL.
I have put some code in the code-section.

Who knows the answer and is willing to help me?

Greetings, Peter Kiers
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
procedure TMainForm.FormShow(Sender: TObject);
var
  ResName : String;
begin
  GotoDatePicker.Date := Date;
 // GotoDatePicker.Date := EncodeDate(2002, 1, 1);
  TimeIncCombo.ItemIndex := 1;
  ModeCombo.ItemIndex := 0;
  DaysCombo.ItemIndex := 6;
  With SchedulesQuery do
    try
      Open;
      First;
      While not EOF do
        Begin
          ResName := SchedulesQuery.FieldByName('SchedName').AsString;
          ResourceCombo.Items.Add(ResName);
          VisibleResources.ResourcesCheckList.Items.Add(ResName);
          Next;
        End;
      Close;
    except
      on E:EDBEngineError do
      begin
        ShowMessageFmt('%s:'#13#10'Try moving the database to a shorter path.',[E.Message]);
        Application.Terminate;
        Exit;
      end;
    end;
  ResourceCombo.ItemIndex := 0;
  VisibleResources.ResourcesCheckList.Checked[0] := True;
  TFDays.Template.CompNames.Add(VisibleResources.ResourcesCheckList.Items[0]);
  ResourceComboChange(nil);
  DaysComboChange(nil);
  ModeComboChange(nil);
  //GotoDatePicker.Date := EncodeDate(2002, 1, 1);
  GotoDatePickerChange(nil);
  TimeIncComboChange(nil);
end;
(*------------------------------------------------------*)
procedure TMainForm.GotoDatePickerChange(Sender: TObject);
begin
  TFDays.GotoDate(GotoDatePicker.Date);
  TFWeeks.DisplayDate := GotoDatePicker.Date;
  TFMonths.DisplayDate := GotoDatePicker.Date;
end;

Answer : DateTimePicker question

put initialisation in formcreate, not formshow

formshow is for every time a form is shown
like hide/show/hide/show ... etc

tried this ?
JvDays1.Date := Date;
Random Solutions  
 
programming4us programming4us