Solved

Time tracking for sportsevent

Posted on 2013-11-18
7
249 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 37

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

724 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