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.
Unfortunately, activation email could not send to your email. Please try again.

I cannot get events on the right pane of splitter.

Thread ID:

Created:

Updated:

Platform:

Replies:

22988 Dec 31,2004 02:38 AM Jan 6,2005 10:27 PM Windows Forms 14
loading
Tags: GridControl
David Bosak
Asked On December 31, 2004 02:38 AM

Hi, I created the following events on the GridDataBoundGrid and GridRecordNavigationControl: - Click/DoubleClick on GDBG - DoubleClick on Header of GDBG - Splitter for Columns When I move splitterbar to divide the GDBG into two parts, the above events cannot be called on the right GDBG. However, the left GDBG is OK. This is the critical bug for my application, please help me urgent! Thanks a lot,

Administrator [Syncfusion]
Replied On December 31, 2004 04:11 AM

In a dynamic splitter you need to subscribe to event in PaneCreated and unsubscribe to event in PaneClosing. Take a look at this KB. http://64.78.18.34/Support/article.aspx?id=580

David Bosak
Replied On December 31, 2004 11:44 PM

I did as your direction. However, splitter is lost. Please help!

Administrator [Syncfusion]
Replied On January 1, 2005 02:03 AM

We ship many samples using splitters. Do you see the problem you are having in any of these samples? If you can upload a sample project showing the problem you are having, we can try to debug it.

Administrator [Syncfusion]
Replied On January 1, 2005 03:15 AM

Here is a minimal sample that handles the click events and does not seem to have the problem you described for me in 2.1.0.9. Do you see the problem in this sample? http://www.syncfusion.com/forums/Uploads/GDBG_RecNav_Events.zip

David Bosak
Replied On January 4, 2005 03:13 AM

I did OK. However, there are one problem: - If I move splitter bar toward right-hand and out of the GDBG, the original grid will be kept, events run OK. - If I move splitter bar toward left-hand and out of the GDBG, the new grid will keep, events of the original grid not kept. How to fix it? How to display the orginal GDBG instead of new grid in this case. Please help! Thanks,

Administrator [Syncfusion]
Replied On January 4, 2005 04:11 AM

This does not happen in the sample I uploaded, does it? The only way I can help is if you upload a sample showing the problem.

Administrator [Syncfusion]
Replied On January 4, 2005 04:21 AM

If for some reason, you cannot upload a sample, then post code so I can see what you are doing. 1) The code where you subscribe to the PaneCreated and PaneClosing events. 2) Your event handlers for the PaneCreated and PaneCLosing events. 3) The code where you subscribe to the grid events initially.

David Bosak
Replied On January 4, 2005 06:54 PM

