Solved

PopupMenus and StringGrids

Posted on 1998-01-16
1
249 Views
Last Modified: 2010-04-04
Hello, I would like to be able to Right  Mouse click a specific cell in a StringGrid and have a PopupMenu show - What should I do?
0
Comment
Question by:engtech
1 Comment
 
LVL 4

Accepted Solution

by:
itamar earned 50 total points
ID: 1356918
I think this code is OK for you:

procedure TForm1.StringGrid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var Acol, ARow : LongInt;
begin
     If Button = mbRight Then begin
        StringGrid1.MouseToCell(X, Y, ACol, ARow);
        If (ACol = 2) And (ARow = 3) Then
           Popupmenu1.AutoPopup := True
        Else
           Popupmenu1.AutoPopup := False;
     end;
end;

This will shot popupmenu only for the cell with coordinates Col = 2 and Row = 3.

IHTH

P.S.: Any doubts, place a comment before grading the answer.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 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