ITを駆使する猫エンジニア

 こんにちは、童爺です。

 

 ユーザ新規作成画面のデザインと県名選択部分だけ出来たので、報告します。

 

 まず以下の画面で、新規ユーザ作成ボタンをクリックします。

 

 そうすると新規ユーザ作成画面が表示されます。

 

 県ComboBoxをクリックします。

 

 SQLiteのmms.sqlite3データベースから県テーブルの内容を読み込んで、リストアップします。


 ここ迄。

 

 デザインは以下。

 

 コードは、以下。

 

unit NewUserAppend;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
  FMX.Controls.Presentation, FMX.Layouts, FMX.ListBox, FMX.Edit,
  FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf,
  FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async,
  FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
  FireDAC.Stan.ExprFuncs, FireDAC.FMXUI.Wait, FireDAC.Stan.Param, FireDAC.DatS,
  FireDAC.DApt.Intf, FireDAC.Comp.Client, Data.DB, FireDAC.DApt, System.Rtti,
  System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.EngExt,
  Fmx.Bind.DBEngExt, Data.Bind.Components, FireDAC.Comp.DataSet,
  Data.Bind.DBScope, Data.Bind.Controls, Fmx.Bind.Navigator;

type
  TForm_NewUserAppend = class(TForm)
    Layout_Header: TLayout;
    Label_Cation: TLabel;
    Layout_ID: TLayout;
    Layout_LastName: TLayout;
    Layout_FirstName: TLayout;
    Layout_Password: TLayout;
    Layout_RePassword: TLayout;
    Layout_Birthday: TLayout;
    Layout_Ken: TLayout;
    Layout_Footer: TLayout;
    Label_ID: TLabel;
    Label_LastName: TLabel;
    Label_FirstName: TLabel;
    Label_Password: TLabel;
    Label_RePassword: TLabel;
    Label_Birthday: TLabel;
    Label_Ken: TLabel;
    Layout_BtnFooter: TLayout;
    Button_Resist: TButton;
    Button_Cancel: TButton;
    Edit_ID: TEdit;
    Edit_LastName: TEdit;
    Edit_FirstName: TEdit;
    Edit_Password: TEdit;
    Edit_RePassword: TEdit;
    Edit_Birthday: TEdit;
    ComboBox_Ken: TComboBox;
    Layout_UserName: TLayout;
    Label_UserName: TLabel;
    Edit_UserName: TEdit;
    FDConnection_NewUSerAppend: TFDConnection;
    BindSourceken: TBindSourceDB;
    FDTableken: TFDTable;
    BindingsListKen: TBindingsList;
    LinkFillControlToField1: TLinkFillControlToField;
    procedure Button_CancelClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure Button_ResistClick(Sender: TObject);
  private
    { private 宣言 }
  public
    { public 宣言 }
  end;

var
  Form_NewUserAppend: TForm_NewUserAppend;

implementation

{$R *.fmx}

procedure TForm_NewUserAppend.Button_CancelClick(Sender: TObject);
begin
  Close;
end;

procedure TForm_NewUserAppend.Button_ResistClick(Sender: TObject);
begin
//工事中
end;

procedure TForm_NewUserAppend.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  FDTableken.Close;
  FDConnection_NewUSerAppend.Close;
end;

procedure TForm_NewUserAppend.FormCreate(Sender: TObject);
begin
  FDConnection_NewUSerAppend.Open();
  FDTableken.Open();
end;

end.

 

 FMXのTComboBoxへの県名リストは、絶対コーディングしなくても自動でできるはずだ!

 

 と信じて試行錯誤した結果、LiveBinding デザイナで編集して追加出来ました。

 

 以下、LiveBinding デザイナの内容。

 

 とまあ、こんな感じで。

 

 執念ですな。

 

 ここにたどり着くまで、延べ5時間は係りました。

 

 ググっても出てこないし。

 

 Try&Errorで試行錯誤を繰り返し、やっと出来ました。

 

 あー、後は登録ボタンを押下された時の処理を書けば、新規ユーザ作成フォームは出来上がりです。

 

 疲れました。

 

 今日は、ここ迄。

 


 

 それではまた。

 

 でわでわ。