Changeset 67 for trunk/Application/UWebObjects.pas
- Timestamp:
- Dec 25, 2011, 9:40:28 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UWebObjects.pas
r66 r67 22 22 FInputType: TQueryFormItemType; 23 23 FItemType: TQueryFormItemType; 24 function GetName: string; 24 25 procedure SetItemType(const AValue: TQueryFormItemType); 26 procedure SetName(AValue: string); 25 27 public 26 28 Caption: string; … … 28 30 Hint: string; 29 31 Value: THTMLInput; 32 property Name: string read GetName write SetName; 30 33 property ItemType: TQueryFormItemType read FItemType write SetItemType; 31 34 constructor Create; … … 38 41 Title: string; 39 42 Rows: TListObject; // TListObject<TQueryFormItem> 43 procedure Load(Items: TStringList); 40 44 function AddNewItem: TQueryFormItem; 41 45 constructor Create; … … 44 48 45 49 TQueryAction = class 46 Name: string; 50 Caption: string; 51 Action: string; 47 52 end; 48 53 … … 57 62 function AddNewGroup: TQueryFormGroup; 58 63 function AddNewAction: TQueryAction; 64 procedure Load(Items: TStringList); 59 65 constructor Create; 60 66 destructor Destroy; override; … … 79 85 fitFileSelect: Value.InputType := itFileSelect; 80 86 end; 87 end; 88 89 function TQueryFormItem.GetName: string; 90 begin 91 Result := Value.ItemName; 92 end; 93 94 procedure TQueryFormItem.SetName(AValue: string); 95 begin 96 Value.ItemName := AValue; 81 97 end; 82 98 … … 131 147 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin 132 148 Value := THtmlInput.Create; 133 Value.Assign(TQueryFormItem(Rows[I]).Value);149 THtmlInput(Value).Assign(TQueryFormItem(Rows[I]).Value); 134 150 end; 135 151 end; … … 141 157 Value := THtmlBlock.Create; 142 158 with THtmlInput(THtmlBlock(Value).SubItems.AddNew(THtmlInput.Create)) do begin 143 Value := TQueryAction(Actions[I]). Name;159 Value := TQueryAction(Actions[I]).Caption; 144 160 InputType := itSubmit; 161 ItemName := TQueryAction(Actions[I]).Action; 145 162 end; 146 163 end; … … 160 177 end; 161 178 179 procedure TQueryForm.Load(Items: TStringList); 180 var 181 I: Integer; 182 begin 183 for I := 0 to Groups.Count - 1 do 184 TQueryFormGroup(Groups[I]).Load(Items); 185 end; 186 162 187 constructor TQueryForm.Create; 163 188 begin … … 166 191 Groups := TListObject.Create; 167 192 Method := 'post'; 193 Action.AsString := ''; 168 194 end; 169 195 … … 177 203 { TQueryFormGroup } 178 204 205 procedure TQueryFormGroup.Load(Items: TStringList); 206 var 207 I: Integer; 208 begin 209 for I := 0 to Rows.Count - 1 do 210 with TQueryFormItem(Rows[I]) do begin 211 if Items.IndexOfName(Value.ItemName) <> -1 then 212 Value.Value := Items.Values[Value.ItemName]; 213 end; 214 end; 215 179 216 function TQueryFormGroup.AddNewItem: TQueryFormItem; 180 217 begin
Note:
See TracChangeset
for help on using the changeset viewer.