TADVStringgrid with TPopupmenu on cell edit?

One one screen, I have A TButton with A drop down popupmenu assigned to it.
I override events in it to bold disable items, and some other stuff. Works well.

image

They want this feature in A grid edit where rows, that they can edit on a certain column to get a similar/same look and feel.

Looking at PDF for TADVStringgrid all I could find was this, which didn't seem to do much of anything.

Looking to see if good way of dealing with this.

Retested this here with a TAdvPopupMenu on the form and:

procedure TForm1.AdvStringGrid1GetEditorProp(Sender: TObject; ACol,
  ARow: Integer; AEditLink: TEditLink);
begin
  AdvStringGrid1.NormalEdit.PopupMenu := AdvPopupMenu1;
end;

and this works as expected.

image

I need it to auto show when you click in the cell. Like a button. click it and that popup shows right there on that cell.

It is kind of a hack really I am trying to do probably. As the Combobox/dropdown view doesn't do what we want. Have bolded items. Items that are disabled but shown. Italic items, blah. TButton allows this and what I am using else where on another screen and it works well.. But making it play well in the grid, a bit different.

I got around this I think. Create TButtons and assign control for each cell. A bit of a resource hog but works.

Actually not sure this does work...

Grid.CellControls[COL_Kind, rowX] := btnKind;

works sorta, but if you move/hide/show columns via loading a string state maybe via StringToColumnStates... the buttons are not showing in proper place.

Rearrange grid and buttons there are basically in same place and never move.

for now, giving up and told management just what they want not doable without headaches and just move back to regular combo box drop down edComboList and remove the non selectable items... and move on. Way to much time wasted with odd issues trying to get around this.

You can also show your custom popup menu from the grid.OnContextPopup event.
With grid.MouseToCell(), you can convert the MousePos coordinate passed in this event to know the cell over which the mouse is and customize the displayed context menu this way.