LCL: improved layout of calendar popup, added hack until gtk intf supports non modal forms on modal forms from Aleksey

git-svn-id: trunk@10254 -
This commit is contained in:
mattias 2006-11-28 18:58:27 +00:00
parent cc16db91ec
commit d047ad08ec
3 changed files with 40 additions and 16 deletions

View File

@ -1,26 +1,25 @@
object CalendarPopupForm: TCalendarPopupForm
Left = 635
Height = 153
Top = 259
Width = 155
HorzScrollBar.Page = 154
VertScrollBar.Page = 152
ActiveControl = Calendar
AutoSize = True
BorderIcons = [biMinimize, biMaximize]
BorderStyle = bsNone
Caption = 'CalendarPopupForm'
OnClose = FormClose
OnCreate = FormCreate
OnDeactivate = FormDeactivate
PixelsPerInch = 112
HorzScrollBar.Page = 161
VertScrollBar.Page = 152
Left = 635
Height = 153
Top = 259
Width = 162
object Calendar: TCalendar
Date = '16-4-06'
Height = 153
Width = 155
DateTime = 38823
DisplaySettings = [dsShowHeadings, dsShowDayNames]
OnDblClick = CalendarDblClick
OnKeyDown = CalendarKeyDown
Tabstop = True
Height = 153
Width = 162
end
end

View File

@ -2,12 +2,13 @@
LazarusResources.Add('TCalendarPopupForm','FORMDATA',[
'TPF0'#18'TCalendarPopupForm'#17'CalendarPopupForm'#4'Left'#3'{'#2#6'Height'#3
+#153#0#3'Top'#3#3#1#5'Width'#3#162#0#18'HorzScrollBar.Page'#3#161#0#18'VertS'
+#153#0#3'Top'#3#3#1#5'Width'#3#155#0#18'HorzScrollBar.Page'#3#154#0#18'VertS'
+'crollBar.Page'#3#152#0#13'ActiveControl'#7#8'Calendar'#8'AutoSize'#9#11'Bor'
+'derIcons'#11#10'biMinimize'#10'biMaximize'#0#11'BorderStyle'#7#6'bsNone'#7
+'Caption'#6#17'CalendarPopupForm'#7'OnClose'#7#9'FormClose'#12'OnDeactivate'
+#7#14'FormDeactivate'#0#9'TCalendar'#8'Calendar'#6'Height'#3#153#0#5'Width'#3
+#162#0#8'DateTime'#5#0#0#0#0#0#0#167#151#14'@'#15'DisplaySettings'#11#14'dsS'
+'howHeadings'#14'dsShowDayNames'#0#10'OnDblClick'#7#16'CalendarDblClick'#9'O'
+'nKeyDown'#7#15'CalendarKeyDown'#7'Tabstop'#9#0#0#0
+'Caption'#6#17'CalendarPopupForm'#7'OnClose'#7#9'FormClose'#8'OnCreate'#7#10
+'FormCreate'#12'OnDeactivate'#7#14'FormDeactivate'#0#9'TCalendar'#8'Calendar'
+#6'Height'#3#153#0#5'Width'#3#155#0#8'DateTime'#5#0#0#0#0#0#0#167#151#14'@'
+#15'DisplaySettings'#11#14'dsShowHeadings'#14'dsShowDayNames'#0#10'OnDblClic'
+'k'#7#16'CalendarDblClick'#9'OnKeyDown'#7#15'CalendarKeyDown'#7'Tabstop'#9#0
+#0#0
]);

View File

@ -39,6 +39,7 @@ type
procedure CalendarKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
private
{ private declarations }
@ -46,6 +47,8 @@ type
FOnReturnDate: TReturnDateEvent;
procedure Initialize(const PopupOrigin: TPoint; ADate: TDateTime);
procedure ReturnDate;
protected
procedure Paint;override;
public
{ public declarations }
end;
@ -65,7 +68,11 @@ begin
PopupForm.FOnReturnDate := OnReturnDate;
//TODO: Change to PopupForm.Show when gtk supports non modal forms on top of
//modal forms.
{$IFDEF MSWindows}
PopupForm.Show;
{$ELSE}
PopupForm.ShowModal;
{$ENDIF}
end;
{ TCalendarPopupForm }
@ -77,6 +84,15 @@ begin
CloseAction := caFree;
end;
procedure TCalendarPopupForm.FormCreate(Sender: TObject);
begin
AutoSize:=false;
Calendar.Top:=1;
Calendar.Left:=1;
Width:=Calendar.Width + 2;
Height:=Calendar.Height + 2;
end;
procedure TCalendarPopupForm.CalendarDblClick(Sender: TObject);
begin
ReturnDate;
@ -122,6 +138,14 @@ begin
Close;
end;
procedure TCalendarPopupForm.Paint;
begin
inherited Paint;
Canvas.Pen.Color:=clWindowText;
Canvas.Pen.Style := psSolid;
Canvas.Rectangle(0, 0, Width-1, Height-1)
end;
initialization
{$I calendarpopup.lrs}