Hi Clay, I cannot open the attachment link. 1. FrmAssociates.cs with two child classes: FrmAssociates and MyGridDataBoundGrid public class MyGridDataBoundGrid : GridDataBoundGrid { private bool inColSelections = false; public MyGridDataBoundGrid(GridDataBoundGridModel model):base(model) { } public MyGridDataBoundGrid() { } /// /// Clean up any resources being used. /// /// protected override void Dispose( bool disposing ) { base.Dispose( disposing ); } protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e) { int row, col; Point pt = this.PointToClient(Control.MousePosition); bool onColHeader = this.PointToRowCol(pt, out row, out col, -1) && row == 0; if( onColHeader && !inColSelections) { this.ListBoxSelectionMode = SelectionMode.None; } else if(!onColHeader && inColSelections) { GridCurrentCell cc = this.CurrentCell; if (cc.RowIndex > 0) { this.ListBoxSelectionMode = SelectionMode.One; inColSelections = false; } } base.OnMouseDown(e); } protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e) { base.OnMouseUp(e); int row, col; Point pt = this.PointToClient(Control.MousePosition); if(this.PointToRowCol(pt, out row, out col, -1) && row == 0) { if(!inColSelections) inColSelections = true; else { inColSelections = false; } } else { GridCurrentCell cc = this.CurrentCell; if (cc.RowIndex > 0) { this.ListBoxSelectionMode = SelectionMode.One; inColSelections = false; } } } } 2. In FrmAssociates class, I use GDBG is dgrSearchResult which is inherited from MyGridDataBoundGrid instead of GDBG: private Syncfusion.Windows.Forms.Grid.GridRecordNavigationControl gridRecordNavigationControl1; private NavigationPreference.MyGridDataBoundGrid dgrSearchResult; 3. rightStandarSearchGrid is private GridDataBoundGrid rightStandardSearchGrid; private void gridRecordNavigationControl1_PaneCreated(object sender, Syncfusion.Windows.Forms.SplitterPaneEventArgs e) { // Subscribe to the events rightStandardSearchGrid = e.Control as GridDataBoundGrid; if (rightStandardSearchGrid != null) { rightStandardSearchGrid.CurrentCellActivating += new GridCurrentCellActivatingEventHandler(dgrSearchResult_CurrentCellActivating); rightStandardSearchGrid.CellDoubleClick += new GridCellClickEventHandler(dgrSearchResult_CellDoubleClick); rightStandardSearchGrid.ResizingColumns += new GridResizingColumnsEventHandler(dgrSearchResult_ResizingColumns); rightStandardSearchGrid.KeyDown += new KeyEventHandler(dgrSearchResult_KeyDown); rightStandardSearchGrid.MouseUp += new MouseEventHandler(dgrSearchResult_MouseUp); rightStandardSearchGrid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(dgrSearchResult_PrepareViewStyleInfo); } } private void gridRecordNavigationControl1_PaneClosing(object sender, Syncfusion.Windows.Forms.SplitterPaneEventArgs e) { // Unsubscribe to the events if (rightStandardSearchGrid != null) { rightStandardSearchGrid.CurrentCellActivating -= new GridCurrentCellActivatingEventHandler(dgrSearchResult_CurrentCellActivating); rightStandardSearchGrid.CellDoubleClick -= new GridCellClickEventHandler(dgrSearchResult_CellDoubleClick); rightStandardSearchGrid.ResizingColumns -= new GridResizingColumnsEventHandler(dgrSearchResult_ResizingColumns); rightStandardSearchGrid.KeyDown -= new KeyEventHandler(dgrSearchResult_KeyDown); rightStandardSearchGrid.MouseUp -= new MouseEventHandler(dgrSearchResult_MouseUp); rightStandardSearchGrid.PrepareViewStyleInfo -= new GridPrepareViewStyleInfoEventHandler(dgrSearchResult_PrepareViewStyleInfo); } } 4. Maybe the problem is rightStandardSearchGrid, dgrSearchResult have different types? Actually, the above events run OK. However, I need to solve the others: - If I move splitter bar toward right-hand and out of the GDBG, the original grid will be kept, events run OK. - If I move splitter bar toward left-hand and out of the GDBG, the new grid will keep, events of the original grid not kept. How to fix it? How to display the orginal GDBG instead of new grid in this case. - At the first time, I cannot click on rightStandardSearchGrid to select column, row. However, if I click on dgrSearchResult to select colum, row; then re-click rightStandardSearchGrid, it runs OK. Please help! Thanks a lot.

Administrator [Syncfusion]
Replied On January 5, 2005 02:28 AM

First, in addition to subscribing to the events in PaneCreated, you also have to explicitly subscribe to the events for the initially created grid (maybe in the designer generated code or in Form.Load). In the code you pasted, I did not notice any code that did this. Now, since you are using a derived grid, there is some additonal work you need to do. When the splitter wants a new grid, it calls the grid.CreateNewControl method. So, unless you override this virtual method, any new grid created when a pane is created will be a GridDataBoundGrid, and not your derived grid. So, any functionality you are implementing in the derived grid will not be seen in the new panes. So, try overriding CreateNewControl. Here is the code from the GridDataBoundGrid implementation. You would have create and return an instance of your derived grid. public override Control CreateNewControl(Control parent, int row, int column) { GridDataBoundGrid grid1 = new GridDataBoundGrid(DataBoundGridModel); WireNewControl(grid1); return grid1; }

David Bosak
Replied On January 5, 2005 03:51 AM

Hi Clay, I am trying to solve this problem as your solution. However, I have a question: How to detain users in moving the splitterbar toward the left-hand when left-pane''s width is less than or equal 25 (leftPane.Width <= 25)? I.e. Users cannot move the splitterbar toward the left if leftpane''s width <= 25. Thanks!

Administrator [Syncfusion]
Replied On January 5, 2005 05:00 AM

You can impose a minimum size by handling the splitter changed event. private void gridRecordNavigationControl1_HSplitPosChanged(object sender, System.EventArgs e) { if(this.gridRecordNavigationControl1.HSplitPos < 25) this.gridRecordNavigationControl1.HSplitPos = 25; }

David Bosak
Replied On January 5, 2005 10:01 PM

How to not allow user to drag the splitter out of the grid?

Administrator [Syncfusion]
Replied On January 6, 2005 02:10 AM

One way is to derive the recnavcontrol and override OnMoveSplitter, not calling the base class to ignore moves you do not allow.
public class MyGridRecordNavigationControl : GridRecordNavigationControl
{
	public override void OnMoveSplitter(object sender, int x, int y)
	{
		Point pt = this.PointToClient(Control.MousePosition);
		if(pt.X < 50 || pt.X > this.Size.Width - 50)
		{
			Console.WriteLine("Ignoring a splitter move.");
			return;
		}
		base.OnMoveSplitter (sender, x, y);
	}
}

David Bosak
Replied On January 6, 2005 10:27 PM

Thank a lot, it runs OK.

CONFIRMATION

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.

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.

;