⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wwrcdvw.pas

📁 胜天进销存源码,国产优秀的进销存
💻 PAS
📖 第 1 页 / 共 5 页
字号:
           if curFieldReadonly or curField.calculated then
           begin
              TEdit(EditControl).color:= ReadOnlyColor;
              EditControl.tabStop:= False;
           end;

           if EditControl is TwwDBEdit then
           begin
              if curField is TStringField then  {7/29/97 - Limit length to field size }
                 if curField.editmask='' then // 9/9/02
                    TEdit(EditControl).maxlength:= curField.Size;
           end;

           { 4/27/99 - Memo fields should not be maximized if rvoMaximizeMemoWidth is false }
           TempWidth:= (curFieldDisplayWidth+1) * RecordViewForm.Canvas.TextWidth('0') + 3;
           if not isSingleLineEditControl(EditControl) then
           begin
              if (rvoMaximizeMemoWidth in Options) then
                 TempWidth:= RecordViewForm.width - EditStartOffset - (Margin.RightOffset + FixedEditWidthConst);
           end;

           if EditControl is TwwDBDateTimePicker then
           begin
              TempWidth:=
                    TempWidth + TwwDBDateTimePicker(EditControl).Button.Width
           end
           else if (EditControl is TCustomMemo) and (rvoEnterToTab in Options) then
               TMemo(EditControl).WantReturns := False
           else if (EditControl is TwwDBEditMemo) and (rvoEnterToTab in Options) then
               TwwDBEditMemo(EditControl).WantReturns := False;

           if rvoShortenEditBox in Options then begin
              if TempWidth>FixedEditWidth then TempWidth:= FixedEditWidth;
           end;
           if rvoConsistentEditWidth in Options then begin
              if TempWidth<FixedEditWidth then TempWidth:= FixedEditWidth;
           end;

           ControlPositionLeft:= EditStartOffset+curLineWidth;
           ControlPositionTop:= PrevTop+EditSpacing.HorizontalView.BetweenLabelEdit+curlabel.Height;

           if IsSingleLineEditControl(EditControl) then
              ControlPositionHeight:= EditControl.Height
           else begin
              if (rvoMaximizeMemoWidth in Options) then
              begin
                 ControlPositionLeft:= EditStartOffset;
                 ControlPositionTop:= PrevTop+EditSpacing.HorizontalView.BetweenLabelEdit+curlabel.Height;
                 TempWidth:= wwMax(OrigMaxEditWidth, FixedEditWidth)
              end;

              ControlPositionHeight:=
                 RecordViewForm.Canvas.TextHeight('0') * LinesPerMemoControl + 8; {2 lines of Memo}
           end;
           if CurFieldReadOnly then enabled:=False;
       end;

       EditControl.Left:= ControlPositionLeft;
       EditControl.Top:= ControlPositionTop;
       EditControl.Height:= ControlPositionHeight;

       FControlList.add(EditControl);

       OldWidth:= EditControl.Width; { 5/20/99 - Respect width change }
       DoOnAfterCreateControl(RecordViewForm, curField, EditControl);
       if EditControl.Width<>OldWidth then TempWidth:= EditControl.Width; { 10/22/98 }

       if rvoShortenEditBox in Options then begin
          if TempWidth>FixedEditWidth then TempWidth:= FixedEditWidth;
       end;

       if rvoConsistentEditWidth in Options then begin
          if TempWidth<FixedEditWidth then TempWidth:= FixedEditWidth; //!!
       end;

       if (TempWidth < curlabel.width) and (rvoSetControlMinWidth in Options) then
           TempWidth:= curlabel.width + 1;
       EditControl.Width:= TempWidth;

       curFieldEditWidth := EditControl.Width;
       MaxEditWidth:= wwmax(MaxEditWidth, tempWidth);
       LastEditHeight := wwMax(LastEditHeight,EditControl.Height);

       InitPictureMask(EditControl, curfield);

       result:= True;
    end;


