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.

Grid vertical scroll bar not working in some cases

Thread ID:

Created:

Updated:

Platform:

Replies:

27624 Apr 14,2005 05:40 PM Apr 18,2005 12:28 PM Windows Forms 5
loading
Tags: GridControl
James
Asked On April 14, 2005 05:40 PM

Hi, I have some problem with grid vertical scroll bar. I have a grid contained in a panel (panelGridHolder) which is Dock to top of another panle (panelContent). I set panelContent''s AutoScrollMinSize to some fixed size. Grid has data and shows vertical scroll bar. If I move panelContent''s horizontal scroll bar to the right and click on grid''s vertical scroll bar, nothing happened. I did some debugging and found out the click on the grid''s vertical scroll bar actually accepted by the grid not the vertical scroll bar. Do I need to inform grid the layout position is changed because I moved panelContent''s horizontal scroll bar? Thanks for your help! James

Administrator [Syncfusion]
Replied On April 15, 2005 01:07 PM

We were able to reproduce this problem in a sample. It seems that the panel does not realize that it was moved and when you click on the scrollbar it incorrectly sends a MouseDown message to the grid. The following code works around this problem in the sample
Point saveLocation = Point.Empty;
protected override void WndProc(ref Message m)
{
     if (saveLocation.IsEmpty || saveLocation != this.panel1.DisplayRectangle.Location)
     {
             if (!saveLocation.IsEmpty)
             {
                  this.panel2.Refresh();
             }
             saveLocation = this.panel1.DisplayRectangle.Location;
       }
       Console.WriteLine(this.panel1.DisplayRectangle);
       base.WndProc (ref m);
}
Here is this sample modified to avoid this problem. GDBG_Panel_2460.zip

James
Replied On April 15, 2005 04:30 PM

Clay, Thanks for your reply. It does not always work. Try to click right arrow on the horizontal scroll bar of container panel (panel1) all the way to right. Grid''s vertical scroll bar wouldn''t response. I also noticed if I dragged on the track thumb and grid''s vertical scroll bar will work just fine. James

Administrator [Syncfusion]
Replied On April 16, 2005 07:57 AM

Try this override.
Point saveLocation = Point.Empty;
int setCursorCt = 0;
protected override void WndProc(ref Message m)
{
	if (saveLocation.IsEmpty || 
 		saveLocation != this.panel1.DisplayRectangle.Location)
	{
		if(m.Msg == 0x21) //mouseactivate
			setCursorCt = 0;
		if(m.Msg == 0x20) //setcursor
		{
			if(setCursorCt == int.MaxValue)
				setCursorCt = int.MinValue;
			setCursorCt++;
		}
		if (!saveLocation.IsEmpty || setCursorCt == 2) 
		{
 			this.panel2.Refresh();
			//Console.WriteLine(this.panel1.DisplayRectangle);
		}
 		saveLocation = this.panel1.DisplayRectangle.Location;
 	}
	base.WndProc (ref m);
}

James
Replied On April 18, 2005 10:28 AM

Hi Clay, Great, it works now. Just curious why checking for setCursorCt == 2. Thanks a lot! James

Administrator [Syncfusion]
Replied On April 18, 2005 12:28 PM

It is a hack. If you look at the messages going through the WndProc when you release the mouse button after scrolling all the way, all you get is the mouse activate and two cursors. So, in order to redraw the panel, to make sure things are positioned OK, the code looks for that sequence.

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.

;