Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Spin Buttons to Combobox (league table)

Status
Not open for further replies.

ckairinos

Programmer
Feb 14, 2008
3
GB
Hi im relativley new to turbo delphi and im doing an apprenticeship with a guy who runs his own programming company. I have been set the task of making a soccer league table using delphi and somehow need to connect the spin buttons so that when one team scores more goals than another that team will be given 3 points and for it to be displayed in my TadStringGrid. Would i have to link the spin buttons to the ComboBox or just connect them to the StringGrid??

Any help would be much appreciated!

Thanks. ckairnios.
 
So what are you trying to do exactly?

Two teams in soccer, you're using a combobox (to represent the team) and a spinedit (to represent the score) for each one? And you're wanting to update a StringGrid to represent the total standings for the soccer league?

You would probably do very well to simply put a button on the form to initiate the update.
 
Yeah i kinda understand iv tried to uplaoad an image of the project but it wont come up? Can i mail you an image if its possible maybe it owuld help u uinderstand mroe?
Thanks for your response Glenn i appreciate it!
 
 http://www.freeimagehosting.net
Click here to view ckairinos' image

It looks like in either your scan or update button you would do processing against the combobox and spinedit controls from top to bottom and update your string grid accordingly.

the basic idea:

1) If SpinEdit1 > SpinEdit2 then Home Team won.
If SpinEdit1 < SpinEdit2 then Visiting Team won.
if SpinEdit1 = SpinEdit2 then Deal with tie.
2) Look up winning team in StringGrid & add 3 points to it.

What specific part are you having trouble with doing?
 
Getting the scan button to check that no teams are duplicated mainly! Then about 100 other things lol but that would be a start thanks alot Glenn.
 
Getting the scan button to check that no teams are duplicated mainly!

TStringList would help on this one tremendously. Load the list (it works like loading a TMemo), then set sorted to true, then go through the strings. Any duplicates will be next to each other.

Code:
var
  a: TStringList;
begin
  a := TStringList.Create;
  try
    A.Clear;
    A.Sorted := false;
    a.capacity := { number of strings we expect }
    { load the list here }
    a.sorted := true;
    { do duplicate processing here }
  finally
    a.Free;
  end;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top