We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with GDBG and PopupMenu

Thread ID:





38665 Dec 15,2005 09:00 PM UTC Dec 16,2005 04:22 PM UTC WinForms 4
Tags: Tools
Najmeh Joze-khajavi
Asked On December 15, 2005 09:00 PM UTC

I have a GridDataBoundGrid and I have set a syncfusion PopupMenu to it as follow: this._PopupMenusManager.SetXPContextMenu(this.gridTimer, this._LogicInputPopupMenu); But I actually want the popup menu shows up only when I right click on last column of my grid. So I added BeforePopup event to check the column index and cancel the popup menu for any other columns except the last column. I also set the following: this.gridTimer.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left | MouseButtons.Right; Here are the two events: private void gridTimer_MouseDown(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { Point clickPoint = this.gridTimer.PointToClient(Cursor.Position); this._LogicInputPopupMenu.Show (this.gridTimer, clickPoint); } } private void LogicInputPopupMenu_BeforePopup(object sender, Syncfusion.Windows.Forms.CancelMouseEventArgs e) { if (this.gridTimer.CurrentCell.ColIndex != 11) { e.Cancel = true; // cancel the Popup menu anywhere beside the StopEvent column } } The problem is when I right click on last column it shows up the PopupMenu but when I right click on another column it still shows up the menu but after that it works fine. It seems the second right click doesn''t move the cursor to other column but finally the third right click moves the focus to the third column. Any idea why it works like this.

Mano J [Syncfusion]
Replied On December 16, 2005 10:27 AM UTC

Hi, Please try commenting out the code in the mousedown event. Since you have associated the popupmenu to GDBG and allowed it to show only on the last column using before_popup, there is no need to make the popupmenu to show when mouse down occurs in the GDBG. I have attached a sample that demonstrates this completely. Please refer to it and let me know if this meets your requirements. Thanks for using Syncfusion products. Regards, Mano GDBG_Popupmenu.zip

Najmeh Joze-khajavi
Replied On December 16, 2005 02:11 PM UTC

Thanks for relay. I need to have that code in MouseDown event or something else equivalent to that. I see your sample is working but there is a difference with your sample and my application. My last column is combobox cell type (combobox in GDBG cell). If I don''t have the code in MouseDown event when I right click I see very quickly the Popup menu but it doesn''t stay and it opens the combobox list. In your sample you have textbox cell type and right click brings the Popupmenu. Any other idea?

stanleyj [Syncfusion]
Replied On December 16, 2005 03:33 PM UTC

Hi Najmeh, Try moving the current cell focus in the MouseDown handler to the location of the mouse cursor. int row,col; private void gridTimer_MouseDown(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { Point clickPoint = this.gridTimer.PointToClient(Cursor.Position); this.gridTimer.PointToRowCol(clickPoint, out row, out col); this.gridTimer.CurrentCell.MoveTo(row, col); this._LogicInputPopupMenu.Show (this.gridTimer, clickPoint); } } Let me know if this helps. Best regards, Stanley

Najmeh Joze-khajavi
Replied On December 16, 2005 04:22 PM UTC

Thanks it works. The key line was this.gridTimer.CurrentCell.MoveTo(rowIndex, colIndex); I have already used CurrentCell.Activate as follow: this.gridTimer.CurrentCell.Activate(rowIndex, colIndex); But that didn''t do the job, "MoveTo" did the job correctly. Thanks.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon