Changeset 138 for trunk/Application/UWebObjects.pas
- Timestamp:
- Sep 9, 2022, 8:20:25 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UWebObjects.pas
r137 r138 4 4 5 5 uses 6 Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedDictionary, 7 Generics.Collections; 6 Classes, SysUtils, UHtmlClasses, UXmlClasses, Generics.Collections; 8 7 9 8 type … … 42 41 Title: string; 43 42 Rows: TQueryFormItemList; 44 procedure Load(Items: TDictionary StringString);43 procedure Load(Items: TDictionary<string, string>); 45 44 function AddNewItem: TQueryFormItem; 46 45 constructor Create; … … 69 68 function AddNewGroup: TQueryFormGroup; 70 69 function AddNewAction(Caption, Action: string): TQueryAction; 71 procedure Load(Items: TDictionary StringString);70 procedure Load(Items: TDictionary<string, string>); 72 71 constructor Create; 73 72 destructor Destroy; override; … … 84 83 begin 85 84 I := 0; 86 while (I < Count) and ( TQueryFormItem(Items[I]).Value.ItemName <> AValue) do Inc(I);87 if I < Count then Result := TQueryFormItem(Items[I])85 while (I < Count) and (Items[I].Value.ItemName <> AValue) do Inc(I); 86 if I < Count then Result := Items[I] 88 87 else Result := nil; 89 88 end; … … 141 140 Table := THtmlTable.Create; 142 141 Table.ClassId := ClassId; 143 Row := T HtmlRow(Table.Rows.AddNew(THtmlRow.Create));144 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create))do begin142 Row := Table.Rows.AddRow; 143 with Row.Cells.AddCell do begin 145 144 ColSpan := 2; 146 145 Value := THtmlString.Create; … … 149 148 with Table do 150 149 for G := 0 to Groups.Count - 1 do 151 with TQueryFormGroup(Groups[G])do begin150 with Groups[G] do begin 152 151 if Title <> '' then begin 153 Row := T HtmlRow(Table.Rows.AddNew(THtmlRow.Create));154 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create))do begin152 Row := Table.Rows.AddRow; 153 with Row.Cells.AddCell do begin 155 154 ColSpan := 2; 156 155 Value := THtmlString.Create; … … 159 158 end; 160 159 for I := 0 to Rows.Count - 1 do 161 with TQueryFormItem(Rows[I])do begin162 Row := T HtmlRow(Table.Rows.AddNew(THtmlRow.Create));163 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create))do begin160 with Rows[I] do begin 161 Row := Table.Rows.AddRow; 162 with Row.Cells.AddCell do begin 164 163 Value := THtmlString.Create; 165 164 THtmlString(Value).Text := Caption; … … 167 166 THtmlString(Value).Text := THtmlString(Value).Text + ': '; 168 167 end; 169 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create))do begin168 with Row.Cells.AddCell do begin 170 169 Value := THtmlInput.Create; 171 THtmlInput(Value).Assign( TQueryFormItem(Rows[I]).Value);170 THtmlInput(Value).Assign(Rows[I].Value); 172 171 end; 173 172 end; 174 173 end; 175 Row := T HtmlRow(Table.Rows.AddNew(THtmlRow.Create));176 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create))do begin174 Row := Table.Rows.AddRow; 175 with Row.Cells.AddCell do begin 177 176 ColSpan := 2; 178 177 Value := THtmlBlock.Create; 179 178 for I := 0 to Actions.Count - 1 do 180 with THtml Input(THtmlBlock(Value).SubItems.AddNew(THtmlInput.Create))do begin181 Value := TQueryAction(Actions[I]).Caption;179 with THtmlBlock(Value).SubItems.AddInput do begin 180 Value := Actions[I].Caption; 182 181 InputType := itSubmit; 183 ItemName := TQueryAction(Actions[I]).Action;182 ItemName := Actions[I].Action; 184 183 end; 185 184 end; … … 203 202 end; 204 203 205 procedure TQueryForm.Load(Items: TDictionary StringString);204 procedure TQueryForm.Load(Items: TDictionary<string, string>); 206 205 var 207 206 I: Integer; 208 207 begin 209 208 for I := 0 to Groups.Count - 1 do 210 TQueryFormGroup(Groups[I]).Load(Items);209 Groups[I].Load(Items); 211 210 end; 212 211 … … 229 228 { TQueryFormGroup } 230 229 231 procedure TQueryFormGroup.Load(Items: TDictionaryStringString); 232 var 233 I: Integer; 230 procedure TQueryFormGroup.Load(Items: TDictionary<string, string>); 231 var 232 I: Integer; 233 Item: string; 234 234 begin 235 235 for I := 0 to Rows.Count - 1 do 236 with TQueryFormItem(Rows[I])do begin237 if Items. SearchKey(Value.ItemName) <> -1then238 Value.Value := Item s.Values[Value.ItemName];236 with Rows[I] do begin 237 if Items.TryGetValue(Value.ItemName, Item) then 238 Value.Value := Item; 239 239 end; 240 240 end;
Note:
See TracChangeset
for help on using the changeset viewer.