| 60 | #define MaxFontSize 16 |
| 61 | |
| 62 | void __fastcall ShowMessage2(TComponent * OwnerForm, |
| 63 | String Text, |
| 64 | String Caption, |
| 65 | bool Modal, |
| 66 | bool Error, |
| 67 | TPosition Position) |
| 68 | { |
| 69 | // ���������������� ��������� �� ������������ �������� |
| 70 | // � ����, ��� ���������� TMessageForm �� ����� ��������� � |
| 71 | // ��������� ���������� � OwnerForm == MessageForm |
| 72 | // ��� �������� � Access violation ! |
| 73 | if( OwnerForm && OwnerForm == MessageForm ) |
| 74 | OwnerForm = NULL; |
| 75 | |
| 76 | // ����� ���� ��������� ������ ������ �� 2 ��������: |
| 77 | // - ����� ��������� ��������� OwnerForm |
| 78 | // - ����� ������� ���������� ����� |
| 79 | if( MessageForm ) |
| 80 | delete MessageForm; |
| 81 | |
| 82 | MessageForm = new TMessageForm(OwnerForm); |
| 83 | |
| 84 | MessageForm->Position = Position; |
| 85 | MessageForm->Memo->Lines->Text = Text; |
| 86 | MessageForm->Caption = Caption; |
| 87 | if( Error ) |
| 88 | { |
| 89 | MessageForm->OkButton->Visible = false; |
| 90 | MessageForm->CloseButton->Visible = true; |
| 91 | MessageForm->Image->Visible = true; |
| 92 | MessageForm->Memo->Left = 64; |
| 93 | MessageForm->Memo->Width = MessageForm->GroupBox->Width - 72; |
| 94 | } |
| 95 | else |
| 96 | { |
| 97 | MessageForm->OkButton->Visible = true; |
| 98 | MessageForm->CloseButton->Visible = false; |
| 99 | MessageForm->Image->Visible = false; |
| 100 | MessageForm->Memo->Left = 8; |
| 101 | MessageForm->Memo->Width = MessageForm->GroupBox->Width - 16; |
| 102 | } |
| 103 | |
| 104 | // ����� ������� - �������� ����� |
| 105 | if( MessageForm->Memo->Lines->Count < MemoMaxLinesVisible(MessageForm->Memo) ) |
| 106 | { |
| 107 | do |
| 108 | { |
| 109 | MessageForm->Memo->Font->Size = MessageForm->Memo->Font->Size + 1; |
| 110 | // ����� MaxFontSize ������� �� ����������� |
| 111 | if( MessageForm->Memo->Font->Size == MaxFontSize ) break; |
| 112 | } |
| 113 | while( MessageForm->Memo->Lines->Count < MemoMaxLinesVisible(MessageForm->Memo) ); |
| 114 | |
| 115 | // ���� ����� �������� ������� - �������� ����� |
| 116 | if( MessageForm->Memo->Lines->Count > MemoMaxLinesVisible(MessageForm->Memo) ) |
| 117 | MessageForm->Memo->Font->Size = MessageForm->Memo->Font->Size - 1; |
| 118 | } |
| 119 | // ����� �� ������� - �������� ������ ���� |
no outgoing calls
no test coverage detected