Solved

Use the Tab-Key in an Edit Box.

Posted on 1998-07-30
17
501 Views
Last Modified: 2013-11-19
I´ve written a program were I among other things use a large Edit-Box. I´ve added Multiline and want Enter. BUT I would like to be able to use the Tab-Key like in Notepad, were the cursor jumps a little bit to the right each time you press it. If that´s possible, I would appriciate the code written out since I´m quite new at this.
Thanx...
0
Comment
Question by:Ffaze
  • 9
  • 7
17 Comments
 
LVL 1

Expert Comment

by:awd
ID: 1319959
Use <tab><enter> inside the edit box.  Otherwise you could probably capture the keystroke in the code.
0
 

Author Comment

by:Ffaze
ID: 1319960
I would like the code please, it should be as easy as any other program to use the Tab-key.
0
 

Author Comment

by:Ffaze
ID: 1319961
Increased points.....
0
 
LVL 23

Accepted Solution

by:
chensu earned 80 total points
ID: 1319962
class CMyEdit : public CEdit
{
    protected:
        afx_msg UINT OnGetDlgCode();
};

BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
    ON_WM_GETDLGCODE()
END_MESSAGE_MAP()

UINT CMyEdit::OnGetDlgCode()
{
    return DLGC_WANTALLKEYS;
}

Associate the edit control with CMyEdit instead of CEdit. (Use MFC ClassWizard/Member Variables to associate it)

0
 

Author Comment

by:Ffaze
ID: 1319963
I´m using a formview and I´ve tried to input your code in CMyView and it did´nt work I´ve got Errors so if you could tell me were to write the cod I´d appriciate it....
0
 
LVL 23

Expert Comment

by:chensu
ID: 1319964
What are the Errors?
0
 

Author Comment

by:Ffaze
ID: 1319965
This is what I get...
D:\Recept\ReceptView.cpp(67) : error C2509: '_GetBaseMessageMap' : member function not declared in 'CReceptEdit'

D:\Recept\ReceptView.cpp(67) : error C2509: 'GetMessageMap' : member function not declared in 'CReceptEdit'

D:\Recept\ReceptView.cpp(67) : warning C4273: 'protected: static struct AFX_MSGMAP const  CWnd::messageMap' : inconsistent dll linkage.  dllexport assumed.

D:\Recept\ReceptView.cpp(67) : error C2491: 'CReceptEdit::CEdit::CWnd::messageMap' : definition of dllimport static data member not allowed

Error executing cl.exe.

Recept.exe - 3 error(s), 1 warning(s)

0
 
LVL 23

Expert Comment

by:chensu
ID: 1319966
In your ReceptView.h,

.
class CMyEdit : public CEdit
{
    protected:
        afx_msg UINT OnGetDlgCode();
};
.
class CYourFormView : public CFormView
{
.
    CMyEdit m_edit;
.
};


In your ReceptView.cpp,

.
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
    ON_WM_GETDLGCODE()
END_MESSAGE_MAP()

UINT CMyEdit::OnGetDlgCode()
{
    return DLGC_WANTALLKEYS;
}
.

// the following should be generated by ClassWizard
void CYourFormView::DoDataExchange(CDataExchange* pDX)
{
      CFormView::DoDataExchange(pDX);
      //{{AFX_DATA_MAP(CYourFormView)
        ...
      DDX_Control(pDX, IDC_EDIT1, m_edit);
        ...
      //}}AFX_DATA_MAP
}

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:Ffaze
ID: 1319967
I´m sorry but it just doesn´t work I´ve tried to change class and move it around but in the end I´ll still get the same errors as before.....
0
 

Author Comment

by:Ffaze
ID: 1319968
I´m sorry but it just doesn´t work I´ve tried to change class and move it around but in the end I´ll still get the same errors as before.....
0
 
LVL 23

Expert Comment

by:chensu
ID: 1319969
Which line causes the error?
0
 

Author Comment

by:Ffaze
ID: 1319970
All errors are caused by this:

BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
      ON_WM_GETDLGCODE()
END_MESSAGE_MAP()
0
 
LVL 23

Expert Comment

by:chensu
ID: 1319971
Where do you put this?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1319972
Sorry, that's my fault. I missed out DECLARE_MESSAGE_MAP().

class CMyEdit : public CEdit
{
    protected:
        afx_msg UINT OnGetDlgCode();

    DECLARE_MESSAGE_MAP()
};

0
 

Author Comment

by:Ffaze
ID: 1319973
In my CReceptView.cpp
Right under:
BEGIN_MESSAGE_MAP(CReceptView, CFormView)
      //{{AFX_MSG_MAP(CReceptView)


END_MESSAGE_MAP()

Here it comes......
0
 
LVL 23

Expert Comment

by:chensu
ID: 1319974
Now it should be OK.
0
 

Author Comment

by:Ffaze
ID: 1319975
Thanx for all your work "chensu" it worked perfectly now. I´ve increased the points a little, enjoy.....
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now