Topic: adding rows and column on a form

i have 5 rows of changing numbers and 5 columns of changing numbers, i use the script onchange to add the row and it works fine. the problem arises when trying to add the columns. i get erros sainf the on change has already been defined  the scrips is somethinglike this:

procedure CalculateTotal1;
begin
    Score.edit1.Value := Score.edit1.Value + Score.edit1.Value + Score.edit1.Value ;
end;

procedure Score_edit1_OnChange (Sender: string);
begin
    CalculateTotal1;
end;

procedure Score_edit2_OnChange (Sender: string);
begin
    CalculateTotal2;
end;

procedure Score_edit3_OnChange (Sender: string);
begin
    CalculateTotal3;
end;

//the same for the rest of the rows

procedure CalculateColTotal1;
begin
    Score.edit13.Value := Score.edit1.Value + Score.edit5.Value + Score.edit9.Value;
end;

procedure Score_edit1_OnChange (Sender: string);
begin
    CalculateColTotal1;
end;

procedure Score_edit5_OnChange (Sender: string);
begin
    CalculateColTotal1;
end;

procedure Score_edit9_OnChange (Sender: string);
begin
    CalculateColTotal1;
end;

//the same for the rest or the columns

begin
end.
the first error would be edit one is redifined

Re: adding rows and column on a form

What about your procedures CalculateTotal2 and CalculateTotal3?

Re: adding rows and column on a form

i put the comment after the first rows procedures to indicate the text was the same for the rest of the rows.  same goes for the comment after the first column of procedures. solving the problem for the first row/column i think will solve it for the rest of the rows/columns

Re: adding rows and column on a form

Unfortunately I can't understand, about which rows and columns you talk about?
Component TextBox don't have any rows and columns, can you attach a screenshot?

Dmitry.

Re: adding rows and column on a form

the information i was giving wasnt specific to my project. as my pfoject is more complex i was hoping to give enough information to duplicate the problem without having to bother you with my whole thing. it is attached, the problem is with the scoresheet scores. adding the rows and the columns. thank you for your help.

lee

Post's attachments

Attachment icon Billiards.zip 24.57 kb, 447 downloads since 2016-04-11 

Re: adding rows and column on a form

lhimes
I think you have wrong database structure. You can't use TextBoxes to create rows and columns.


Please see this video lesson, how to create relationship "one to many" (One person may have unlimited phone numbers)
https://www.youtube.com/watch?v=bG30pqCrw8k

Dmitry.

Re: adding rows and column on a form

the database structure may e wrong but that is a different problem.i dont think you understand what is going on with the scoresheet. a blank sheet is given to each team in the match. each player in the match plays each player on the other team one time so ther is one square for each score in that players row. the last square is the tota of all of that players scores. the process is repeated for all players. the columns are the rounds of play. adding all of the firs round scores of each player goes in the subtotal square for that round. there is a round for each player so there are that many colums plus a totals column..  each player has a handicap so all of the handicaps are added together for each team. the smallest subtracted from the smallest  and that number goes in the add handicap row for the team that had the smallest handicap. then the subtotals are added to them for the totals. these totas are compare to the other team to determine the winners of the individual round. the totals are added together for each team and compared to determine the overall winner and by how many ppoints. this sheet is then turned into the league manager who enters it into the database.  my goal is to have the totals and subtotals fill in as she is entering the data

Re: adding rows and column on a form

Hello Lee, Dmitry, the World!
Not sure if I'm fully understanding the problem (and I certainly don't know anything about 8-ball or 9-ball!) but it sounded more interesting that what I was doing - LOL! - so thought I'd have a quick go and see how it could work.
If there are a set number of games in a match, I'd certainly have a 'match' table and then a 'games' table to record the scores in each of the games in that match (sorry if my terminology is all wrong).
If you do it that way, you could use a combination of calculated fields (to sum what is, in effect, the rows) and basic tablegrid functionality to sum the columns.
It seemed easier to knock something up rather than talk around it, so attached is a very rough and ready  example of how you could perhaps achieve it.
The script is largely to automate things - the main functionality can be got from standard MVD which keeps it simpler.
I haven't bothered to do anything about calculating the handicaps or looking at your treasury issues - they seem subordinate to the main problem of getting the basic scores logged in.  Also, the data I've put in will make little sense and there is zero validation (checking match dates to season start and end dates etc etc) but that will presumably come later.
Even if I've not understood everything, perhaps it will give you 'food for thought' that enables you to move forward a bit.
Derek.

