lazarus三方控件注意事项

lazarus三方控件注意事项

1)EHLIB

TprintDbgrideh不能用,跟它源码,for fpc没有任何打印的代码。

其它问题。。不知。

可以明确:EHLIB for fpc不是全功能的,使用时要注意鉴别。

2)FAST REPORT

使用汉化,预览等界面会乱码,只能使用英文的。

其它问题。。不知

3)dataset-serialize

客户端内存表,lazarus使用TBufDataSet,TjsonDataSet;delphi使用TclientDataSet, TfdMemTable。

DataSet.Serialize.Import.pas修改

增加引用单元:

uses
{$IF DEFINED(FPC)}
  DB, fpjson, Generics.Collections,
  BufDataSet, fpjsondataset, //add by cxg
{$ELSE}
  System.JSON, Data.DB, System.StrUtils, System.SysUtils, System.Rtti,
  {$IF CompilerVersion >= 20}
    System.Character,
  {$ENDIF}
  DBClient,   //add by cxg
{$ENDIF}
  DataSet.Serialize.Language, DataSet.Serialize.Utils;

修改TJSONSerialize.JSONObjectToDataSet()函数:

procedure TJSONSerialize.JSONObjectToDataSet(const AJSONObject: TJSONObject; const ADataSet: TDataSet; const ADetail: Boolean);
var
  LField: TField;
  LJSONValue: {$IF DEFINED(FPC)}TJSONData{$ELSE}TJSONValue{$ENDIF};
  {$IF DEFINED(FPC)}
  I: Integer;
  LBookMark: TBookmark;
  {$ELSE}
  LMasterSource: TDataSource;
  LBooleanValue: Boolean;
  {$ENDIF}
  LNestedDataSet: TDataSet;
  LDataSetDetails: TList<TDataSet>;
  LObjectState: string;
  LFormatSettings: TFormatSettings;
  LKeyValues: TKeyValues;
  LTryStrToDateTime: TDateTime;
  LTryStrToCurr: Currency;
  LTryStrToFloat: Double;
  LHex: Integer;
  LByteValue: Byte;
  LBytes: TBytes;
begin
  if (not Assigned(AJSONObject)) or (not Assigned(ADataSet)) or (AJSONObject.Count = 0) then
    Exit;

  if not(ADataSet.Active) then
  begin
//    {$IF NOT DEFINED(FPC)}                  //rem by cxg
//    if not(ADataSet is TFDMemTable)  then
//      Exit;
//    {$ENDIF}
    if ((ADataSet.FieldDefs.Count = 0) and (ADataSet.FieldCount = 0)) then
      LoadFieldsFromJSON(ADataSet, AJSONObject);
    {$ifdef fpc}
    if ADataSet is TBufDataSet then         //modified by cxg
      TBufDataSet(ADataSet).CreateDataset
    else if ADataSet is TJsonDataSet then
      TJsonDataSet(ADataSet).Open;
    {$else}                              //delphi
    if ADataSet is TfdmemTable then
      TfdmemTable(ADataSet).CreateDataset
    else if ADataSet is TclientDataSet then
      TclientDataSet(ADataSet).CreateDataSet;
    {$endif}
   // ADataSet.Open;  //rem by cxg
  end;

解决日期型字段查询报错:

initialization
  TDataSetSerializeConfig.GetInstance.DateTimeIsISO8601 := false;  

4)自定义无边框窗体

FPC for windows,没有任何问题。

FPC for linux,最小化,最大化,还原,无效。

5)FPC FOR WINDOWS编译测试OK的代码,FPC FOR LINUX不一定能通过

举例:

page.SelectedTab.Tag := integer(form);

form := TForm(page.SelectedTab.Tag);

posted @ 2024-10-19 08:48  delphi中间件  阅读(53)  评论(0编辑  收藏  举报