Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:47:13+00:00 2026-06-06T23:47:13+00:00

I am creating a very very simple spreadsheet type application. It has a grid

  • 0

I am creating a very very simple spreadsheet type application. It has a grid that draws cells and the user can specify the cell type (text, check box, radio button).

I’m trying to get the text to work out. In the main View class I have:

void CSpreadView::OnInsertText()
{
    CEdit* pEdit = new CEdit;
    CWnd* pParentWnd = this;
    grid.CellType(pEdit, pParentWnd);
    Invalidate();   
    UpdateWindow();
}

I’m passing the parent window because I don’t know if there is a way to find the parent window if I’m in another class.

So the function that receives it:

void Grid::CellType(CEdit* pEdit, CWnd* pParentWnd)
{
    for (int a=0; a<(int) cells.size(); a++)
    {
        if(cells[a]->selected)
            cells[a]->Type(pEdit, pParentWnd);
    }
}

Finally, when the cell is drawn it does:

if(type=="text")
    {
        CEdit* pEdit = new CEdit;
        pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(x1+10, y1+10, x2-10, y2-10), pParentWnd, 1);
    }

The problem: it actually draws the box, however, the text is invisible. When I type it flashes, but when I stop it disappears. Does anyone know why this is happening?

Just so you know, I want the cell to control its type and do the drawing because the user can add/delete rows and columns. That I way I don’t need to keep track of what text boxes where previously drawn. The grid is drawn by:

CBrush brush(RGB(color, color, color));
pDC->SelectObject(&brush);
pDC->Rectangle(x1, y1, x2, y2);

This is what I see:
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:47:14+00:00Added an answer on June 6, 2026 at 11:47 pm

    Don’t create child windows on OnPaint(), that is bound for disaster. You need to do your own drawing, you can at most re-use a single CEdit when editing a single cell.

    I take it you’re trying to make a grid where each cell is control (window) which will e.g. move along when you scroll in the grid. This will always give visual artifacts (jerky movement) and cause problems when displaying half cells.

    You’re going to have to derive your own cell types, who do their own drawing (possibly using the DrawFrameControl() API for the more complex types) and who may pop up a child window when the content of the cell is being edited. This is roughly the design used by the fore-mentioned Maunder CGridCtrl.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a very simple application that only has a seek bar that
I'm creating a very simple chat application. It has an ASP.NET web page as
I'm creating a very simple form that has a text area. The text area
I'm creating a very simple timeshare application using Sinatra and Datamapper. Every user in
I am creating a very simple to-do list application. Each user should have an
I'm creating a very simple django upload application but I want to make it
A very simple use case for creating users in webapp2/appengine can be as follows:
i'm creating a very simple (hello World quality) web application using spring mvc 3.0.
Hi guys I'm creating a very simple socket server that lets its clients save
I am creating a very simple quiz application with jQuery. How it works is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.