Right mous click to open new dialog box/ or a new window with Memo in which can write and read

Posted on 2007-11-24
Last Modified: 2013-11-23
From a speedButon with OnMouse dow event i can open a folder open a File folder.

1.Next thing that i wont to do is to can control the color of a Font (nome of the button) with right mouse click: on first click to make it red and on next to make it black.
 And once the button is red i need to have a option to open a dialog box or a new window with Memo object in which i can write short text. And read it and edit it next time i click on this buton again.

2.I well use 100  of this buttons, so what steps should i take?
Question by:pr2501
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 14

Accepted Solution

SteveBay earned 125 total points
ID: 20345594
You cannot change the font color of a TButton (Windows owns that property and will not give it up no mater what Delphi says). You can, however, change the color of a TBitBtn.

Use the following code with TBitBtn and you should get the start you need on this.
procedure TForm1.BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);
var Btn : TBitBtn;
	if (Button <> mbRight) or (not (Sender is TBitBtn))  then
	if not (Sender is TBitBtn) then
	btn := (Sender As TBitBtn);
	if Btn.Font.Color = clRed then
		Btn.Font.Color := clBlack
		Btn.Font.Color := clRed;
procedure TForm1.ButtonClick(Sender: TObject);
var Btn : TBitBtn;
	if not (Sender is TBitBtn) then
	btn := (Sender As TBitBtn);
	if Btn.Font.Color = clRed then
		Btn.Font.Color := clBlack;
procedure TForm1.DoOpenMemoDialog(Sender: TObject);
	ShowMessage( TButton(Sender).Caption + ' button was pressed');

Open in new window


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi IDE crash without error message ... 7 138
creating threads in delphi 1 200
Firemonkey webbrowser scrollbars ? 1 69
Can Live bindings change TGrid Cell Colour ? 1 61
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question