Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

making a GUI

Posted on 1998-02-18
1
Medium Priority
?
200 Views
Last Modified: 2010-04-16
I am trying to figure out the correct method to tie my GUI to the main program.  So far all I have is a GUI class that creates all the components.  Now I am trying to figure out the proper way to link the GUI to the main program.  I assume there is someway to create an instance of the GUI which will call methods in the class that instantiated it when an event is generated by the GUI, or something to
that effect.  Most of the examples I have seem seem to tie the GUI to the class that is using it, which to me seems like bad programming practice.  I should be able to let any class use the GUI and not require any changes to the GUI?


Most of the examples I have found seem to be very simple and just lump the functionality of the program and the GUI into a single class.

Would it be possible to give a simple example of how this is done?
0
Comment
Question by:micah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 1233138
Well, I think you are right in a sense that making a GUI and making the program functionality should be separated.  The problem is that it causes extra overhead since you must establish some sort of protocol and communication method between the GUI class and the main program.  An example of this in the Windows programming world would be OLE/COM where you can completely separate different functions and tie them together via the COM protocol.  It's very clean and portable but there is overhead in Windows for making it all work together.

As far as your system, if you really want to separate the GUI and main program, you could implement them as a client/server setup and have the two talk some protocol you define through some link.  For example, you could have the main program setup a listing Socket object and wait for incoming commands from the GUI.  The GUI would open a Socket to the main program and send/receive data based on the users input and feedback from the main program.  An advantage to this approach would be that the GUI and main wouldn't even have to run on the same computer.  The main drawback (except for added coding complexity) would be the overhead of a "network" linkup between the two processes.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question