📄 wwselfld.pas
字号:
else if controlName='URL-Link' then begin
ControlTypeNotebook.Activepage:= 'URLLink';
// if curfield<>nil then
// URLAddressField.text:= curfield.fieldname;
end
else if controlName='Field' then begin
ControlTypeNotebook.Activepage:= 'Field';
end
else if isWWEditControl(controlName) then begin
DBLookupComboList.itemIndex:= -1;
ControlTypeNotebook.Activepage:= WW_DB_LOOKUP_COMBO;
end;
end;
procedure TSelFieldsForm.ExcludeBtnClick(Sender: TObject);
begin
ExcludeItems;
end;
procedure TSelFieldsForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var act: string;
begin
if (key=vk_f1) then wwCommon.wwALinkHelp(Handle, 'Select_Fields_Dialog_Box')
else if (Key = VK_Down) or (Key = VK_UP) then begin
if ActiveControl=Nil then act:= 'DisplayWidth'
else act:= ActiveControl.name;
if ((act = 'DisplayWidth') or (act = 'DisplayTitle') or (act = 'GroupName')) then
begin
if (Key = VK_Down) then begin
if DstList.itemIndex < DstList.items.count-1 then begin
DstList.selected[DstList.ItemIndex]:= False;
SelectDest(DstList.ItemIndex + 1);
end
end
else if DstList.itemIndex > 0 then begin
DstList.selected[DstList.ItemIndex]:= False;
SelectDest(DstList.ItemIndex - 1 );
end
end
end
end;
procedure TSelFieldsForm.SortAvailCheckboxClick(Sender: TObject);
begin
RefreshSourceList;
end;
procedure TSelFieldsForm.RefreshSourceList;
begin
end;
procedure TSelFieldsForm.HelpBtnClick(Sender: TObject);
begin
wwALinkHelp(Handle, 'Select_Fields_Dialog_Box');
end;
procedure TSelFieldsForm.DesignMaskButtonClick(Sender: TObject);
var component: TwwCustomMaskEdit;
begin
component:= TwwCustomMaskEdit.create(self);
with component do begin
component.visible:= False;
component.parent:= self;
with component.picture do begin
PictureMask:= PictureMaskEdit.Text;
AutoFill:= AutoFillCheckbox.checked;
end;
if wwPrpEdit_PictureMask(component) then
begin
with component.picture do begin
PictureMaskEdit.Text:= PictureMask;
AutoFillCheckbox.checked:= AutoFill;
end;
end;
Free;
end
end;
procedure TSelFieldsForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ScrollTimer.enabled:= False;
// wwtable1.active:= False;
end;
procedure TSelFieldsForm.PictureMaskEditInitDialog(Dialog: TwwLookupDlg);
begin
{ if not wwtable1.active then exit;
if not wwtable1.wwFindRecord(PictureMaskEdit.Text, 'Mask', mtExactMatch, False) then
begin
wwtable1.indexFieldName:= 'Desc';
wwtable1.First;
end
else wwtable1.indexFieldName:= 'Desc';
wwtable1.FieldByName('Desc').index:= 0;}
end;
procedure TSelFieldsForm.PictureMaskEditChange(Sender: TObject);
begin
PictureDescription.Text:= wwIniGetPictureDescription(PictureMaskEdit.text);
{ if not wwtable1.active then exit;
if wwtable1.wwFindRecord(PictureMaskEdit.Text, 'Mask', mtExactMatch, False) then
PictureDescription.Text:= wwtable1.FieldByName('Desc').asString
else PictureDescription.Text:= 'Mask not found in database';
}
{ if wwtable1.indexName<>'iMask' then
begin
wwtable1.indexName:='iMask';
end;
if wwtable1.FindKey([PictureMaskEdit.Text]) then
PictureDescription.Text:= wwtable1.FieldByName('Desc').asString
else PictureDescription.Text:= 'Mask not found in database';
}
end;
procedure TSelFieldsForm.PictureMaskEditCloseUp(Sender: TObject;
LookupTable: TDataSet; FillTable: TDataset; modified: Boolean);
begin
if modified then begin
PictureDescription.text:= lookupTable.fieldByName('Desc').asString;
end
end;
procedure TSelFieldsForm.RegexEditChange(Sender: TObject);
begin
RegexDescription.Text:= wwIniGetRegexDescription(RegexEdit.text);
end;
procedure TSelFieldsForm.RegexEditCustomDlg(Sender: TObject);
var
row: integer;
masks: TStringList;
key, value: string;
mr: TModalResult;
begin
with TwwPictureDialog.create(self) do begin
masks:= TStringlist.create;
iniPict.ReadSectionValues('Regex Masks', masks);
for row:= 0 to masks.count-1 do begin
stringgrid1.rowCount:= row+2;
stringgrid1.cells[0,row+1]:= masks.Names[row];
stringgrid1.cells[1,row+1]:= masks.values[masks.Names[row]];
if stringgrid1.cells[1,row+1]=PictureMaskEdit.text then
stringgrid1.row:= row+1;
end;
masks.free;
mr:= showmodal;
if MaskChanged then
begin
{ Strip out characters < 32 Ascii, and the = }
IniPict.EraseSection('Regex Masks');
for row:= 1 to StringGrid1.RowCount-1 do begin
Key:= StringGrid1.Cells[0, row];
Value:= StringGrid1.Cells[1, row];
wwVerifyPictureKeyValue(Key,Value);
IniPict.WriteString('Regex Masks', Key, Value);
end;
end;
if mr=mrOK then
begin
RegexDescription.text:= StringGrid1.cells[0, StringGrid1.Row];
RegexEdit.Text:= StringGrid1.cells[1, StringGrid1.Row];
end;
free;
end;
end;
procedure TSelFieldsForm.RemoveFieldsButtonClick(Sender: TObject);
begin
ExcludeItems;
end;
procedure TSelFieldsForm.AddFieldsButtonClick(Sender: TObject);
var selectedList: TStrings;
i: integer;
tempField: TField;
DisplayWidthStr: string;
begin
selectedList:= TStringlist.create;
try
if wwDlgSelectFields(GridTable, DstList.items, selectedList) then
begin
for i:= 0 to selectedList.count-1 do begin
DstList.items.add(selectedList[i]);
// if not useTFields then begin
tempField:= GridTable.FindField(SelectedList[i]);
if tempField<>Nil then begin
if propertyType = sptObjectViewType then DisplayWidthStr:= '0'
else DisplayWidthStr:= inttostr(tempfield.DisplayWidth);
GSelected.add(tempField.FieldName + #9 +
{ inttostr(tempField.DisplayWidth*wwPixelCharRatio + 4) + #9 +}
DisplayWidthStr + #9 +
tempField.DisplayLabel + #9 + 'F');
end
// end
end;
end
finally
selectedList.free;
end
end;
procedure TSelFieldsForm.DstListDragDrop(Sender, Source: TObject; X,
Y: Integer);
var row: integer;
dragString: string;
TempTopIndex: integer;
begin
if not (Sender is TListbox) then exit;
if not (Source is TListbox) then exit;
if (Source=DstList) and (Sender=DstList) then
begin
TempTopIndex:= DstList.TopIndex;
row := y div DstList.ItemHeight + DstList.TopIndex;
if row>DstList.items.count then row:= DstList.items.count;
if dragFromRow>=DstList.items.count then exit;
if row=dragFromRow then exit;
dragString:= DstList.items[dragFromRow];
DstList.items.delete(dragFromRow);
if (row>DstList.items.count) then
DstList.items.add(dragString)
else DstList.items.insert(row, dragString);
SelectDest(row);
DstList.TopIndex:= TempTopIndex;
end;
end;
procedure TSelFieldsForm.DstListDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
GoForwards:= False;
GoBackwards:= False;
Accept:= True;
end;
procedure TSelFieldsForm.DstListMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (not(ssCtrl in shift)) and (not(ssShift in shift)) then begin
dragFromRow := y div DstList.ItemHeight + DstList.TopIndex;
DstList.BeginDrag(False);
end;
end;
procedure TSelFieldsForm.FormShow(Sender: TObject);
begin
// wwOpenPictureDB(wwtable1);
useTFieldCheckBox.checked:= useTFields;
ControlTypeEdit.items.add('RichEdit');
if propertyType = sptObjectViewType then
begin
DisplayWidthLabel.caption:= '&Height';
end;
{ with gridtable do begin
for i:= 0 to fieldcount-1 do
begin
if fields[i] is TStringField then
URLAddressField.items.add(Fields[i].fieldName);
end
end;
}
end;
procedure TSelFieldsForm.FormDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
if DstList.dragging then begin
GoBackwards:= y<DstList.Top;
GoForwards:= y>DstList.Top + DstList.height;
end;
end;
procedure TSelFieldsForm.UseTFieldCheckboxClick(Sender: TObject);
begin
useTFields:= UseTFieldCheckbox.checked;
GroupName.enabled:= not useTfields;
GroupNameLabel.enabled:= not useTfields;
{ if useTfields then DisplayWidthLabel.Caption:= '&Width '
else DisplayWidthLabel.Caption:= '&Width (Pixels)';}
end;
procedure TSelFieldsForm.InsertNewLineButtonClick(Sender: TObject);
begin
DstList.items.insert(DstList.itemIndex, wwNewLineString);
GSelected.insert(DstList.itemIndex, wwNewLineString);
end;
procedure TSelFieldsForm.ReadOnlyCBClick(Sender: TObject);
var val: string;
begin
if curField=Nil then exit;
if InSelectDest then exit;
if ReadOnlyCB.checked then val:= 'T' else val:= 'F';
UpdateSelectedProp(GSelected, curField.FieldName, val, sptUpdateReadOnly);
end;
procedure TSelFieldsForm.PictureMaskEditCustomDlg(Sender: TObject);
var
row: integer;
masks: TStringList;
key, value: string;
mr: TModalResult;
begin
with TwwPictureDialog.create(self) do begin
masks:= TStringlist.create;
iniPict.ReadSectionValues('Picture Masks', masks);
for row:= 0 to masks.count-1 do begin
stringgrid1.rowCount:= row+2;
stringgrid1.cells[0,row+1]:= masks.Names[row];
stringgrid1.cells[1,row+1]:= masks.values[masks.Names[row]];
if stringgrid1.cells[1,row+1]=PictureMaskEdit.text then
stringgrid1.row:= row+1;
end;
masks.free;
mr:= showmodal;
if MaskChanged then
begin
{ Strip out characters < 32 Ascii, and the = }
IniPict.EraseSection('Picture Masks');
for row:= 1 to StringGrid1.RowCount-1 do begin
Key:= StringGrid1.Cells[0, row];
Value:= StringGrid1.Cells[1, row];
wwVerifyPictureKeyValue(Key,Value);
IniPict.WriteString('Picture Masks', Key, Value);
end;
end;
if mr=mrOK then
begin
PictureDescription.text:= StringGrid1.cells[0, StringGrid1.Row];
PictureMaskEdit.Text:= StringGrid1.cells[1, StringGrid1.Row];
end;
free;
end;
// ini.free;
end;
procedure TSelFieldsForm.DBLookupComboListDropDown(Sender: TObject);
begin
with (Sender as TwwDBComboBox) do begin
OrigColor:= font.color;
font.color:= clWindowText;
end
end;
procedure TSelFieldsForm.DBLookupComboListCloseUp(
Sender: TwwDBComboBox; Select: Boolean);
begin
if (not Select) then
with (Sender as TwwDBComboBox) do font.color:= OrigColor;
end;
procedure TSelFieldsForm.GroupNameChange(Sender: TObject);
begin
if curField=Nil then exit;
if InSelectDest then exit;
UpdateSelectedProp(GSelected, curField.FieldName, GroupName.Text, sptUpdateGroup);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -