1

問題は、フィールドのクリックを処理し、メイン プログラムからプロシージャを呼び出す方法です。

4

2 に答える 2

2

はい、そうです。フィールドの意味と使用している FastReport のバージョンはわかりませんが、レポート オブジェクトとの相互作用の原則をお見せしようと思います (これは、プレビュー内の任意のレポート オブジェクトに対して実行できます)。窓)。ただし、TfrxReport.OnClickObjectイベントは FastReport のバージョンによって異なるため、使用しているバージョンによっては少し異なる場合があります。

次の例 (バージョン 4.12 で記述) は、設計時にレポートに配置されるMemo1ものと対話します。あとは、メイン フォームにイベント ハンドラのコードを記述する必要があります。Text object (TfrxMemoView)frxReport1OnClickObject

procedure TForm1.frxReport1ClickObject(Sender: TfrxView;
  Button: TMouseButton; Shift: TShiftState; var Modified: Boolean);
begin
  // comparing names is not so efficient, so for many controls I would use
  // rather Sender.Tag and set the Tag property at report design time and
  // use case Sender.Tag of construction

  if Sender.Name = 'Memo1' then // is the Sender my Memo1 text object ?
  begin
    if fsBold in (Sender as TfrxMemoView).Font.Style then // is Memo1 font bold ?
    begin
      (Sender as TfrxMemoView).Font.Style := []; // then set it to default
      ShowMessage('You just set memo text font to default'); // display message
    end
    else
    begin
      (Sender as TfrxMemoView).Font.Style := [fsBold]; // else set it to bold
      ShowMessage('You just emphased your memo text font'); // display message
    end;

    Modified := True; // setting Modified to True causes the report to refresh
  end;
end;
于 2011-09-27T20:53:25.390 に答える
0

別のテキストを入力する必要がある場合は、1 つのオプションを試してください。

(Sender as TfrxMemoView).Text := 'Hi friend';

また:

TfrxMemoView(Sender).Text := 'Hi friend';
于 2013-06-18T14:45:39.720 に答える