网友<安全生产监管>发现lazarus 编译为Linux gtk2的应用使用TDateTimePIcker日历在tkDate模式,日历下拉菜单不响应鼠标点击,这个问题在windows和linux qt下没问题。
环境:
1、Lazarus 2.2.4
2、FPC 3.2.2
3、Linux deepin 内核版本:5.15.77
如果你也遇到这个问题,可以按他给出的解决方案处理:
打开lazarus\components\datetimectrls\datetimepicker.pas,将880行注释,第881行PopupMode := pmExplicit;改为PopupMode := pmNone;
constructor TDTCalendarForm.CreateNewDTCalendarForm(AOwner: TComponent; ADTPicker: TCustomDateTimePicker); var P: TPoint; CalClass: TCalendarControlWrapperClass; begin inherited CreateNew(AOwner); ADTPicker.FAllowDroppingCalendar := False; FClosing := False; DTPicker := ADTPicker; BiDiMode := DTPicker.BiDiMode; DTPickersParentForm := GetParentForm(DTPicker); if Assigned(DTPickersParentForm) then begin DTPickersParentForm.AddHandlerOnVisibleChanged(@VisibleOfParentChanged); DTPickersParentForm.FreeNotification(Self); PopupParent := DTPickersParentForm; PopupMode := pmExplicit; end else PopupMode := pmAuto;
按以下修改就可以:
if Assigned(DTPickersParentForm) then begin DTPickersParentForm.AddHandlerOnVisibleChanged(@VisibleOfParentChanged); DTPickersParentForm.FreeNotification(Self); {PopupParent := DTPickersParentForm; //<- this one PopupMode := pmExplicit;} PopupMode := pmNone; //<- with this one end else PopupMode := pmAuto;
标签:日历,lazarus,Linux,DTPickersParentForm,PopupMode,下拉菜单 From: https://www.cnblogs.com/qiufeng2014/p/17067174.html