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. Image for the cookie policy date

Grid vertical scroll bar not working in some cases

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

5 Replies

AD Administrator Syncfusion Team April 15, 2005 05:07 PM UTC

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


JA James April 15, 2005 08:30 PM UTC

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


AD Administrator Syncfusion Team April 16, 2005 11:57 AM UTC

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);
}


JA James April 18, 2005 02:28 PM UTC

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


AD Administrator Syncfusion Team April 18, 2005 04:28 PM UTC

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.

Loader.
Up arrow icon