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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:48:32+00:00 2026-05-11T17:48:32+00:00

I have two essentially separate applications for configuring two pieces of hardware sold by

  • 0

I have two essentially separate applications for configuring two pieces of hardware sold by this company.

I’ve been asked to put the two applications together so that they can be accessed from within the same program in such a way that both are accessible. An analogy to the idea would be opening a program, selecting a file to open, then opening a document editor or a spreadsheet editor depending on the type of the file.

This isn’t particularly difficult for most aspects of the application, but my problem comes mostly from the main toolbar for the consolidated application. Each of the two different applications has its own set of functions relating to a common set of buttons, as well as having its own set of buttons.

I could separate the button responses in code with typechecking, i.e.

If documentOpened.isSpreadsheet
  spreadSheetFunction()
Else
  documentFunction()

but this seems messy to me, incorporating the functions of two classes into one bloated interface class.

Is there some way to achieve a greater degree of encapsulation, here, given that the two interfaces are so different?

  • 1 1 Answer
  • 1 View
  • 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-11T17:48:32+00:00Added an answer on May 11, 2026 at 5:48 pm

    The thing that springs to mind is the Visitor design pattern (though it’s probably not applicable in the strictest sense). If you defined an interface that embodied all the buttons on your toolbar and then implemented a class for each document type that would work fine as Daniel suggests. Outline code would be

    public interface IToolbarHandler {
      void ButtonOne;
      void ButtonTwo;
      //etc
    }
    
    public class SpreadsheetToolbarHandler : IToolbarHandler {
       public void ButtonOne {
          //Do Some action
       }
       public void ButtonTwo {
          //Do Some action
       }
    }
    
    public class DocumentToolbarHandler : IToolbarHandler {
       public void ButtonOne {
          //Do Some action
       }
       public void ButtonTwo {
          //Do Some action
       }
    }
    

    Then simply have a form level variable which is of type IToolbarHandler and set to an instance of the relevant handler for the document currently being viewed. Then your toolbar event handlers simply invoke the relevant method of that variable.

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

Sidebar

Related Questions

I have what is essentially a shopping cart that needs to have two separate
I have two variables. weekStartDate and startDate. they both hold essentially the same timestamp:
I currently have my project running two separate threads (one for MFC operations, like
I have two sites running essentially the same codebase, with only slight differences in
Essentially I have two different flat files Credit & Account with different record structures.
I have a generic class that essentially extends a linq class. This means that
Say I have two separate browser windows open: function onload() { setTimeout(dosomething, 2000); }
Ill try to keep this simple and to the point. Essentially I have a
Have two folders with approx. 150 java property files. In a shell script, how
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two

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.