Solved

Time tracking for sportsevent

Posted on 2013-11-18
7
244 Views
Last Modified: 2013-11-20
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
Comment
Question by:Delphiwizard
  • 4
  • 2
7 Comments
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 39658495
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
 

Author Comment

by:Delphiwizard
ID: 39658636
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
 
LVL 1

Accepted Solution

by:
livestuff earned 500 total points
ID: 39663796
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Delphiwizard
ID: 39663993
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
 
LVL 1

Expert Comment

by:livestuff
ID: 39664009
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
 

Author Comment

by:Delphiwizard
ID: 39664166
This works fine:
if X >= Scrollbox1.width - 50 {button.width} then
0
 

Author Closing Comment

by:Delphiwizard
ID: 39664167
Thank you!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now