Custom and IDE design popup menu conflict lazarus / 31-LCL ---------------------------------------------------------------------- B4Z1l3 · 2013-01-27 18:10 Hello, in a TWinControl descendant, registered and setup on the palette, I have overriden Code: [Select]procedure CMDesignHitTest(var Message: TCMDesignHitTest); message ...; In this procedure a custom popup menu is triggered at design time: Code: [Select]procedure TMyStuffDerivatedFromWinCtrl.CMDesignHitTest(var Message: TCMDesignHitTest); var   LItem: TMenuItem; begin   inherited;   if not (csDesigning in ComponentState) then Exit;   if Message.Keys = MK_RBUTTON then     begin       Message.Result := 0;       if FDesignPopup = nil then         begin           FDesignPopup := TPopupMenu.Create(Self);           LItem := TMenuItem.Create(FDesignPopup);           Litem.Caption := 'Design popup';           FDesignPopup.Items.Add(LItem);           LItem.OnClick := DesignMenuItemClick;         end;        FDesignPopup.PopUp(Mouse.CursorPos.x,Mouse.CursorPos.y);     end; end; The problem is that if I click the menuitem, the default event usually linked to the IDE designer context popup is called (so something like 'Create a new default event'). So in my example, 'DesignMenuItemClick' method is never called... How can I get rid of the default IDE stuff ? ---------------------------------------------------------------------- otorres · 2013-01-27 18:26 You need give a name to FDesignPopup, try before create. ---------------------------------------------------------------------- B4Z1l3 · 2013-01-27 19:46 Thx, but to set the name of the field doesn't solve the problem, btw as it's not a local variable, not need to try bofore create. Actually, if I name the item, the error is not triggered anymore BUT the default IDE action is called (for instance, a procedure MyItemNameClick(...) is automatically added to the source code. ---------------------------------------------------------------------- B4Z1l3 · 2013-01-27 20:01 FDesignPopup := TPopupMenu.Create(Self); FDesignPopup := TPopupMenu.Create(Nil); If FDesignPopup is not owned, the IDE won't hook the custom designpopup.