Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with saving buttons?  RSS feed

 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am working on a project developing a software. the software should have the ablility to create new buttons

my application can create new objects like buttons and so on. but I can not save the status of the application and when I restart the application then the buttons that were creat are lost an I have got to recreat and again the problem

Please can any one help me out with this problem.

many thanks
Farhad
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Farhad,

You're not giving us a lot of detail to work with. Generally though, for something to be saved and then restored in your application, you have to do something in your code to make that happen. You could save a description of the buttons into a properties file, or define an XML format for describing the buttons and save that to a file. You also could serialize the buttons as objects to a file. You could save them to a database. You also have to decide when to save the information. Will you save a button immediately when your user creates it, or will you force the user to save the status before the buttons are saved?

A lot of changes have been made to software development processes over the years but the basic steps are the same:

1. Gather requirements
2. Design a solution
3. Code
4. Test

It seems to me, you're jumping straight into step 3, which admittedly is what a lot of developers do. Some time nailing down step 1 though would really help.
 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your replay. it was really helpful just let me explain my main problem.

Indeed I am a new programmer and I don't have much experience. I have got a project for my final year. I am just trying to develop an EPOS system. the system should have an internal database for user, stock and financial management. I have decided to do the database with JAVA DB

In addition the system will be able to create new buttons. for example if you want to install the system in a restuartant. you need to define your Menu. I want to give the users the ability to create new buttons. and define the properties of the button.

I know Java language but I am not an expert, I had some small works as my assignments, but I have never worked with bigger projects

My problem is first: I don't know how to start this system and which direction I have to follow. Second I did some with the buttons. you can define and create button and it's totally working but you can not save all the buttons you have created.

I hope it is clear now

Thank you very much for your reply.
I look forward to hear from you
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still not sure I understand. When your users create new buttons, what do the buttons do? Can you give me an example?

In any case, you need to figure out what information you need to define a button. You probably know that already since that's the information you're collecting from the users. It seems you've decided to save this information in a database, so you need to define a button definition table that contains all the information defining the buttons. You also need to decide if you will save each button definition as it is created by a user, or will you save all the buttons on exit, or possibly make the user save them explicitly.

Finally, you need a process for restoring buttons from the data definitions. This shouldn't be much different from allowing users to create the buttons, so you have a leg up there already. Good luck!
 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Charles for your messages and now I got the Idea what to do.

okay let me tell you about the buttons.

the buttons should have the same funtion. assume you install the system in your restuatrant and you have to define your menu. so you define your menu as buttons. when you press a button, it adds that item in orderlist. forexample you press FISH button. Fish buttons adds a fish order to your orderlist.

Yea as you said, I have got to have a table for buttons properties and I need to save all infromation about the buttons in a database. and the methods for all buttons should be the same (adding order to a orderlist).

the problem is with saving buttons.

thank you very much, I hope it could help you understand.

Cheers
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Happy New Year!

OK, I understand your application a bit better now. However I'm still not clear why are you having problems saving the buttons? You've decided that you want to store the buttons as data in a database table. That's fine, although that's just one of many ways you could save it. Are you having trouble defining the data structure, or with creating the table, or with writing to it?
 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Happy New Year Charles

Our communication was really helpful,

Yea my problems was, I didn't know. how to store the button and where?

now, I got my answer, To store the objects (Buttons) in to a database.

But, I don't know how to do it

any way thank you very much for everything, I appreciate your help. I need to do some more research to find out.
If you could help me, to go further, I would appreciate your help, as you already did.

Cheers

 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good, I'm glad you're on your way! Another way to save the data would be in a file on the file system. I'd suggest creating an XML format for defining buttons and maybe button groups. Java has very good support for creating and parsing XML. That might be simpler than learning how to use a database, but databases have certain advantages as well.
 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for this information.

My application is something like a EPOS system for a restuarant. I need a database as well to store all data such as users, orders, sales, stock .... and so on
I think, it's better to define a table for buttons as well. I would like to know your point of view. still store it in file or database, I should have a database for other data though.

I have another question as well, if you don't mind
I am just thinking to make a on screen keyboard, only latters and numbers. for this application.
In Visual Basic, it is easy, you just define an array of buttons and write code only for one button. and it works for all buttons
for example in calculator, you have number buttons with similar function when you press 2, 5 or ............ it only types that number in textbox

Do we have something like that in JAVA? I mean to fasilatate writing code. I did a calculator in Java, and I wrote code for each individual number button.

for on screen keyboard, it seem a bit time consuming to write code for each button on the screeen

Please tell me to use database or file for storing the buttons? as I don't know how to use either

could you please tell me a specific name or section for these problems that I can search for and refer to books.

Cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!