Solved

using MS FlexGrid -- Urgent

Posted on 1998-07-28
8
198 Views
Last Modified: 2013-11-20
Where or how can I get a control which would be like MSFlex Grid control, but with editable cells?
0
Comment
Question by:lxiao
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 1

Accepted Solution

by:
guruprasad031298 earned 60 total points
ID: 1319868
You can use the DBGrid control, which allows in-place editing or code MSFlexGrid to allow in-place editing (more work involved). If you want some code about in-place editing on MSFlexGrid, let me know.

The DBGrid control is by Apex Software Corp and is bundled with VC++ ver 5.0. In case if you don't have one in your machine or want to buy one, you can reach them through 1-800-858-APEX.

Hope this helps ....
0
 

Author Comment

by:lxiao
ID: 1319869
I have TRUE DBGrid Evaluation copy, but I don't have a DB to support. My usage is simple, MSFlexGrid does very well except it's not editable. I would prefer in-place editing. How?
0
 

Author Comment

by:lxiao
ID: 1319870
I have TRUE DBGrid Evaluation copy, but I don't have a DB to support. My usage is simple, MSFlexGrid does very well except it's not editable. I would prefer in-place editing. How?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:guruprasad031298
ID: 1319871
Try using this. This is one of the answer I suggested to a question at expert-exchange already. It worked well. Should work good for you too. May be rquires some minor adjustment for edit control positioning.

void CMyView::OnDblClickStdgrid()
 {
    // Embed editable CEdit Control

    // Construct edit control
    pEdit = new CStdEqpEdit(&m_StdGrid, row);  // Pass the flexgrid control & the                                                                       // selected row for further processing

    /*
     * Conversion from Twips to Pixel scale. Divisor values are specific to this
     * grid and may not work for others. Generic conversion routine couldn't be
     * written for this purpose. Make sure not to change this
     */

    long lLeft = (long) (m_StdGrid.GetCellLeft () / 15);
    long lTop = (long) (m_StdGrid.GetCellTop () / 15);
    long lHeight = (long) (m_StdGrid.GetCellHeight() / 15);
    long lWidth = (long) (m_StdGrid.GetCellWidth() / 14.3);

    CRect rect (lLeft, lTop, lLeft + lWidth, lTop + lHeight);

    // Create the edit control on the fly
    pEdit->Create (WS_CHILD | WS_VISIBLE | WS_BORDER, rect,                                                       this,IDC_SEQ_NUM_EDIT);
    pEdit->SetWindowText (m_StdGrid.GetText());

    // Change the font of the edit control to that of the grid cell for consistency
    CString sFontName = m_StdGrid.GetCellFontName();
    int iFontSize = (int) (m_StdGrid.GetCellFontSize() * FONT_SCALE);
    CFont *pFontEdit = new CFont();
    pFontEdit->CreatePointFont (iFontSize, sFontName);
    pEdit->SetFont (pFontEdit);

    // Set the focus to the edit control
    pEdit->SetFocus();
}

    Hope this helps





0
 

Author Comment

by:lxiao
ID: 1319872
Thanks. I'll try.
0
 

Author Comment

by:lxiao
ID: 1319873
I created the CEdit control. But once it gets into the Grid area, it disappears. What's wrong?
Thanks.
0
 
LVL 1

Expert Comment

by:guruprasad031298
ID: 1319874
Make sure you have subclassed the standard edit control, by using the classwizard - add new class functionality and derive the new class from CEdit, so that all the messages will be routed to this new class.

Add an OnSetFocus message handler to this Edit control. Then debug through the code to see what's wrong. Once you make sure the edit control behaves in the proper way, it's easy to figure out the rest.

Have a nice weekend
0
 

Author Comment

by:lxiao
ID: 1319875
The edit control size looks fine. But the position is wrong. How can I find the right position without using magic numbers? Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA "SendKeys" Syntax for Multiple Keystrokes 7 125
modThree challenge 4 110
Modbus - whats the maximum I can store in one register? 4 82
wordcount challenge 11 146
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question