Post's attachments

Attachment icon mybilliards.zip 354.55 kb, 515 downloads since 2016-04-11 

Re: adding rows and column on a form

it looks really good but the problem is the data still has to be entered thru that scoresheet.  its a nationwide league and that sheet is the standard score sheet used. being new to this, i am going to have to take some time to stud what you are doing but i am guessing i will need to do somethinglike that to do the strange way they figure the handicaps for the individuall players.

lee

Re: adding rows and column on a form

Hi Lee,
Perhaps you could attach an image of the standard scoresheet that is used, with some sample data filled in so we can get a better handle on what it looks like - ideally annotated to show how the handicaps are worked out.
Derek.

Re: adding rows and column on a form

the column of numbers to the left of the names are the individual handicaps.the way they are arrived at follows:  the year is divided into 2 playing sessions of 21 - 24 weeks. for the first two sessions his handicap is the total number of points made divided by the total number of games played.rounded up.. at the beginning of the third session, all of the figures for the first session are dropped and it consists of the second session numbers plus the numbers from the third session as the games are played. at the end of the third session the second is dropped and the fourth and fiveth are used etc  like i said, a strange way of doing it. hope this helps

lee

Post's attachments

Attachment icon Score Sheet.bmp 1.36 mb, 661 downloads since 2016-04-12 

Re: adding rows and column on a form

Hi Lee,
I took a look at your sample score card and mocked up a screen that tries to emulate it, just to prove to myself that it can work!
It's not how you'd typically choose to structure your data nor your forms if you were starting from scratch but I appreciate that you are having to work with the existing score card layout.
A lot of the confusion is because the score card is laid out in a grid (so most people immediately start thinking 'columns' and 'rows') but really what you have is 1 record with a large number of 'edit fields' holding repeating data that just happen to be arranged in a grid format!
Anyway, I've attached a 'mock-up' for you to see how it could work;  the script isn't quite as bad as it looks - there's just a lot of repetition in it and on the form I've used panels as an easy way to keep groups of 'edit fields' together rather than having to re-arrange them one by one! 
The down-side to that is that your 'tab ordering' is sub-ordinate to the panel so when you come to do it for real, you might want to avoid that.
I have just 'made up' a player handicap and held it on the players table but that was simply because I didn't have the time to play around with it;  as you explained it, I understand the handicap calculation and there's probably a couple of ways to tackle it, none of which would be difficult.  I think proving that you can re-create the 'score card' form with it's many edit fields in a 'grid style' and getting it to update as you work on it, is the main thing.
Hope it gives you some ideas and moves you forward a bit.
Derek.

Post's attachments

Attachment icon billiards lhimes.zip 358.58 kb, 530 downloads since 2016-04-16 

Re: adding rows and column on a form

came to checkl lmy response from a few days ago and find it didnt get posted for some reason. you got it perfect. i dont think tab ordering isgoing to be a problem as none of these guys are really data entry people. after a few shees they just want to get the infoin.  the math part i know how to do from basic i just need to figure out how to do it in this environment. this is all new to me so i have to learn as i go along. i found sql lessons on line but i think they go intoa lot more than i need to knw for this. i could use some help on good material as it relates to what i am doing. i want to thank you for all of your help. i really appreciate it. i did urchase mvd. i have never had any software where i could get the support or hep i have needed. you guys are terrific. i hope everyone realizes the time and effort it takes to get the qualityof help you guys provide.thanks again,

lee

Re: adding rows and column on a form

Hi Lee,
Glad the suggestions have helped to move things along a bit.
Any more issues, then just post them and most people are happy to help if they can;  we're all just learning as we go along, same as you.
Derek.