begin
   PrevTop:= Margin.TopOffset;
   with RecordViewForm do begin
      if not (rvoHideNavigator in Options) then NavigatorWidth:= Navigator.width
      else NavigatorWidth:= 0;

      if (rvokShowOKCancel in OKCancelOptions) then
      begin
        ButtonPanelHeight:= ButtonPanel.Height;
      end
      else
      begin
        ButtonPanelHeight:= 0;
      end;

      if FuseTFields or (selected.count=0) then numFields:= DataSource.DataSet.FieldCount
      else numFields:= Selected.count;

      Canvas.Font := Font;

      { Compute desired form length }
      MaxEditWidth:= 0;
      RealMaxLineWidth:= 0;
      curFieldDisplayWidth:= 0;

      for i:= 0 to numFields-1 do begin
         curFieldReadOnly:= False;
         if (Selected.count=0) or FuseTFields then
         begin
            curField:= DAtaSource.dataset.fields[i];
            curFieldDisplayWidth:= curField.DisplayWidth;
            curFieldReadOnly:= curfield.ReadOnly;
         end
         else begin
            APos:= 1;
            curField:= DAtaSource.dataset.findField(strGetToken(Selected[i], #9, APos));
            if curfield<>nil then
            begin
               curFieldDisplayWidth:= strToInt(strGetToken(Selected[i], #9, APos));
               strGetToken(Selected[i], #9, APos); { Display label }
               curFieldReadOnly := (strGetToken(Selected[i], #9, APos) = 'T');
            end
         end;
         if not ShowField(curfield, curFieldReadOnly) then continue;

         MaxEditWidth:= wwmax(MaxEditWidth,
               (CurFieldDisplayWidth+1) * Canvas.TextWidth('0') + 3);
      end;
      OrigMaxEditWidth:= MaxEditWidth;

      { Limit form length }
      EditStartOffset:= Margin.LeftOffset;

      if FormPosition.Width>0 then
         FormWidth:= wwMax(FormPosition.Width, NavigatorWidth + (FixedEditWidthConst-6) + Margin.RightOffset)
      else begin
         FormWidth:= RecordPanel.Left + ScrollBox.left + EditStartOffset + MaxEditWidth +
                  (FixedEditWidthConst-6) + Margin.RightOffset;
         FormWidth:= wwMax(FormWidth, NavigatorWidth + (FixedEditWidthConst-6) + Margin.RightOffset);
         FormWidth:= wwMax(FormWidth,400);
      end;

      ARect := wwGetWorkingRect;

      Width:= wwmin(FormWidth, (ARect.Right-ARect.Left)-((FixedEditWidthConst-6) + Margin.RightOffset));

      MaxEditWidth:= 0;

      lastEditHeight := 0;
      lastLabelHeight := 0;
      CurLineWidth:= 0;

      FixedEditWidth:= RecordViewForm.width - RecordViewForm.ScrollBox.left  { 6/16/97 - Substract scrollbox.left }
                      - (EditStartOffset + (FixedEditWidthConst + Margin.RightOffset));
      MaxLineWidth:= FixedEditWidth;

      for i:= 0 to numFields-1 do begin
         APos:= 1;
         curFieldReadOnly:= False;
         if (Selected.count=0) or FUseTFields then
         begin
            curField:= DAtaSource.dataset.fields[i];
            curFieldDisplayWidth:= curfield.DisplayWidth;
            curFieldDisplayLabel:= curField.displayLabel;
            curFieldReadOnly:= curField.ReadOnly;
         end
         else begin
            curField:= DAtaSource.dataset.findField(strGetToken(Selected[i], #9, APos));
            if curfield = nil then begin
               {NEW LINE}
               curLineWidth := 0;
               PrevTop := PrevTop + EditSpacing.HorizontalView.BetweenLabelEdit+
                          LastEditHeight + EditSpacing.HorizontalView.BetweenRow +
                          LastLabelHeight;{New Top Value}
               LastEditHeight := 0;
               continue;
            end
            else begin
               curFieldDisplayWidth:= strToInt(strGetToken(Selected[i], #9, APos));
               curFieldDisplayLabel:= strGetToken(Selected[i], #9, APos);
               curFieldReadOnly := (strGetToken(Selected[i], #9, APos) = 'T');
            end
         end;

         if not ShowField(curfield, curFieldReadOnly) then continue;

         Canvas.Font := LabelFont;
         curFieldLabelWidth := (Canvas.TextWidth(curFieldDisplayLabel));
         Canvas.Font := Font;

         if (rvoMaximizeMemoWidth in Options) and
            ((wwIsCustomEditCell(self, wwGetOwnerFrameOrForm(self), curField, customEdit) and
             wwisclass(customedit.classtype,'TwwCustomRichEdit'))
             or (curField is TBlobField)) then { 9/25/98 }
            curFieldEditWidth:= FixedEditWidth
         else
            curFieldEditWidth:= (curFieldDisplayWidth+1) * Canvas.TextWidth('0') + 3;

         if (curlineWidth > 0) and
            (curLineWidth + EditSpacing.HorizontalView.BetweenEditsInRow +
             wwmax(curFieldEditWidth,curFieldLabelWidth+EditSpacing.HorizontalView.LabelIndent) > MaxLineWidth) then
         begin
            {Won't fit on current line so go to next line}
            curLineWidth := 0;
            PrevTop := PrevTop + EditSpacing.HorizontalView.BetweenLabelEdit +
                       EditSpacing.HorizontalView.BetweenRow + LastEditHeight + LastLabelHeight;{New Top Value}
            LastEditHeight := 0;
         end;

         accept:= True;
         DoOnBeforeCreateControl(RecordViewForm, curField, accept);
         if not accept then continue;

         if (rvoUseCustomControls in Options) and
            IsCheckbox(curField, checkboxOn, checkboxOff) then
            curLabel:= TwwLabel.create(Scrollbox)
         else
            curLabel:= TLabel.create(Scrollbox);
         self.curlabel:= curlabel;
         with curLabel do begin
            parent:= ScrollBox;
            font:= self.labelFont;
            { Move caption assigment before left assignment for bidi support }
            Caption:= strReplaceChar(curfieldDisplayLabel, '~', ' ');
            left:= Margin.LeftOffset+ CurLineWidth+EditSpacing.HorizontalView.LabelIndent;
            Top:= PrevTop;
            AutoSize:= False;
            Width:= Canvas.TextWidth(curFieldDisplayLabel);
            alignment:= taLeftJustify;
         end;

         if rvcTransparentLabels in ControlOptions then curLabel.transparent:= true;
         DoOnAfterCreateControl(RecordViewForm, curField, curLabel);

         LastLabelHeight := curLabel.height;
         curFieldLabelWidth := curlabel.width+EditSpacing.HorizontalView.LabelIndent;

         if (rvoUseCustomControls in Options) and
            IsCheckbox(curField, checkboxOn, checkboxOff) then
         begin
            checkbox:= TwwDBCheckBox.create(ScrollBox);
            checkbox.LabelControl:= curLabel;
            curLabel.FocusControl:= checkBox;
            with checkbox do begin
               parent:= ScrollBox;
               datasource:= self.DataSource;
               datafield:= curfield.fieldName;
               left:= EditStartOffset+curLineWidth;
               Top:= PrevTop+EditSpacing.HorizontalView.BetweenLabelEdit+ curlabel.Height;
               caption:= '';
               valueChecked:= checkboxOn;
               valueUnchecked:= checkboxOff;
               Width:= 17;
               if curFieldReadonly or Field.calculated then
               begin
                  tabStop:= False;
               end;
            end;
            FControlList.add(Checkbox);
            DoOnAfterCreateControl(RecordViewForm, curField, checkbox);

            curFieldEditWidth := checkbox.Width;
            MaxEditWidth:= wwmax(MaxEditWidth, checkbox.Width);
            LastEditHeight:= wwMax(LastEditHeight,checkbox.Height);
            Checkbox.Height:= LastEditHeight;
         end
         else if (rvoUseCustomControls in Options) and
            wwIsCustomEditCell(self, wwGetOwnerFrameOrForm(self), curField, customEdit) then
         with TEdit(CustomEdit) do begin
            AddCustomControl(CustomEdit);
            curLabel.FocusControl:= CustomEdit;  { 1/24/98 }

            parent:= ScrollBox;
            visible:= True;
            if not wwSetControlDataSource(customEdit, datasource) then continue;
            if not wwSetControlDataField(customEdit, curField.fieldName) then continue;
            if CustomEdit is TwwDBCustomLookupCombo then
            begin
               if not (curField.calculated or curfield.lookup) then
                  TwwDBLookupCombo(CustomEdit).RefreshDisplay;
            end;
            Ctl3d:= True;
            if not HasFrame(customEdit) then BorderStyle:= bsSingle;
            left:= EditStartOffset+curLineWidth;
            top:= PrevTop+EditSpacing.HorizontalView.BetweenLabelEdit+curlabel.Height;

            if (customEdit is TwwRadioGroup) and TwwRadioGroup(CustomEdit).ShowGroupCaption then
            begin
               LastLabelHeight := 0;
            end;
            if wwIsClass(customedit.classtype,'TwwCustomRichEdit') and
               (rvoMaximizeMemoWidth in Options) then
               Width:= wwMax(OrigMaxEditWidth, FixedEditWidth)
            else begin
               Width:= (curFieldDisplayWidth+1) * Canvas.TextWidth('0') + 3;
               if (Width < curlabel.width) and (rvoSetControlMinWidth in Options) then
                  Width:= curlabel.width + 1;
            end;

            if rvoShortenEditBox in Options then begin
               if Width>FixedEditWidth then Width:= FixedEditWidth;
            end;

            TEdit(CustomEdit).HandleNeeded;
            FControlList.add(CustomEdit);

            DoOnAfterCreateControl(RecordViewForm, curField, customEdit);

            curFieldEditWidth := customEdit.Width;
            MaxEditWidth:= wwmax(MaxEditWidth, customEdit.Width);
            LastEditHeight:= wwMax(LastEditHeight,customEdit.Height);
         end
         else if (curField is TDateTimeField) and
                 (rvoUseDateTimePicker in Options) then
         begin
            EditControl:= TwwDBDateTimePicker.create(ScrollBox);
            if not CreateEditControl(EditControl) then continue;
         end
         else if wwIsRichEditField(curField, True) then begin
            EditControl:= TwwDBRichEdit.create(ScrollBox);
            if not CreateEditControl(EditControl) then continue;
         end
         else if (curField.dataType = ftMemo) then begin
            if EditFrame.IsFrameEffective then
               EditControl:= TwwDBEditMemo.create(ScrollBox)
            else
               EditControl:= TwwDBEditMemo.create(ScrollBox);
            if not CreateEditControl(EditControl) then continue;
         end
         else if (curField.dataType = ftGraphic) then
         begin { 8/27/98 - Support images }
            editControl:= TDBImage.create(ScrollBox);
            if not CreateEdi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -