Skip to content

Fixes for FV TInputLine's GetData, SetData and DataSize functions

kagamma requested to merge kagamma/source:fv-fixes into main

Fixes for Unicode version of TInputLine, where GetData and SetData procedures failed to do their job.

A quick test for the fixes:

uses
  {$ifdef UNIX}cwstring,{$endif}
  SysUtils, UApp, UMsgBox, UDialogs, Objects, Drivers, FVConsts;

type
  TTestRec = record
    Text1,
    Text2: UnicodeString;
  end;

var
  MyApp: TApplication;

procedure TestDialog;
var
  D: PDialog;
  R: TRect;
  T: TTestRec;
begin
  T.Text1 := 'Text 1';
  T.Text2 := 'ABC';

  R.Assign(3, 3, 40, 13);
  New(D, Init(R, 'Test'));

  R.Assign(3, 2, 30, 3);
  D^.Insert(New(PInputLine, Init(R, 20)));

  R.Assign(3, 4, 30, 5);
  D^.Insert(New(PInputLine, Init(R, 20)));

  R.Assign(3, 7, 19, 9);
  D^.Insert(New(PButton, Init(R, 'O~k~', cmOk, bfDefault)));

  D^.SetData(T);
  Desktop^.ExecView(D);
  D^.GetData(T);

  MessageBox(Format('%s'#13'%s', [T.Text1, T.Text2]), nil, mfInformation + mfOKButton);

  Dispose(D, Done);
end;

begin
  MyApp.Init;
  TestDialog;
  MyApp.Run;
  MyApp.Done;
end.
Edited by kagamma

Merge request reports

Loading