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 6209099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:55:25+00:00 2026-05-24T05:55:25+00:00

I am writing an application with WxWidgets, and have run into an issue with

  • 0

I am writing an application with WxWidgets, and have run into an issue with a multiline text control (wxTextControl). It is the input field in a chat window, and it needs to be multi line in case the user types a longer message that needs to wrap. I want the send event, e.g. the action that is taken when the Send button is pressed, to be executed when the user presses enter in the control. I have this working using the wxEVT_COMMAND_TEXT_ENTER event, with the wxTE_PROCESS_ENTER style enabled. However, the problem is that while the send command does get executed, a new line character \n is also appended to the text (this happens after the send command and after I have cleared the text, resulting in an empty field except for a new line). I tried to avoid this by trapping both char and key down events, but for some reason they are not firing.

I simply want to avoid the new line being shown at all. Does anyone have any tips?

I am developing on Windows, but the application is meant to run on all platforms supported by WxWidgets.

  • 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-05-24T05:55:26+00:00Added an answer on May 24, 2026 at 5:55 am

    You might track wxEVT_COMMAND_TEXT_UPDATED and clear the editor when a new-line is entered (it assumes you are also clearing the editor when Enter is pressed).

    BEGIN_EVENT_TABLE(Test,wxFrame)
        EVT_TEXT_ENTER(EditorID, Test::OnEnter)
        EVT_TEXT(EditorId, Test::OnText)
    END_EVENT_TABLE()
    
    void Test::OnEnter(wxCommandEvent&)
    {
        Send(editor->GetValue());
        editor->Clear();
    }
    
    void Test::OnText(wxCommandEvent& event)
    {
        if (event.GetString() == wxT("\n")) { //seems to work, not much info in documentation?
            editor->Clear();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So. Writing application in C, unix, and i have function, which requests user input
I am writing an application in java (1.6) using swing. I currently have a
I am writing an application based on wxWidgets library. I had some classes which
Im writing application in c++ and after try to run built (in debug mode)
im writing application on asp mvc. so, i have jQuery tabs on index.aspx, which
I am writing application on playframework. I have a search form and I want
I'm writing application for downloading CSV file from web and inserting data into table
I'm writing application in which I need to validate text entered by user to
I'm writing an application that should both have the ability to place widgets on
I´m writing an application for Android in which I have a character that I

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.