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
417 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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