Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit Label on DblClick #49

Closed
Bugzero71 opened this issue Jan 4, 2017 · 2 comments
Closed

Edit Label on DblClick #49

Bugzero71 opened this issue Jan 4, 2017 · 2 comments

Comments

@Bugzero71
Copy link

Hi Martin, It is really tedious for me to implement in each NM_DBLCLICK notification message:

{
  NMHDR* hdr = (NMHDR*)lParam;
  if (wParam >= IDC_WATCH_GRID)
  {
    switch (hdr->code)
    {
    case NM_DBLCLK:
      {
        MC_GRECT rect;
        MC_GSELECTION selection;

        selection.rcData = ▭
        selection.uDataCount = 1;

        if (::SendMessage(hdr->hwndFrom, MC_GM_GETSELECTION, 0, (LPARAM)&selection) != 0)
        {
           ::PostMessage(hdr->hwndFrom, MC_GM_EDITLABEL, MAKEWPARAM(rect.wColumnFrom, rect.wRowFrom), 0);
        }

        *pResult = 0;
	return TRUE;
}

So I propose you to modify grid.c line 2880

  mc_send_notify(grid->notify_win, grid->win, NM_DBLCLK);

with these lines:

  if (mc_send_notify(grid->notify_win, grid->win, NM_DBLCLK)) {
    /* Application suppresses the default processing of the message */
    return;
  }

  /* Edit cell if MC_GS_EDITLABELS is set */
  if (grid->style & MC_GS_EDITLABELS) {
    MC_GHITTESTINFO info;

    info.pt.x = x;
    info.pt.y = y;
    grid_hit_test(grid, &info);

    grid_start_label_edit(grid, info.wColumn, info.wRow);
}

I've checked them in my project and in example_grid but possibly I'm missing something.

@mity
Copy link
Owner

mity commented Jan 4, 2017

I remember the logic was implemented to follow listview in this regard (and it was inspired by Wine's listview implementation). But it's true that for grid your proposition may make sense, as it's likely much less likely that application wants to hook a different action on a double-click.

I'll think about it.

@mity mity changed the title [Improvement] Edit Label on DblClick Edit Label on DblClick Jan 4, 2017
mity added a commit that referenced this issue Jan 22, 2017
@mity
Copy link
Owner

mity commented Jan 22, 2017

Done.

@mity mity closed this as completed Jan 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants