Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SetCheck() for checkbox in MFC GridControl 2.7

SetCheck() for checkbox in MFC GridControl 2.7

Scheduled Pinned Locked Moved C / C++ / MFC
c++csstutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    Im using MFC GridControl 2.7 taken from code proejct in my application.In my grid control, im making second column as check box column. The default state of check box should be true. Later, user can uncheck the checkbox and depends on the state, furthur functinoality wil go. Here i dont know how to set checkbox as checked in default.

    m_ctLstCtrl.Create(listRect, this, IDC_TRENDLISTCTRL);

    	// fill it up with stuff
    	m\_ctLstCtrl.SetEditable(TRUE);
    	
    
    	try {
    		m\_ctLstCtrl.SetRowCount(9);
    		m\_ctLstCtrl.SetColumnCount(15);
    		m\_ctLstCtrl.SetFixedRowCount(1);
    		m\_ctLstCtrl.SetFixedColumnCount(1);
    		
    	}
    	catch (CMemoryException\* e)
    	{
    		e->ReportError();
    		e->Delete();
    		return -1;
    	}
    

    for (int row = 0; row < m_ctLstCtrl.GetRowCount()-1; row++)
    {
    m_ctLstCtrl.SetCellType(row+1,1,RUNTIME_CLASS(CGridCellCheck));
    // m_ctLstCtrl.SetItemState(row+1,1, m_ctLstCtrl.GetItemState(row+1,1) | GVIS_SELECTED); //if i do this, blue colr selection is appearing but not check mark

    	}
    

    Anu

    L 1 Reply Last reply
    0
    • A Anu_Bala

      Im using MFC GridControl 2.7 taken from code proejct in my application.In my grid control, im making second column as check box column. The default state of check box should be true. Later, user can uncheck the checkbox and depends on the state, furthur functinoality wil go. Here i dont know how to set checkbox as checked in default.

      m_ctLstCtrl.Create(listRect, this, IDC_TRENDLISTCTRL);

      	// fill it up with stuff
      	m\_ctLstCtrl.SetEditable(TRUE);
      	
      
      	try {
      		m\_ctLstCtrl.SetRowCount(9);
      		m\_ctLstCtrl.SetColumnCount(15);
      		m\_ctLstCtrl.SetFixedRowCount(1);
      		m\_ctLstCtrl.SetFixedColumnCount(1);
      		
      	}
      	catch (CMemoryException\* e)
      	{
      		e->ReportError();
      		e->Delete();
      		return -1;
      	}
      

      for (int row = 0; row < m_ctLstCtrl.GetRowCount()-1; row++)
      {
      m_ctLstCtrl.SetCellType(row+1,1,RUNTIME_CLASS(CGridCellCheck));
      // m_ctLstCtrl.SetItemState(row+1,1, m_ctLstCtrl.GetItemState(row+1,1) | GVIS_SELECTED); //if i do this, blue colr selection is appearing but not check mark

      	}
      

      Anu

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You should post your question in the forum at the end of the article. I know for a fact that the author spends much of his time on CodeProject.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups