31 XE3 quick videos in 31 days - Oct25 - Adding Actions and Gestures to the FireFlow application

Posted by on in Blogs
This video shows you how to quickly add actions and gestures to the RAD Studio XE3 FireMonkey 2 FireFlow sample application (an adaption of the Cover Flow 3D animated UI found in iTunes, Mac Finder and other applications).  Four actions (First, Last, Left and Right) are created and connected to four standard gestures (Left, Right, ChevronLeft, ChevronRight).  The actions change the TrackBar value which triggers the already defined TrackBar OnChange Event Handler to animate the UI. The FireFlow sample application first appeared in RAD Studio XE2 using FireMonkey 1.  The video shows how to add the actions and gestures to the Delphi FireFlow version.  Below you will find the actions code to add to the FireFlow Delphi XE3 and C++Builder XE3 versions.

The Delphi code for the four actions is included below:
procedure TFrmMain.FirstActionExecute(Sender: TObject);
begin
TrackBar1.Value := 0;
end;

procedure TFrmMain.LastActionExecute(Sender: TObject);
begin
TrackBar1.Value := CoverFlow.ChildrenCount-1;
end;

procedure TFrmMain.LeftActionExecute(Sender: TObject);
begin
if TrackBar1.Value > 0 then
TrackBar1.Value := TrackBar1.Value - 1;
end;

procedure TFrmMain.RightActionExecute(Sender: TObject);
begin
if TrackBar1.Value < CoverFlow.ChildrenCount-1 then
TrackBar1.Value := TrackBar1.Value + 1;
end;

The existing Delphi TrackBar OnChange event handler is:
procedure TFrmMain.TrackBar1Change(Sender: TObject);
begin
SetCoverIndex(Round(TrackBar1.Value));
end;

The C++Builder code for the four actions is included below:
void __fastcall TFrmMain::FirstActionExecute(TObject *Sender)
{
TrackBar1->Value = 0;
}

void __fastcall TFrmMain::LastActionExecute(TObject *Sender)
{
TrackBar1->Value = Coverflow->ChildrenCount-1;
}

void __fastcall TFrmMain::LeftActionExecute(TObject *Sender)
{
if (TrackBar1->Value > 0) {
TrackBar1->Value--;
}
}

void __fastcall TFrmMain::RightActionExecute(TObject *Sender)
{
if (TrackBar1->Value < Coverflow->ChildrenCount-1) {
TrackBar1->Value++;
}
}

The existing C++Builder TrackBar OnChange event handler is:
void __fastcall TFrmMain::TrackBar1Change(TObject *Sender)
{
SetCoverIndex(int(TrackBar1->Value));
}

You can find additional information about the new FireMonkey 2 Actions and Gestures support in the following DocWiki articles:

October 25 - Adding Actions and Gestures to the FireMonkey FireFlow application

Download: http://cc.embarcadero.com/item/29096

Watch on YouTube: http://www.youtube.com/watch?v=0GmFgQsrYAA

Duration: 4 minutes and 40 seconds

Size: 36.4mb

Format: MP4

Download the original and modified FireFlow Delphi and C++ projects: http://cc.embarcadero.com/item/29097

For additional product information go to http://www.embarcadero.com/products/rad-studio
About
Gold User, Rank: 1, Points: 2466
David Intersimone (known to many as David I.) is a passionate and innovative software industry veteran-often referred to as a developer icon-who extols and educates the world on Embarcadero developer tools. He shares his visions as an active member of the industry speaking circuit and is tapped as an expert source by the media. He is a long-standing champion of architects, developers and database professionals and works to ensure that their needs are folded into Embarcadero's strategic product plans. David holds a bachelor's degree in computer science from California Polytechnic State University at San Luis Obispo, California.

Comments