diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-11-07 15:02:46 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-11-07 15:02:46 +0000 |
commit | 71ecfa4f5a469a008ca620adbd982f1fc4d38151 (patch) | |
tree | a3eddc5b301bd17fe7412e1d7e9f74c68c195c94 /examples/gui | |
parent | 1dd148f64e62b71a4bdee7b7b321c106f789625c (diff) | |
download | fpGUI-71ecfa4f5a469a008ca620adbd982f1fc4d38151.tar.xz |
* Rename TfpgCustomComboBox to TfpgAbstractCoboBox.
* Implemented a actualy Calendar Combobox. It's usable at this stage.
* Improved the calendar test project to try out more things.
Diffstat (limited to 'examples/gui')
-rw-r--r-- | examples/gui/calendar/calendartest.lpr | 106 |
1 files changed, 96 insertions, 10 deletions
diff --git a/examples/gui/calendar/calendartest.lpr b/examples/gui/calendar/calendartest.lpr index df924f0b..2ba3343a 100644 --- a/examples/gui/calendar/calendartest.lpr +++ b/examples/gui/calendar/calendartest.lpr @@ -10,13 +10,15 @@ uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} - Classes, SysUtils, fpgfx, gui_form, gui_popupcalendar, gui_edit, + Classes, SysUtils, gfxbase, fpgfx, gui_form, gui_popupcalendar, gui_edit, gui_button, gui_label, gfx_popupwindow, gui_combobox; type TMainForm = class(TfpgForm) private procedure btnDownClicked(Sender: TObject); + procedure btnDateFormatClicked(Sender: TObject); + procedure btnTodayClicked(Sender: TObject); procedure DoDropDown; public {@VFD_HEAD_BEGIN: MainForm} @@ -25,6 +27,13 @@ type lblName1: TfpgLabel; lblName2: TfpgLabel; cbName1: TfpgComboBox; + cbCalendar: TfpgCalendarCombo; + btnDateFormat: TfpgButton; + edtDateFormat: TfpgEdit; + lblName3: TfpgLabel; + lblName4: TfpgLabel; + lblName5: TfpgLabel; + btnToday: TfpgButton; {@VFD_HEAD_END: MainForm} FDropDown: TfpgPopupCalendar; procedure AfterCreate; override; @@ -39,14 +48,23 @@ begin DoDropDown; end; +procedure TMainForm.btnDateFormatClicked(Sender: TObject); +begin + cbCalendar.DateFormat := edtDateFormat.Text; +end; + +procedure TMainForm.btnTodayClicked(Sender: TObject); +begin + cbCalendar.Value := Now; +end; + procedure TMainForm.DoDropDown; begin if (not Assigned(FDropDown)) or (not FDropDown.HasHandle) then begin - FDropDown := TfpgPopupCalendar.Create(nil); + FDropDown := TfpgPopupCalendar.Create(nil, edtName1); FDropDown.ShowAt(self, edtName1.Left, edtName1.Top+edtName1.Height); FDropDown.PopupFrame:= True; -// FDropDown.grdName1.SetFocus; end else begin @@ -60,7 +78,7 @@ begin inherited AfterCreate; {@VFD_BODY_BEGIN: MainForm} Name := 'MainForm'; - SetPosition(286, 234, 417, 270); + SetPosition(286, 234, 504, 270); WindowTitle := 'fpGUI Calendar Test'; WindowPosition := wpUser; @@ -68,7 +86,7 @@ begin with edtName1 do begin Name := 'edtName1'; - SetPosition(84, 48, 120, 22); + SetPosition(16, 48, 120, 22); Text := ''; FontDesc := '#Edit1'; end; @@ -77,7 +95,7 @@ begin with btnName1 do begin Name := 'btnName1'; - SetPosition(204, 48, 19, 22); + SetPosition(136, 48, 19, 22); Text := ''; FontDesc := '#Label1'; ImageName := 'sys.sb.down'; @@ -88,7 +106,7 @@ begin with lblName1 do begin Name := 'lblName1'; - SetPosition(84, 32, 80, 16); + SetPosition(16, 32, 80, 16); Text := 'Enter a date:'; FontDesc := '#Label1'; end; @@ -97,16 +115,17 @@ begin with lblName2 do begin Name := 'lblName2'; - SetPosition(68, 116, 276, 16); - Text := '***** This is still Work-In-Progress *****'; + SetPosition(68, 100, 276, 16); + Text := '***** This still needs some testing *****'; FontDesc := '#Label2'; + Color := clRed; end; cbName1 := TfpgComboBox.Create(self); with cbName1 do begin Name := 'cbName1'; - SetPosition(124, 184, 120, 23); + SetPosition(132, 144, 120, 23); Items.Add('line1'); Items.Add('line2'); Items.Add('line3'); @@ -116,6 +135,73 @@ begin FontDesc := '#List'; end; + cbCalendar := TfpgCalendarCombo.Create(self); + with cbCalendar do + begin + Name := 'cbCalendar'; + SetPosition(132, 196, 120, 23); + DateFormat := 'yyyy-mm-dd'; + end; + + btnDateFormat := TfpgButton.Create(self); + with btnDateFormat do + begin + Name := 'btnDateFormat'; + SetPosition(300, 168, 75, 23); + Text := 'Set Format'; + FontDesc := '#Label1'; + ImageName := ''; + OnClick := @btnDateFormatClicked; + end; + + edtDateFormat := TfpgEdit.Create(self); + with edtDateFormat do + begin + Name := 'edtDateFormat'; + SetPosition(300, 196, 120, 21); + Text := 'yy-mm-d'; + FontDesc := '#Edit1'; + end; + + lblName3 := TfpgLabel.Create(self); + with lblName3 do + begin + Name := 'lblName3'; + SetPosition(160, 52, 336, 15); + Text := '<---- This one is fake. It only used the calendar window part'; + FontDesc := '#Label1'; + Color := clBlue; + end; + + lblName4 := TfpgLabel.Create(self); + with lblName4 do + begin + Name := 'lblName4'; + SetPosition(12, 148, 96, 15); + Text := 'Normal Combo:'; + FontDesc := '#Label1'; + end; + + lblName5 := TfpgLabel.Create(self); + with lblName5 do + begin + Name := 'lblName5'; + SetPosition(12, 200, 104, 15); + Text := 'Calendar Combo:'; + FontDesc := '#Label1'; + end; + + btnToday := TfpgButton.Create(self); + with btnToday do + begin + Name := 'btnToday'; + SetPosition(384, 168, 75, 23); + Text := 'Today'; + FontDesc := '#Label1'; + ImageName := ''; + OnClick := @btnTodayClicked; + end; + {@VFD_BODY_END: MainForm} end; |