Solved

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
1
414 Views
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?
0
Comment
Question by:pr2501
1 Comment
 
LVL 14

Accepted Solution

by:
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;

begin

	if (Button <> mbRight) or (not (Sender is TBitBtn))  then

		exit;
 

	if not (Sender is TBitBtn) then

		exit;

	btn := (Sender As TBitBtn);

	if Btn.Font.Color = clRed then

		Btn.Font.Color := clBlack

	else

		Btn.Font.Color := clRed;
 

end;
 

procedure TForm1.ButtonClick(Sender: TObject);

var Btn : TBitBtn;

begin

	if not (Sender is TBitBtn) then

		exit;

	btn := (Sender As TBitBtn);

	if Btn.Font.Color = clRed then

		begin

		DoOpenMemoDialog(Btn);

		Btn.Font.Color := clBlack;

		end;

end;
 

procedure TForm1.DoOpenMemoDialog(Sender: TObject);

begin

	ShowMessage( TButton(Sender).Caption + ' button was pressed');

end;

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 287
Delphi Form ownership 4 73
Working with hours 3 46
How do I add a client SSL certificate to a SOAP client in Rad Studio Delphi? 2 43
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now