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
close icon

Resizing a column in GDBG

Is there a way to get the same behaviour as in Excel when a column width is 0. In Excel, the mouse pointer changes to two small vertial lines if the col behind has a 0 width. One thing I found is to set the MinResizeColSize to 1, so there is a small grey line between the columns and the user would be able to resize the hidden column. Is there another way to do this? Regards Thomas

6 Replies

AD Administrator Syncfusion Team November 11, 2003 04:58 PM UTC

To change the cursor you would either have to derive the grid and override OnSetCursor, or implement your own IMousecController class. The simplest way is to derive the grid, and override OnSetCursor. Here is a sample. You can add additional checks to narrow where you set the cursor. Another way is to implement IMouseController and fit directly into the grid's mosue controller architecture. You can create a class that implements the IMouseController interface which will also allow you to control the cursor. This takes a little more code but does not require that you derive the grid to use it. Here is a sample that changes the cursor over the top half of each cell. This means that anywhere else, the grid allows the other controllers a chance to handle the mouse actions. Your mouse controller must implement the IMouseController interface. The main method you have to handle is the HitTest method. Returning a non-zero hit value at that point indicates to the grid that your mousecontroller wants control of things at this point. It will then the use your controller for all messages as long as the hittest returns nonzero. This means your controller will provide the cursor, it will handle the mousedown etc. In the sample, the only functionality implemented is to change the cursor and to handle a left click. You would use as your hit test criteria for either of these samples being over a header cell border of a hidden column. It would take a little effort, but is doable I think.


AD Administrator Syncfusion Team November 11, 2003 05:34 PM UTC

Thanks Clay, that would give me the ability to achieve the same behaviour as Excel. Regards Thomas


JH Jason Haag November 17, 2003 07:22 PM UTC

Implementing this controller seems to disable all the normal mouse behaviors such as being able to select columns (single and multiple). Is it possible to use this method only in certain situations, such as when the form cursor is set to a WaitCursor. The actaul problem is when the form is busy and the user moves the mouse over the form, the cursor is set to the default cursor "fooling" the user that the form is ready for additional requests. j


AD Administrator Syncfusion Team November 17, 2003 08:13 PM UTC

If your HitTest in your controller returns 0, then your controller would not affect other controllers at that point. So, when you want to pass on the mouse actions, make sure you return zero in your HitTest.


JH Jason Haag November 18, 2003 07:09 PM UTC

ok, I will attempt to do that. what exactly does the hittest do, and why does it return 101 in the sample you provided.


AD Administrator Syncfusion Team November 18, 2003 08:11 PM UTC

101 is not zero. That is reason. You could return different values if you want to indicate your mouse is over different things. But, whoever is calling this routine would have to be aware of your coding scheme. As fas as the grid goes, there are only 2 values, zero and nonzero.

Loader.
Live Chat Icon For mobile
Up arrow icon