Commit f8f366cc authored by Olivier Teulière's avatar Olivier Teulière

* Fixed the "RichEdit line insertion error" bug (closes #246)

 * Added a popup menu to copy log messages to the clipboard
parent c5968aaa
......@@ -102,7 +102,12 @@ void __fastcall TMessagesDlg::UpdateLog()
/* Add message */
if( i_max_lines )
{
RichEditMessages->Lines->Add( p_sub->p_msg[i_start].psz_msg );
/* We don't use RichEditMessages->Lines->Add(), because with
* some versions of rich32.dll it can trigger the
* "RichEdit line insertion error" bug... */
RichEditMessages->SelStart = RichEditMessages->GetTextLen();
RichEditMessages->SelText = p_sub->p_msg[i_start].psz_msg;
RichEditMessages->SelText = RichEditMessages->SelText + "\r\n";
}
}
......@@ -112,3 +117,18 @@ void __fastcall TMessagesDlg::UpdateLog()
}
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::PopupCopyTextClick( TObject *Sender )
{
/* If nothinf is selected, select everything */
if( RichEditMessages->SelLength == 0 )
{
RichEditMessages->SelStart = 0;
RichEditMessages->SelLength = RichEditMessages->GetTextLen();
}
/* Copy selected text to clipboard */
RichEditMessages->CopyToClipboard();
}
//---------------------------------------------------------------------------
......@@ -29,6 +29,7 @@ object MessagesDlg: TMessagesDlg
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
PopupMenu = PopupMenu1
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
......@@ -47,4 +48,13 @@ object MessagesDlg: TMessagesDlg
TabOrder = 1
OnClick = ButtonOKClick
end
object PopupMenu1: TPopupMenu
Left = 304
Top = 432
object PopupCopyText: TMenuItem
Caption = '&Copy text'
ShortCut = 16451
OnClick = PopupCopyTextClick
end
end
end
......@@ -35,9 +35,12 @@ class TMessagesDlg : public TForm
__published: // IDE-managed Components
TRichEdit *RichEditMessages;
TButton *ButtonOK;
TPopupMenu *PopupMenu1;
TMenuItem *PopupCopyText;
void __fastcall ButtonOKClick( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall FormShow( TObject *Sender );
void __fastcall PopupCopyTextClick( TObject *Sender );
private: // User declarations
intf_thread_t *p_intf;
public: // User declarations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment