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

  • Home
  • SEARCH
  • 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 6905323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:10:11+00:00 2026-05-27T08:10:11+00:00

While reading tutorial for wxWiidgets I saw this Tutorial where author has created 2

  • 0

While reading tutorial for wxWiidgets I saw this Tutorial where author has created 2 subclasses of wxPanel, LeftPanel and RightPanel.

Left has 2 buttons, clicking which the text on right updates. Now there is another class Communicate which has one member wxPanel of which left and right panel are child.

Left Panel has a method ->

void LeftPanel::OnPlus(wxCommandEvent & WXUNUSED(event))
{
  count++;

  Communicate *comm = (Communicate *) m_parent->GetParent();
  comm->m_rp->m_text->SetLabel(wxString::Format(wxT("%d"), count));
}

where m_text is a public member of Right Panel.

I doubt if this is a good way of communicating.
My Question – Is this correct way of communicating? What will be a better method?

  • 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-27T08:10:12+00:00Added an answer on May 27, 2026 at 8:10 am

    I also saw the tutorial you are talking about. I think this is a good way of communicating as it uses the connect event methods of wxwidgets (read the events for more details). I’m no expert in wxwidgets, but i’ve always wrote my apps using this way of associating events of a class widgets to a function of the class and then this functions locate the object that it has to change the properties.

    Anyway if you consider that this event (of pushing the plus button) would happen really often and, specially, if you had too many functions/buttons like the plus and minus of the tutorial, one could define the m_text at the constructor:

    in header:

    wxStaticText *m_textlp;
    

    in construtor:

    m_textlp = ( (Communicate *) m_parent->GetParent() )->m_rp->m_text;
    

    such that the function would be only:

    void LeftPanel::OnPlus(wxCommandEvent & WXUNUSED(event))
    {
      count++;
      m_textlp->SetLabel(wxString::Format(wxT("%d"), count));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Warning I'm brand new to rails! While reading through a tutorial it has asked
While reading the answers to this question I got a doubt regarding the default
While reading proggit today, I came upon this comment in a post about how
This question arose while reading the new chapter in the excellent Learn You a
I have been following javascript tutorial from www.w3school.com and while reading one of the
I was reading this Sun's tutorial on Thread . I found a block of
I notice this has caused confusion for several people, but after reading a couple
While reading tutorials regarding pointers, i faced a code like this const int *p;
I`m a beginner reading a tutorial about Dates in JavaScript, and it gives this
I've started reading NerdDinner tutorial from scratch. While reading and coding application I came

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.