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

How to identify if a column is partially visible...

Hi,

I am using a GridControl, which has several columns. At any point of time, all columns are not visible to the user. User needs to scroll to see the hidden columns.

How do i find if a particular column is partially hidden on mouse hover ? 

regards,
Deepu 


5 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team November 15, 2014 01:54 PM UTC

Hi Deepu,

 

If you want to identify the partial column is visible or not in a grid, you can use “HasPartialVisibleCols” property. Please refer the below code,

 

Code:

 

if (e.Index > this.gridControl1.ColCount-1)

  {

    if (gridControl1.ViewLayout.HasPartialVisibleCols)

     {

int viewLayout = this.gridControl1.ViewLayout.VisibleCols + (gridControl1.ViewLayout.HasPartialVisibleCols ? -1 : 0); // visible column count

MessageBox.Show("Partial Visible Column");

    }

   else

    {

      MessageBox.Show("Visible Column");

    }

}

 

Please let us know if I misunderstood you query.

 

Regards,

Muthukumar K



DA Deepu A M November 17, 2014 06:28 AM UTC

Hi Muthukumar, 

Thank you for your reply. 

But i think i was not clear enough regarding my query. 

In my application, there are a few partially hidden columns. it could on the right side (normally) or on the left side (if we have scrolled to the right). 
When a column is partially hidden, i need to show its content as tool tip.

So in order to show the tool tip i need to know if the column on which i am hovering is partially hidden or not. 

The code you gave me will only tell me if there are any partially hidden columns in the grid, but what i need to know is if the column on which i am hovering currently is partially hidden or not.


Thank You, 
Deepu A M


MK Muthukumar Kalyanasundaram Syncfusion Team November 18, 2014 12:21 PM UTC

Hi Deepu,

 

Thanks for the update.

 

If you want to show the tooltip in a grid which is partially visible column or not, you can use “QueryCellInfo” event. Please refer the below code,

 

Code:

void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

        {

            if (flag)

            {               

                if (e.ColIndex < viewLayout && e.RowIndex > 0)

                {

                    toolTip = this.gridControl1.ColStyles[viewLayout].CellValue.ToString();

                    e.Style.CellTipText = "visible";                  

                }

                else

                {                   

                     e.Style.CellTipText = "Partially visible";

                }              

            }

        }

 

void Model_QueryColWidth(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)

        {       

            if (e.Index > this.gridControl1.ColCount-1)

            {

                if (gridControl1.ViewLayout.HasPartialVisibleCols)

                {

                    viewLayout = this.gridControl1.ViewLayout.LastVisibleCol;                

                  

                }

                e.Handled = true;

            }

        }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: GC__VIsibleColumn_57e71de3.zip


DA Deepu A M November 24, 2014 04:55 AM UTC

Hi Muthu,

I am still not able to resolve the issue. 

As you can see in the attached image, I have two panels on both sides and the grid control in between. 
The grid has 4 columns - name, age, address and phone number.

The name column and the address column are partially hideen (name to the left and address to the right).
the phone number column is completely hidden. 

Now i want a tool tip to appear when the mouse hovers over the first name column and the address column.
But no tool tip on age, as it is fully visible. 

Attachment: my_application_with_grid_control_d08cb204.zip


MK Muthukumar Kalyanasundaram Syncfusion Team November 26, 2014 06:34 PM UTC

Hi Deepu,

 

If you want to show the tooltip text  when you hover the partially hidden column, you can use the “CellMouseHoverEnter” event and “QueryCellInfo” event . By using CellMouseHoverEnter event, you can set the “HasPartialVisibleCols” property to identify the partial hidden column in a grid. Please refer the below code and attached sample.

 

Code:

 

tooltip1.InitialDelay = 100000;

this.gridControl1.QueryCellInfo += new GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo);

this.gridControl1.CellMouseHoverEnter += new GridCellMouseEventHandler(gridControl1_CellMouseHoverEnter);

 

string cellValue; 

bool flag = false;

int viewLayout;

 

void gridControl1_CellMouseHoverEnter(object sender, GridCellMouseEventArgs e)

  {           

     if (gridControl1.ViewLayout.HasPartialVisibleCols)

        {

          viewLayout = this.gridControl1.ViewLayout.LastVisibleCol;

          flag = true;

        }

     else

        {

          // MessageBox.Show("Visible Column");

         }           

  }

 

void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

   {

    if (flag)

      {               

        if (e.ColIndex == viewLayout && e.RowIndex > 0)

          {

              cellValue = this.gridControl1.ColStyles[viewLayout].CellValue.ToString();

              e.Style.CellTipText = "Partially visible" + tooltip1.InitialDelay;                

          }

        else

          {

              e.Style.CellTipText = string.Empty;

          }              

      }

   }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: GC__HiddenColumn_d0f46bae.zip

Loader.
Up arrow icon