0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c++ builder > Testing > コンポーネントを増やさずにデバッグ情報を追加 > ShowHint = true; / Hint = FloatToStr(debug_getValue());

Last updated at Posted at 2015-12-21
動作確認
C++ Builder XE4

希望

  • デバッグモードでデバッグ情報を表示したい
  • デバッグ情報表示用のコンポーネントは別途配置したくない

思いついたのは、Hintプロパティを使うこと

Unit1.cpp
...
// 設定(1回だけ実行)
if (m_debugMode) {
  E_xxx->ShowHint = true;
  E_xxx->Color = clMoneyGreen;
}
...
// 随時変化する部分の実装
if (m_debugMode) {
  E_xxx->Hint = L"someValue:" + FloatToStr(debug_getValue());
}
  • debug_getValue() : 自作の関数。デバッグ用値を取得
  • FloatToStr() : Float型をString型に変換するビルトイン関数

上記のように実装すると、プロダクトコードで見せておくコンポーネントをデバッグ情報表示に使える。

clMoneyGreenの色に変更しているのは、デバッグ情報を表示できるコンポーネントがわかるように。

Hintプロパティを普段使わない場合に有効。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?