unit MainFrmFinanceiro;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.MultiView, FMX.Objects, FMX.TabControl,
  FMX.StdCtrls, FMX.Layouts, FMX.ListView.Types, FMX.ListView, FMX.ExtCtrls, FMX.Ani, FMX.Gestures, FMX.ListBox,
  FMX.DateTimeCtrls, FMX.Edit, FMX.MultiView.Types, FMX.Colors,  FMX.MultiView.CustomPresentation,
  FMX.EditBox, FMX.NumberBox, FMX.Controls.Presentation,
  FMX.ListView.Appearances, FMX.ListView.Adapters.Base, Fmx.Bind.GenData,
  Data.Bind.GenData, Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti,
  System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Components,
  Data.Bind.ObjectScope;

type
  TFormMainFinanceiro = class(TForm)
    MultiView1: TMultiView;
    ToolBar1: TToolBar;
    MasterButton: TSpeedButton;
    ToolBar2: TToolBar;
    Label1: TLabel;
    Label2: TLabel;
    ListBox1: TListBox;
    ListBoxItemCompraTipoRequisicao: TListBoxItem;
    ListBoxItem2: TListBoxItem;
    ListBoxItem3: TListBoxItem;
    ListBoxItem4: TListBoxItem;
    ListBoxItem5: TListBoxItem;
    DetailPanel: TPanel;
    TabControl1: TTabControl;
    TabItem3: TTabItem;
    VaporStyleBook: TStyleBook;
    PrototypeBindSource1: TPrototypeBindSource;
    BindingsList1: TBindingsList;
    LinkFillControlToField1: TLinkFillControlToField;
    ListBoxGroupHeader1: TListBoxGroupHeader;
    ListBoxItem19: TListBoxItem;
    Panel1: TPanel;
    ListBoxItem1: TListBoxItem;
    ListBoxItem6: TListBoxItem;
    procedure ListBox1ItemClick(const Sender: TCustomListBox; const Item: TListBoxItem);
    procedure FormCreate(Sender: TObject);
    procedure ListBoxItemCompraTipoRequisicaoClick(Sender: TObject);
    procedure ListBoxItem2Click(Sender: TObject);
  public
    { Public declarations }
  end;

var
  FormMainFinanceiro: TFormMainFinanceiro;
  FrameAtual: TFrame;

implementation

uses
  FMX.MultiView.Presentations, UCompraTipoRequisicao, UCompraRequisicaoM;

{$R *.fmx}

procedure TFormMainFinanceiro.FormCreate(Sender: TObject);
begin
  MultiView1.CustomPresentationClass := TMultiViewAlertPresentation;
end;

procedure TFormMainFinanceiro.ListBox1ItemClick(const Sender: TCustomListBox; const Item: TListBoxItem);
begin
  Item.IsSelected := False;
  MultiView1.HideMaster;
end;

procedure TFormMainFinanceiro.ListBoxItem2Click(Sender: TObject);
begin
  if Assigned(FrameAtual) then
    FreeAndNil(FrameAtual);
  FrameAtual := TFCompraRequisicaoM.Create(Panel1);

  with FrameAtual do
  begin
    Parent := Panel1;
    Align := FMX.Types.TAlignLayout.Client;
  end;
  TabItem3.Text := ListBoxItem2.Text;
end;

procedure TFormMainFinanceiro.ListBoxItemCompraTipoRequisicaoClick(Sender: TObject);
begin
  if Assigned(FrameAtual) then
    FreeAndNil(FrameAtual);
  FrameAtual := TFCompraTipoRequisicao.Create(Panel1);

  with FrameAtual do
  begin
    Parent := Panel1;
    Align := FMX.Types.TAlignLayout.Client;
  end;
  TabItem3.Text := ListBoxItemCompraTipoRequisicao.Text;
end;

end.
