Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Time tracking for sportsevent

Posted on 2013-11-18
7
Medium Priority
?
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 38

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 2000 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
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.

 

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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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