TFormControlEditLink and advance to next editable cell?

Using D11.1 and latest VCL UI pack.

TADVStringgrid with TFormControlEditLink

The TFormControlEditLink points to variant of a TComboBox of ours. Has some hacks done that we use on forms else where for years.

Anyways, want to imbed that into the grid which kinda worked.

Problem we have is advancing to the next editable cell and how/when to do that.

Navigation.AdvanceAutoEdit = true
AdvanceOnEnter = true
AdvanceOnEnterLoop = true
AdvanceSkipReadOnlyCells = true

When user gets done using our flavored TComboBox hack, and presses enter to move on, what is the best route for getting to the next editable cell?

TADVStringgrid itself has a private called AdvanceEdit which seems to get called I think to do this?

But this can't be called.

TFormControlEditLink doesn't seem to have anything to call directly to force it to be done, grid to be happy, and invoke moving on.

I can only find some limited TFormControlEditLink example code and doc has pretty little about it all.

I swapped to just using a TComboBox with some dummy data and nothing else, but i still seem to get stuck on what proper procedure here is.

I can only assume there must be something special to your combobox.
I retested this here with a regular TComboBox and the code to initialize:

begin
  FormControlEditLink1.Control := ComboBox1;
  advstringgrid1.DefaultEditor := edCustom;
  advstringgrid1.EditLink := FormControlEditLink1;
  advstringgrid1.Options := advstringgrid1.Options + [goEditing];
  advstringgrid1.Navigation.AdvanceAutoEdit := true;
  advstringgrid1.Navigation.AdvanceOnEnter := true;
  advstringgrid1.Navigation.AdvanceOnEnterLoop := true;
  advstringgrid1.Navigation.AdvanceSkipReadOnlyCells := true;
end;

and when pressing return while the combobox is used as edit control, it moves to the next edit cell. For the auto advance to work when pressing enter, nothing should be configured at FormControlEditLink level and no extra code should be necessary.

Thanks! It was our control it looks as it had keyup/down/press events of its own.

Was able to keep our variant and work around it and now it seems to be working well.

I do have another question.

It is setup to be inPlace editor style. Is there a way to make it so our combobox can be wider? ala bigger than the cell? There is an option for that for using the edComboList editor but like to invoke something similar for ours.

Also issue of grid showing its own combo box down arrow.

Click that arrow and now my combo box object shows.

Which shows its down arrow, which the user can click to get the drop down to show.

We don't want it to always drop down, but would like to arrow to always show like it does.

So not sure if the down arrow button the grid generates, can trigger an event if clicked on?

In FormControlEditLink.OnSetEditorProperties, you could manipulate the control width. Default it has the width of the cell.

I'm not sure what exactly you want. The combobox dropdown button performs the dropdown/dropup action. There is at this moment not a built-in possibility to interfere with this.
If you do not want this always visible dropdown button, set grid.ControlLook.DropDownAlwaysVisible = false.

procedure TForm509.PartEditLinkSetEditorProperties(Sender: TObject; Grid: TAdvStringGrid; AControl: TWinControl);
begin
AControl.width := 200; // <-- bad
end;

If i do this, i get an Access Violation error.

f17f63bc24821dba8e9c0aff3a9daad15

I do the same thing, in the SetEditorFocus event, it works and no error.

procedure TForm509.PartEditLinkSetEditorFocus(Sender: TObject; Grid: TAdvStringGrid; AControl: TWinControl);
begin
AControl.width := 200; // <-- good
end;

We use the DropDownAlwaysVisible TRUE in our program as we have edComboList for simple things and want the drop down to always show.

The TFormControlEditLink , I have DropDown TRUE so to the end user, they always see A dropdown arrow. This is to let them know yes, you can click here and its a drop down.

But because TFormControlEditLink in this case, points to a flavor of TComboBox , when it gets focus, you now see the TComboBox drop down arrow, and the drop down doesn't happen on the first click because the grid itself knows no better that the control assigned to TFormControlEditLink is a TComboBox.

So it would be nice maybe if can figure out a mechanism of using the drop down arrow the grid generates, to set focus to cell, TFormControlEditLink shows the TComboBox we have, drops the drop down, and sets focus. This would be if and only if user clicked the Grid generated drop down arrow.

Maybe you could set your custom inplace editor already automatically in dropped down state from the event OnSetEditorProperties that is triggered when the inplace editor got focus?