• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Time tracking for sportsevent

Hi,

I need to build an application that will register all participants of a sportsevent race (swimming or running a fixed distance). Every participant will have a registrationnumber to identify the person.
At the finish the registrationnumber of the finished participant will be registrered in the application and the endtime will be set.

Based on the number of participants, buttons will be created and placed on a form showing the registrationnumber. Clicking the individual button will set the endtime for the participant.
The form must be organised in such a way that alle buttons will be presented in increasing registrationnumber (1 -> 999).
The form has a vertical scrollbar to access currently non visible buttons.
Clicking a button will make it invisible on the from, so only remaining buttons (of non-finished participants) are available. Remaining buttons will be reorganised, so the buttons are presented as compact as possible (less scrolling).

What would be a good approach to accomplish this?
In stead of buttons any other approach is welcome (maybe a grid).

Maybe there is also some free open source that already has this functionality?
0
Stef Merlijn
Asked:
Stef Merlijn
  • 4
  • 2
1 Solution
 
Geert GruwezOracle dbaCommented:
can multiple people work with this system ?

when 100 or more competitors go to inscribe, will there be 1 or more people to register them ?

same for noting down the arrivals
arrivals can be very intense ... a mass of 100 people arriving for example
when registering, you need to be able to enter the exact time, or afterwards alter it.
scanning system ?

i've never actually written this for a competition, but i know there is a limit for people waiting on a system
0
 
Stef MerlijnDeveloperAuthor Commented:
It's gonna be a stand-alone single user system.

I'm aware of the complecity, but the idea is to make it as basic as can be.
Scanning with chips would be great in the furute, but customer has no budget for it. The race takes place once a year.
0
 
livestuffCommented:
This can easily be done with buttons.

Just as a quick demo, drop a TScrollbox on the form, set its align to alClient.

Then in the form's onActivate event you can Clear all buttons from Scrollbox and then recreate them, assigning the same event to them. Then use the one event to do the processing.  The trick here is knowing what button was clicked. So when you create the buttons, set the tag to the number of button

Let me write you up an example



unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm2 = class(TForm)
    ScrollBox1: TScrollBox;
    procedure ButtonClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure ClearScrollbox;
    procedure CreateButtons;
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure  TForm2.ButtonClick(Sender: TObject);
begin
 ShowMessage(TButton(Sender).Caption);
 case TButton(Sender).tag of
  0: begin end;
  1: begin end;
  {etc}
 end;
end;

procedure TForm2.FormActivate(Sender: TObject);
begin
 ClearScrollBox;
 CreateButtons;
end;


procedure TForm2.FormResize(Sender: TObject);
begin
 ClearScrollBox;
 CreateButtons;
end;

procedure TForm2.ClearScrollbox;
var
 I: Integer;
begin
 for I:= Scrollbox1.ControlCount-1 downto 0 do
  if Scrollbox1.Controls[I] is TButton then
  begin
   TButton(Scrollbox1.Controls[I]).Free;
  end;
end;


procedure TForm2.CreateButtons;
var
 I, Pad, x,y: Integer;
 btn: TButton;
begin
// ClearScrollBox;
 pad:= 5;
 x:= 5;
 y:= 5;
 for I:= 0 to 99 do  //100 buttons
 begin
  btn:= TButton.Create(Scrollbox1);
  btn.Parent:= Scrollbox1;
  btn.Width:= 25;
  btn.Height:= 25;
  btn.Left:= x;
  btn.Top:= y;
  btn.Tag:= I;
  btn.OnClick:=  ButtonClick;
  btn.Caption:= intToStr(I);
  x:= x + btn.Width + Pad;
  if X >= Scrollbox1.width then
  begin
   X:= 5; Y:= Y + btn.Height + Pad;
  end;
 end;
end;

end.

Open in new window




There are a number of things you could do to impove upon this. Make a setting sdialog box to change the width and height of buttons, etc.

You can also lock screen befoe and clearling and drawing to prevent the flickering event. But I think this will get you going


Are you using a database with the name ans ID as the participants number? If so, you could set the endtime int he database at the buttons onclick event as well

procedure  TForm2.ButtonClick(Sender: TObject);
begin
  //Set endtime here and store it against the users number in database
end;
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Stef MerlijnDeveloperAuthor Commented:
This is very promissing.
One thing I need to solve with this is the following:
The last button in a row is often partly shown on screen.

How to make sure the buttons will always be shown fully on screen? Otherwise the button will start a new row.
0
 
livestuffCommented:
Just play around with the create buttons routine. Sorry, I didn't save the code on my end. Send me a screenshot of what it is doing. I think particularly, you  should try changing the If then statement

if X >= Scrollbox1.width then

Open in new window


try something like

if X >= Scrollbox1.width - Pad then

Open in new window

0
 
Stef MerlijnDeveloperAuthor Commented:
This works fine:
if X >= Scrollbox1.width - 50 {button.width} then
0
 
Stef MerlijnDeveloperAuthor Commented:
Thank you!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now