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:
- FireMonkey Actions - http://docwiki.embarcadero.com/RADStudio/XE3/en/FireMonkey_Actions
- Using Actions in a FireMonkey application - http://docwiki.embarcadero.com/RADStudio/XE3/en/Using_Actions_in_a_FireMonkey_Application
- Implementation of Actions in FireMonkey and VCL - http://docwiki.embarcadero.com/RADStudio/XE3/en/Implementation_of_Actions_in_FireMonkey_and_VCL
- Touch/Gesture Overview - http://docwiki.embarcadero.com/RADStudio/XE3/en/Gesturing_Overview
- Gestures in FireMonkey - http://docwiki.embarcadero.com/RADStudio/XE3/en/Gestures_in_FireMonkey
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
{ 1 } Comments
More good stuff. It’s too bad the 31 days are drawing to a close.
Post a Comment