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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:36:10+00:00 2026-05-14T09:36:10+00:00

Due to comments I added the following code (in BasicPanel) Connect(CTRL_ONE, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&BasicPanel::OnKillFocus); Connect(CTRL_TWO,wxEVT_KILL_FOCUS,

  • 0

Due to comments I added the following code

(in BasicPanel)

Connect(CTRL_ONE, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&BasicPanel::OnKillFocus);
Connect(CTRL_TWO,wxEVT_KILL_FOCUS, (wxObjectEventFunction)&BasicPanel::OnKillFocus);
Connect(CTRL_THREE, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&BasicPanel::OnKillFocus);
Connect(CTRL_FOUR, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&BasicPanel::OnKillFocus);
Connect(CTRL_FIVE, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&BasicPanel::OnKillFocus);

(enums)

    CTRL_NAME = wxID_HIGHEST + 5, // 6004
    CTRL_ADDRESS = wxID_HIGHEST + 6, // 6005
    CTRL_PHONENUMBER = wxID_HIGHEST + 7, // 6006
    CTRL_SS = wxID_HIGHEST + 8, // 6007
    CTRL_EMPNUMBER = wxID_HIGHEST + 9 // 6008

(The OnKillFocus Function – the declaration is included as suggested)

void BasicPanel::OnKillFocus(wxFocusEvent& event) {
    switch (event.GetId()) {
        case 6004:
            ...
            break;
                ...    ...     ...
    }

All of these added to the code do nothing when the user changes focus on which text box they are using…


Q1:I am using wxWidgets (C++) and have come accost a problem that i can not locate any help. I have created several wxTextCtrl boxes and would like the program to update the simple calculations in them when the user ‘kills the focus.’ I could not find any documentation on this subject on the wxWidgets webpage and Googling it only brought up wxPython. The two events i have found are: EVT_COMMAND_KILL_FOCUS - EVT_KILL_FOCUS for neither of which I could find any snippet for. Could anyone give me a short example or lead me to a page that would be helpful?

Q2:Would i have to create an event to handle the focus being killed for each of my 8 wxTextCtrl boxes? In the case that i have to create a different event: How would i get each event to differentiate from each other? I know i will have to create new wxID’s for each of the wxTextCtrl boxes but how do I get the correct one to be triggered?

class BasicPanel : public wxPanel { ...     
    wxTextCtrl* one;
    wxTextCtrl* two;
    wxTextCtrl* three;
    wxTextCtrl* four; ... }
  • 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-14T09:36:11+00:00Added an answer on May 14, 2026 at 9:36 am

    Okay, first off, here is the code to put in your BasicPanel class:

    void OnKillFocus(wxFocusEvent& event);
    

    Then add the following to the end of your BasicPanel constructor:

    Connect(ID_TEXTCTRL,
            wxEVT_KILL_FOCUS ,
            (wxObjectEventFunction)&BasicPanel::OnKillFocus);
    

    You will need to repeat the above code for each text control and replace ID_TEXTCTRL with the actual ID of the controls.

    Then the code below will get called whenever one of the controls loses focus.

    void BasicPanel::OnKillFocus(wxFocusEvent& event)
    {
        // code goes here...
    }
    

    To determine the ID of the control that generated the event within OnKillFocus, you can use the following:

    event.GetId()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Due to the first two comments I've removed all my own code and placed
Due to a sad situation I receive HTML like this: <p>Perform the following commands:
I have a code that uses Arrays.sort(char[]) in the following manner: void arrayAnalysis(String[] array){
I've got several hundred warnings due to missing xml comments from a single DataSet
NOTE: I have changed the details provided due to comments provided. The new technical
In one of my Java projects I am plagued by code repetition due to
greetings! im stuck at present due to lack of knowledge. i have the following:
I have the following javascript snippet, which fails to load due to a missing
Is there a way to prevent code comments to be marked as changes in
Image: http://dl.dropbox.com/u/4900888/GUI.png Source and UI is in comments, due to New-user-limiations I'm sorry if

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.