Procedure

SetUserColumns

Module

rMisc

Last Modified

7/15/2014 3:26:44 PM

Scope

Interfaced

Declaration

procedure SetUserColumns(var AControl: TControl);

Calls Hierarchy


SetUserColumns
 └LoadSizes

Called-By Hierarchy


                   SetUserColumns
     TfrmFrame.LoadSizesForUser┘ 
TfrmFrame.LoadUserPreferences┘   
       TfrmFrame.UMInitiate┘     

Calls

Name Declaration Comments
LoadSizes procedure LoadSizes; -

Called-By

Name Declaration Comments
TfrmFrame.LoadSizesForUser procedure LoadSizesForUser; -


Source

326   procedure SetUserColumns(var AControl: TControl);
327   var
328     x: string;
329     i, AWidth: Integer;
330     couldSet: boolean;
331   begin
332     couldSet := False;
333     if uColumns = nil then LoadSizes;
334     x := AControl.Name;
335     if not (AControl is TForm) and (Assigned(AControl.Owner)) then x := AControl.Owner.Name + '.' + x;
336     if AnsiCompareText(x,'frmOrders.hdrOrders')=0 then
337       couldSet := True;
338     x := uColumns.Values[x];
339     if AControl is THeaderControl then with THeaderControl(AControl) do
340       for i := 0 to Sections.Count - 1 do
341       begin
342         //Make sure all of the colmumns fit, even if it means scrunching the last ones.
343         AWidth := LowerOf(StrToIntDef(Piece(x, ',', i + 1), 0), HigherOf(ClientWidth - (Sections.Count - i)*5 - Sections.Items[i].Left, 5));
344         if AWidth > 0 then Sections.Items[i].Width := AWidth;
345         if couldSet and (i=0) and (AWidth>0) then
346           frmOrders.EvtColWidth := AWidth;
347       end;
348     if AControl is TCustomGrid then {nothing for now};
349   end;