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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:20:50+00:00 2026-05-27T05:20:50+00:00

I am trying to make a Digital IC simulation using wxWidgets. I have decent

  • 0

I am trying to make a Digital IC simulation using wxWidgets. I have decent knowledge of C++, but wxwidgets is relatively new.

As a first step, I need to display a breadboard. My solution is

  • a class myFrame (extends wxframe), creates instance of class breadboard (extends wxpanel).

  • breadboard has member
    wxMemoryDC bbBuffer

  • In constructor of breadboard i draw using following code snippet

    wxBitmap bmp(660, 450, -1);
    bbBuffer.SelectObject(bmp);
    bbBuffer.SetBackground(*wxWHITE_BRUSH);
    bbBuffer.Clear();
    bbBuffer.SetPen(wxPen(wxColor(80, 80, 80), 1));
    bbBuffer.DrawRectangle(10, 10, 640, 430);//more functions like this one follow
    

in render function i do this –

void BreadBoard::render(wxDC &dc)
{
    dc.Blit(wxPoint(10, 20), bbBuffer.GetSize(), &bbBuffer, wxPoint(0, 0));
}

I also draw wires using mouseEvent on wxClientDC and bbBuffer (this is too simple, later i will write it to XML file, but not now)

Is this a good design strategy?
Later on it will get complex, so how should i proceed?

  • 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-27T05:20:51+00:00Added an answer on May 27, 2026 at 5:20 am

    Personally, I would not make class breadboard an extension of wxPanel. It seems cleaner to have breadboard simply contain your code and not be a mixture.

    You can create a panel as a child of myFrame.

    class MyFrame {
        wxPanel * myPanel;
        ...
    MyFrame::MyFrame(
        ...
        myPanel = new wxPanel(this,-1,wxPoint(0,0),wxSize(2400,1200)) ;
        ...
    

    Then when you are ready to display the breadboard’s bitmap, a method of MyFrame can do a GetDC on the panel, and blit the image from the breadboard’s DC to the panel’s DC, or pass the panel DC to a method of the breadboard class so that the breadboard can do the blit without exposing its memory DC.

    void MyFrame::Render()
    {
        myBreadboard.Render( wxClientDC( myPanel ) );
    }
    

    What are the advantages?

    • Conceptually clearer, in my mind anyway.

    • More obvious how to draw your breadboard to another DC, e.g. a printer. You can simply pass the printer DC to the breadboard blit method.

    I see that your method render() does the blit. Some comments on this method:

    • You are passing in a wxDC parameter. What will this be? I am guessing that this will usually be the wxDC obtained by calling GetDC on this – which is kind of confusing and unnecessary. You could do the call to GetDC inside the render() method, which makes your code cleaner, but now you cannot use render to draw anywhere except to the panel implemented by breadboard which will eventually be a snag.

    • You have hard coded the location where the breadboard is drawn. Bad idea! Better to pass the location as a parameter, with a sensible default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
Right now I'm trying make some browser based game. But I have little questions.
I'm trying to make a truth-table generator for a digital electronics course because that's
I am trying make long screen to vertical direction. So, I need a screen
im trying make one replace in string from a array but this dont work
I'm trying make my first python app. I want make simple email sender form.
Trying to make this simple applet - the first part just creates a simple
I'm trying make one treeView with infinite subgroups. I can add my groups but
I'm trying to make a change to an old appengine application, but now after
Trying to make a Grid Like this using java and I'm assuming a 2d

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.