[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 420
  • Last Modified:

ActiveX MSFlexGrid Column Visible

The ActiveX control MSFlexGrid has a function called
GetColIsVisible().  I could not find a SetColIsVisible().  How
can I show or hide a specific column on the grid?
0
jrmcg
Asked:
jrmcg
1 Solution
 
guruprasad031298Commented:
Even I couldn't find a similar method. So, what I did is to make the desired column width as 0, so that the next column will overlap the "to be" hidden column. Here is a code snippet.

/** If the selected paint scheme is Monotone, don't display the secondary paint code
 * and description  */
CString comboSel;
m_PaintProcCombo.GetWindowText (comboSel);
if (comboSel.CompareNoCase (MONOTONE_PAINT) == 0)
{
    // Hide secondary code and desc columns
   glSecondaryCodeWidth = m_PaintTrimGrid.GetColWidth (5);
   glSecondaryDescWidth = m_PaintTrimGrid.GetColWidth (6);

   // concentrate here
   m_PaintTrimGrid.SetColWidth (5, 0);
   m_PaintTrimGrid.SetColWidth(6, 0);
   m_PaintTrimGrid.Refresh();
}
else
{
   // need to note this too ....
   if (glSecondaryCodeWidth != 0)
      m_PaintTrimGrid.SetColWidth (5, glSecondaryCodeWidth);
   if (glSecondaryDescWidth != 0)
              m_PaintTrimGrid.SetColWidth (6, glSecondaryDescWidth);
   m_PaintTrimGrid.Refresh();
}

Discard the logic and look for whatever you are looking for. Here glSecondaryCodeWidth is a global variable with the module as it's scope. Eventhough you can't digest this sloppy code, it works and it works WELL.

Hope this helps ....
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now