Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Use the Tab-Key in an Edit Box.

Posted on 1998-07-30
17
Medium Priority
?
539 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
[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
  • 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
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 23

Accepted Solution

by:
chensu earned 320 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
 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

610 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