Changeset 10 for trunk/Forms


Ignore:
Timestamp:
Nov 14, 2012, 10:12:02 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Zobrazení ovládacího prvku pro určování odkazů do jiných tabulek.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        44heaptrclog.trc
        55lib
         6Dochazka
  • trunk/Forms/UFormEdit.lfm

    r9 r10  
    3939  object PanelControls: TPanel
    4040    Left = 4
    41     Height = 285
     41    Height = 473
    4242    Top = 4
    4343    Width = 530
  • trunk/Forms/UFormEdit.pas

    r9 r10  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Buttons, ExtCtrls, Spin, SpecializedList, SpecializedDictionary, UDataView,
    10   USqlDatabase;
     9  Buttons, ExtCtrls, Spin, ComCtrls, EditBtn, SpecializedList,
     10  SpecializedDictionary, UDataView, USqlDatabase;
    1111
    1212type
    13   TControlType = (ctLabel, ctCheckBox, ctEdit, ctMemo, ctDate, ctTime,
     13  TControlType = (ctLabel, ctCheckBox, ctEdit, ctMemo, ctDate, ctTime, ctDateTime,
    1414    ctComboBox, ctSpinEdit, ctReference);
    1515
     
    2121    ControlType: TControlType;
    2222    TitlePlacement: TAlign;
     23    ReferencedTable: string;
    2324  end;
    2425
     
    5051    procedure FormCreate(Sender: TObject);
    5152    procedure FormDestroy(Sender: TObject);
     53    procedure SpeedButton1Click(Sender: TObject);
    5254  private
    5355    FView: TDataViewForm;
     
    6870
    6971uses
    70   UCore;
     72  UCore, UFormMain;
    7173
    7274{ TDataViewForm }
     
    112114  Values.Free;
    113115  RuntimeControls.Free;
     116end;
     117
     118procedure TFormEdit.SpeedButton1Click(Sender: TObject);
     119begin
     120
    114121end;
    115122
     
    233240       (Rect.Right - Rect.Left) * W, (Rect.Bottom - Rect.Top) * H);
    234241      NewControl.Show;
     242    end else
     243    if ControlType = ctDate then begin
     244      NewControl := TDateEdit.Create(Self);
     245      NewControl.Parent := PanelControls;
     246      TDateEdit(NewControl).Date := MySQLStrToFloat(Values.Values[Name]);
     247      NewControl.SetBounds(Rect.Left * W, Rect.Top * H,
     248       (Rect.Right - Rect.Left) * W - 28, (Rect.Bottom - Rect.Top) * H);
     249      NewControl.Show;
     250    end else
     251    if ControlType = ctTime then begin
     252      NewControl := TEdit.Create(Self);
     253      NewControl.Parent := PanelControls;
     254      TEdit(NewControl).Text := TimeToStr(MySQLStrToFloat(Values.Values[Name]));
     255      NewControl.SetBounds(Rect.Left * W, Rect.Top * H,
     256       (Rect.Right - Rect.Left) * W, (Rect.Bottom - Rect.Top) * H);
     257      NewControl.Show;
     258    end else
     259    if ControlType = ctReference then begin
     260      NewControl := TEdit.Create(Self);
     261      NewControl.Parent := PanelControls;
     262      TEdit(NewControl).Text := Values.Values[Name];
     263      NewControl.SetBounds(Rect.Left * W, Rect.Top * H,
     264       (Rect.Right - Rect.Left) * W - 28, (Rect.Bottom - Rect.Top) * H);
     265      NewControl.Show;
     266      NewControl := TBitBtn.Create(Self);
     267      NewControl.Parent := PanelControls;
     268      TBitBtn(NewControl).Caption := '';
     269      NewControl.SetBounds(Rect.Right * W - 28, Rect.Top * H, 24, 24);
     270      FormMain.ImageList1.GetBitmap(4, TBitBtn(NewControl).Glyph);
     271      NewControl.Show;
    235272    end;
    236273  end;
  • trunk/Forms/UFormMain.lfm

    r8 r10  
    55  Width = 733
    66  Caption = 'Attendance'
    7   ClientHeight = 436
     7  ClientHeight = 430
    88  ClientWidth = 733
    99  Menu = MainMenu1
     
    1616  object StatusBar1: TStatusBar
    1717    Left = 0
    18     Height = 20
    19     Top = 416
     18    Height = 21
     19    Top = 409
    2020    Width = 733
    2121    Panels = <>
     
    3939  object PageControl1: TPageControl
    4040    Left = 0
    41     Height = 390
     41    Height = 383
    4242    Top = 26
    4343    Width = 733
  • trunk/Forms/UFormMain.pas

    r9 r10  
    6767  STerminal = 'Terminal';
    6868  SUser = 'User';
     69  SDate = 'Date';
    6970  STime = 'Time';
    7071  SOperation = 'Operation';
     
    191192    with Items do begin
    192193      AddItem(STime, 'Time', ctDate, True, Bounds(0, 0, 1, 1));
    193       AddItem(SUser, 'User', ctReference, True, Bounds(3, 0, 1, 1));
    194       AddItem(SOperation, 'Operation', ctReference, True, Bounds(0, 1, 1, 1));
    195       AddItem(STerminal, 'Terminal', ctReference, True, Bounds(3, 1, 1, 1));
     194      with AddItem(SUser, 'User', ctReference, True, Bounds(3, 0, 1, 1)) do
     195        ReferencedTable := 'User';
     196      with AddItem(SOperation, 'Operation', ctReference, True, Bounds(0, 1, 1, 1)) do
     197        ReferencedTable := 'User';
     198      with AddItem(STerminal, 'Terminal', ctReference, True, Bounds(3, 1, 1, 1)) do
     199        ReferencedTable := 'User';
    196200    end;
    197201    Name := 'Passage';
     
    204208  with NewDataView do begin
    205209    with Columns do begin
     210      AddItem(SDate, 'Date', True, 80);
    206211      AddItem(SUser, 'User', True, 80);
    207212      AddItem(STimeFrom, 'TimeFrom', True, 120);
     
    213218  end;
    214219  DataViewLists.Add(NewDataView);
     220  NewDataView2 := TDataViewForm.Create;
     221  with NewDataView2 do begin
     222    with Items do begin
     223      AddItem(SUser, 'User', ctReference, True, Bounds(1, 0, 1, 1));
     224      AddItem(SDate, 'Date', ctDate, True, Bounds(3, 0, 1, 1));
     225      AddItem(STimeFrom, 'TimeFrom', ctTime, True, Bounds(1, 1, 1, 1));
     226      AddItem(STimeTo, 'TimeTo', ctTime, True, Bounds(3, 1, 1, 1));
     227    end;
     228    Name := 'Attendance';
     229    Caption := SAttendance;
     230    ImageIndex := 14;
     231  end;
     232  DataViewForms.Add(NewDataView2);
    215233
    216234  NewDataView := TDataViewList.Create;
Note: See TracChangeset for help on using the changeset viewer.