At the moment, the user has to left-click on a cell to select it, and then right-click to get the context menu. If they just right-click on the cell, then the menu refers to the LAST cell they left clicked on, not the one pointed to by the cursor at the time of the right-click. May 29, 2013 How to change color of dbgrid rows that have the same value on a field in delphi? For example all rows that have the same teacher note: those rows are grouped, and come after each other in.
I've got a TString grid in a form, and I want to be able to right-clickon any cell in the grid, and for a right click menu to come up with optionsfor that grid.I can get the right-click menu to come up, (using the Popup Menu property ofthe grid). However, I can't get it to recognise the cell that I'veright-clicked on. At the moment, the user has to left-click on a cell toselect it, and then right-click to get the context menu. If they justright-click on the cell, then the menu refers to the LAST cell they leftclicked on, not the one pointed to by the cursor at the time of theright-click.I've managed to identify which cell has been clicked on, usingFileDataView.MouseToCell(X, Y, Column, Row);FileDataView.CellsColumn, Row:= 'Col ' + IntToStr(Column) + ',Row ' +IntToStr(Row);(FileDataView is my TString grid)but I can't get this information to be available to the contect menu.So, how can you get a right-click context menu on a TStringGrid that ALSOknows which cell you've just right-clicked on?-Kieron G. SmithhelpIT Systems [email protected].
I've got a TString grid in a form, and I want to be able to right-click on any cell in the grid, and for a right click menu to come up withoptions for that grid. I can get the right-click menu to come up, (using the Popup Menu propertyof the grid). However, I can't get it to recognise the cell that I've right-clicked on. At the moment, the user has to left-click on a cell to select it, and then right-click to get the context menu.
![]()
Probably in the object inspector:in your form designer, select the grid. Go to object inspector, look at the options or options2 section.Expand if necessary; the option should be there. You can simply switch it to false from there.This shouldn't influence any other options.You can also do this in runtime if you prefer (probably something like howeverthegridisnamed.goRowHighLight:=false - note, air code untested, may harm your dog, etc).So if you want to reset the stringgrid to default you can do the reverse in code. Dog seriously injured!I need to set it on the fly because the row select works perfectly for what it does, and I need to set it back once I have the column selected.I'm pretty sure that sets need to have their parameters allocated in a specific way rather than just assigning a value to them, but I can't remember how it's done.Needless to say StringGrid1.goRowHighLight:=false, or StringGrid1.goRangeSelect=False, or even StringGrid1.Options.goRangeSelect=False generates an 'illegal Qualifier' error in Messages.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |