📄 wwselfld.pas
字号:
{ added in case no grid is used to show fields - i.e. LookupDialog}
if AUseTFields then begin
curField:= gridTable.fieldByName(parts[0]);
curField.displayWidth:= strtoint(parts[1]);
curField.displayLabel:= parts[2];
end;
DstList.items.add(parts[0]);
thisIndex:= SrcListItems.indexOf(parts[0]);
if thisIndex>=0 then SrcListItems.delete(thisIndex);
end
else if (wwNewLineString=parts[0]) then begin
DstList.items.add(parts[0]);
end
end;
gridTable.enableControls;
Screen.cursor:= crDefault;
tempform.propertyType:= APropertyType;
if ApropertyType=sptRecordViewType then
begin
useTFieldCheckbox.checked:= False;
useTFieldCheckbox.enabled:= False;
end
else begin
if ApropertyType= sptDataSetType then
useTFieldCheckbox.enabled:= False;
InsertNewLineButton.visible:= False;
AddFieldsButton.left:= DstList.left;
AddFieldsbutton.width:= DstList.width div 2;
RemoveFieldsbutton.width:= DstList.width div 2;
RemoveFieldsButton.left:= DstList.Left + DstList.Width - RemoveFieldsButton.Width;
end;
Result := ShowModal = IDOK;
if Result then begin
AUseTFields:= UseTFields;
end
else begin
GSelected.assign(OrigSelected);
end;
if Result and useTFields then begin
gridTable.disableControls;
if AUseTFields then begin
// fields.clear;
for i:= 0 to SrcListItems.count-1 do begin
curField:= gridTable.fieldByName(SrcListItems[i]);
curField.visible:= False;
end;
end;
for i:= 0 to DstList.items.count-1 do begin
curField:= gridTable.findField(DstList.items[i]);
if curField=nil then begin {5/12/97}
// if useTFields then fields.add(DstList.items[i]);
continue;
end;
if AUseTFields then begin
// selString:= curField.fieldName + #9 +
// inttostr(curField.displayWidth) + #9 +
// curField.displayLabel;
// fields.add(selString);
curField.index:= i;
curField.visible:= True;
end
end;
gridTable.enableControls;
end;
finally
Free;
parts.Free;
origSelected.Free;
end;
end;
procedure TSelFieldsForm.SelectDest(index: integer);
var lkDatabase, lkTable, lkField, lkIndex: wwSmallString;
lkIndexFields: string;
lkJoins: string;
lkFoundIndex: integer;
lkUseExtension: char;
controlData: TStrings;
controlName: wwSmallString;
i: integer;
tempMask: string;
tempAutoFill, tempUsePictureMask: boolean;
tempCaseSensitive: boolean;
tempErrorMsg: string;
apos, aindex: integer;
foundControl: boolean;
begin
InSelectDest:= True;
try
editLookupButton.enabled:= False;
if DstList.items.count=0 then index:= -1;
if (index>=0) then begin
if (DstList.items.count>0) and (index>=DstList.items.count) then
index:= DstList.items.count-1; {Limit to range }
if not DstList.Selected[index] then
DstList.Selected[index]:= True;
if initialized then begin
saveControlInfo; { Save changes }
savePictureMasks;
SaveRegexMasks;
end;
curField:= gridTable.findField(DstList.items[index]);
if curfield=nil then begin
SelectedFieldCaption.visible:= False;
//FieldTabSet.visible:= False;
exit;
end
else begin
SelectedFieldCaption.visible:= True;
//FieldTabSet.visible:= True;
end;
{ Initalize control information on form, first flush current contents}
controlData:= TStringList.create;
getControlInfo(curField, controlName, controlData);
if (controlName='Bitmap') then
begin
BitmapScalingCombo.itemIndex:= BitmapScalingCombo.Items.indexOf(ControlData[0]);
if BitmapScalingCombo.itemIndex<0 then BitmapScalingCombo.itemIndex:= 0;
RasterCombo.itemIndex:= RasterCombo.Items.indexOf(ControlData[1]);
if RasterCombo.itemIndex<0 then RasterCombo.itemIndex:= 0;
ControlTypeNotebook.Activepage:= 'Bitmap';
end
else if (controlName='ImageIndex') then
begin
ControlTypeNotebook.Activepage:= 'ImageIndex';
ShrinktoFit.checked:= ControlData[0] = 'Shrink To Fit';
end
else if (controlName='URL-Link') then
begin
ControlTypeNotebook.Activepage:= 'URLLink';
// URLAddressField.text:= ControlData[0];
end
else if controlName='CheckBox' then begin
CheckOnValue.Text:= ControlData[0];
CheckOffValue.Text:= ControlData[1];
ControlTypeNotebook.Activepage:= 'Checkbox';
end
else if controlName='RichEdit' then begin
ControlTypeNotebook.Activepage:= 'RichEdit';
with DBRichEditComboList do begin
for i:= 0 to items.count - 1 do begin
if uppercase(items[i]) = uppercase(ControlData[0]) then
begin
DBRichEditComboList.itemIndex:= i;
if ControlData.count>1 then
RTFControlAlwaysPaints.checked:= (ControlData[1]='T');
end
end
end;
end
else if controlName='Field' then begin
ControlTypeNotebook.Activepage:= 'Field';
end
else if isWWEditControl(controlName) then begin
ControlTypeNotebook.Activepage:= WW_DB_LOOKUP_COMBO;
{ Search list to find which entry it is }
foundControl:= false;
with DBLookupComboList do begin
for i:= 0 to items.count - 1 do begin
if uppercase(items[i]) = uppercase(ControlData[0]) then
begin
foundControl:= True;
DBLookupComboList.itemIndex:= i;
if ControlData.count>1 then
ControlAlwaysPaints.checked:= (ControlData[1]='T');
end
end
end;
if not FoundControl then begin
DBLookupComboList.text:= ControlData[0];
DBLookupComboList.font.color:= clRed;
end
else
DBLookupComboList.font.color:= clWindowText;
end;
if controlName=WW_DB_LOOKUP_COMBO then controlName:= WW_DB_EDIT;
ControlTypeEdit.itemIndex:= ControlTypeEdit.items.indexOf(controlName);
controlData.free;
{$ifdef wwDelphi3Up}
if curField.calculated and (wwIsClass(gridtable.classType, 'TBDEDataSet'))
and (wwGetLookupFields(gridTable)<>nil) then
{$else}
if curField.calculated then
{$endif}
begin
if not TabSheetLinks.Visible then
TabSheetLinks.Visible:=true;
// if (FieldTabset.tabs.indexOf(LINKS_TABSETNAME)<0) then
// FieldTabSet.tabs.insert(FieldNotebook.pages.indexOf('Links'),
// LINKS_TABSETNAME);
editLookupButton.enabled:= True;
getLookupFields(curField,
lkDatabase, lkTable, lkField, lkIndex, lkIndexFields, lkJoins,
lkUseExtension, lkFoundIndex);
if lkTable='' then lkTable:= '???';
if lkField='' then lkField:= '???';
LookupTableCaption.caption:= lkTable;
LookupFieldCaption.caption:= lkField;
end
else begin { Adjust tab set to not show 'Links' page }
if TabSheetLinks.Visible then
begin
if (FieldNotebook.ActivePage=TabSheetLinks) then
FieldNotebook.ActivePage:= TabSheetDisplay;
TabSheetLinks.Visible:=false;
end;
// if (FieldTabset.tabs.indexOf(LINKS_TABSETNAME)>=0) then begin
// FieldTabSet.tabs.delete(FieldTabSet.tabs.IndexOf(LINKS_TABSETNAME));
// if (FieldNotebook.PageIndex=FieldNotebook.pages.indexOf('Links')) then
// FieldNotebook.PageIndex:= 0;
// end;
end;
// FieldTabSet.tabIndex:= FieldNotebook.pageIndex; { Synchronize tabset and notebook}
SelectedFieldCaption.caption:= 'Currently Selected Field: ' + curField.fieldName;
if wwFindSelected(GSelected, curField.FieldName, aindex) then
begin
APos:= 1;
strGetToken(GSelected[aindex], #9, apos);
DisplayWidth.text:= strGetToken(GSelected[aindex], #9, apos);
DisplayTitle.text:= strGetToken(GSelected[aindex], #9, apos);
ReadOnlyCB.checked:= strGetToken(GSelected[aIndex], #9, apos)='T';
GroupName.text:= strGetToken(GSelected[AIndex], #9, apos);
end
else begin
DisplayWidth.text:= inttostr(curField.displayWidth);
DisplayTitle.text:= curField.displayLabel;
ReadOnlyCB.checked:= False;
GroupName.text:= '';
end;
wwRegexByField(Component, curField.FieldName, tempMask, tempCaseSensitive, tempErrorMsg);
RegexEdit.Text:= tempMask;
CaseSensitiveRegexCheckBox.Checked:= tempCaseSensitive;
RegexErrorMsgEdit.Text:= tempErrorMsg;
wwPictureByField(
wwGetPictureControl(Component, GridTable),
curField.FieldName, False, tempMask,
tempAutoFill, tempUsePictureMask);
PictureMaskEdit.text:= tempMask;
AutoFillCheckbox.checked:= tempAutoFill;
UsePictureMask.checked:= tempUsePictureMask;
if (wwPdxPictureMask(gridTable, curField.FieldName)<>'') then
begin
PictureMaskEdit.enabled:= False;
PictureMaskPage.Caption:='&Picture Mask (From Paradox Table)';
//PictureMaskLabel.caption:= '&Picture Mask (From Paradox Table)';
PictureMaskEdit.ShowButton:= False;
DesignMaskButton.enabled:= False;
end
else begin
PictureMaskEdit.enabled:= True;
PictureMaskPage.Caption:= '&Picture Mask';
//PictureMaskLabel.caption:= '&Picture Mask';
PictureMaskEdit.ShowButton:= True;
DesignMaskButton.enabled:= True;
end;
end
else begin
curField:= Nil;
DisplayWidth.text:= '';
DisplayTitle.text:= '';
GroupName.text:= '';
end;
finally
InSelectDest:= False;
end;
end;
procedure TSelFieldsForm.DstListClick(Sender: TObject);
begin
SelectDest(DstList.itemIndex)
end;
function TSelFieldsForm.InDestList(Value: string): Boolean;
begin
Result := False;
if DstList.Items.IndexOf(Value) > -1 then
Result := True;
end;
procedure TSelFieldsForm.ExcludeItems;
var
I, SelIndex: Integer;
begin
with DstList do
begin
I := 0;
while SelCount > 0 do
begin
if Selected[I] then
begin
SrcListItems.add(Items[i]);
// if not useTFields then begin
if wwFindSelected(GSelected, Items[i], selindex) then
GSelected.delete(selIndex);
// end;
Items.Delete(I);
end
else
Inc(I);
end;
if Items.Count = 0 then begin
DisplayWidth.Text:= '';
DisplayTitle.Text:= '';
GroupName.text:= '';
end
else begin
DstList.ItemIndex:= 0;
SelectDest(i); { Select close to last entry }
end
end;
end;
procedure TSelFieldsForm.getControlInfo(curField: Tfield;
var controlName: wwSmallString;
controlData: TStrings);
var parts: TStrings;
i,j: integer;
begin
parts:= TStringList.create;
controlData.clear;
controlName:= 'Field';
with controlType do begin
for i:= 0 to count-1 do begin
strBreakApart(strings[i], ';', parts);
if parts[0]=curField.fieldName then begin
controlName:= parts[1];
for j:= 2 to parts.count-1 do controlData.add(parts[j]);
for j:= parts.count to 10 do controlData.add(''); { pad to avoid out-of-bounds }
break;
end
end;
parts.free;
end
end;
procedure TSelFieldsForm.setControlInfo(curField: TField;
controlName: String;
controlData: TStrings);
var parts: TStrings;
i,j: integer;
found: boolean;
line: string;
begin
parts:= TStringList.create;
found:= false;
with controlType do begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -