Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A question about GUI

 
Shen Lin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a simple Client/Server program. It is able to send messages between two computers. Now I want to build user interface for this program. There is a "Apply" button on the interface and it will pop out a small window with two text fields for typing in socket number and server's host name. The related code and my problem is described below:

Thanks very much.
[ edited to remove big long unbroken line within code block -ds ]
[ March 17, 2003: Message edited by: Dirk Schreckmann ]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a bit confused. You already have a gui that has an Apply button. Why is the input field not on THAT GUI? Then when you hit the Apply you would do the processing.
However, in this scenario, if this is the code in the listener for the original Apply button, and it is supposed to present a pop-up with input fileds, then the code for what to do after the text fields are filled in should not be in here.
You need to have an "OK" button or something on your pop-up dialog, and have a separate listener for THAT which holds the logic on how to handle the input values.
The important thing is that you separate the place where you create your GUI components, and the logic for what happens when your button is pressed. Don't create GUI components inside the listener logic.
[ March 17, 2003: Message edited by: Cindy Glass ]
 
Shen Lin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much. I fixed it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic