?? wwprpedt.pas
字號:
begin
GetComponentData(GetComponent(0) as TComponent, listHandle, dataSet);
listHandle:= TStringList.create;
if (dataSet=Nil) then begin
MessageDlg('Missing TableName property', mtInformation, [mbok], 0);
exit;
end;
useTFields:= True;
{ try}
if (EditSelectedFieldsProperty(GetComponent(0) as TComponent,
listHandle, DataSet, Designer, True,
useTFields, sptDataSetType)) then begin
wwDataSetUpdateFieldProperties(DataSet, listHandle);
end;
{ finally}
listHandle.free;
{ end;}
end;
function TwwDBLookupDisplayProperty.GetValue: string;
var
listHandle : TStrings;
dataSet: TDataSet;
begin
GetComponentData(GetComponent(0) as TComponent, listHandle, dataSet);
{ GetComponentData(GetComponent(0), listHandle, dataSet);}
if listHandle.count>0 then result:= listHandle[0]
else result := '';
end;
function TwwDBLookupDisplayProperty.GetAttributes: TPropertyAttributes;
begin
result:= [paDialog];
end;
procedure TwwDBLookupDisplayProperty.Edit;
var
listHandle : TStrings;
dataSet: TDataSet;
component: TComponent;
useTFields: boolean;
SelectedPropertyType: TwwSelectedPropertyType;
begin
component:= GetComponent(0) as TComponent;
GetComponentData(GetComponent(0) as TComponent, listHandle, dataSet);
SelectedPropertyType:= sptNone;
if GetComponent(0) is TwwCustomLookupDialog then
begin
useTFields:= TwwCustomLookupDialog(GetComponent(0)).useTFields;
end
else if GetComponent(0) is TwwRecordViewDialog then begin
useTFields:= False; {TwwRecordViewDialog(GetComponent(0)).useTFields;}
SelectedPropertyType:= sptRecordViewType;
end
else if GetComponent(0) is TwwDataInspector then begin
SelectedPropertyType:= sptObjectViewType;
useTFields:= False;
end
else if GetComponent(0) is TwwRecordViewPanel then begin
useTFields:= False;
SelectedPropertyType:= sptRecordViewType;
end
else if GetComponent(0) is TwwDBCustomLookupCombo then begin
useTFields:= TwwDBCustomLookupCombo(GetComponent(0)).useTFields;
end;
if (dataSet=Nil) then begin
if GetComponent(0) is TwwSearchDialog then begin
MessageDlg('ShadowSearchTable is required to customize field layout of search dialog.', mtInformation, [mbok], 0);
end
else if Component is TwwRecordViewDialog then
MessageDlg('DataSet required to customize RecordViewDialog Layout.', mtInformation, [mbok], 0)
else if Component is TwwRecordViewPanel then
MessageDlg('DataSet required to customize RecordViewPanel Layout.', mtInformation, [mbok], 0)
else if Component is TwwDataInspector then
MessageDlg('DataSet required to customize ObjectView Layout.', mtInformation, [mbok], 0)
else MessageDlg('Missing LookupTable', mtInformation, [mbok], 0);
end
else if (EditSelectedFieldsProperty(component, listHandle, DataSet, Designer, True,
useTFields, selectedPropertyType)) then
begin
if useTFields then wwDataSetUpdateFieldProperties(DataSet, listHandle);
if GetComponent(0) is TwwCustomLookupDialog then
TwwCustomLookupDialog(GetComponent(0)).useTFields:= useTFields
else if GetComponent(0) is TwwDBCustomLookupCombo then
TwwDBCustomLookupCombo(GetComponent(0)).useTFields:= useTFields;
if Component is TwwDBCustomLookupCombo then
(Component as TwwDBCustomLookupCombo).refreshDisplay
else if Component is TwwRecordViewPanel then
(Component as TwwRecordViewPanel).RecreateControls
else if Component is TwwDataInspector then
(Component as TwwDataInspector).ApplySettings;
end
end;
procedure TwwDBLookupDisplayComponentEditor.Edit;
var
listHandle : TStrings;
dataSet: TDataSet;
useTFields: boolean;
SelectedPropertyType: TwwSelectedPropertyType;
begin
GetComponentData(Component, listHandle, dataSet);
SelectedPropertyType:= sptNone;
if Component is TwwCustomLookupDialog then
begin
useTFields:= TwwCustomLookupDialog(Component).useTFields;
end
else if Component is TwwDBCustomLookupCombo then
begin
useTFields:= TwwDBCustomLookupCombo(Component).useTFields;
end
else if Component is TwwRecordViewDialog then
begin
useTFields:= False;
SelectedPropertyType:= sptRecordViewType;
end
else if Component is TwwDataInspector then
begin
SelectedPropertyType:= sptObjectViewType;
useTFields:= False;
end
else if Component is TwwRecordViewPanel then
begin
useTFields:= False;
SelectedPropertyType:= sptRecordViewType;
end;
if (dataSet=Nil) then begin
if Component is TwwSearchDialog then begin
MessageDlg('ShadowSearchTable is required to customize field layout of search dialog.', mtInformation, [mbok], 0);
end
else if Component is TwwRecordViewDialog then
MessageDlg('DataSet required to customize RecordViewDialog Layout.', mtInformation, [mbok], 0)
else if Component is TwwRecordViewPanel then
MessageDlg('DataSet required to customize RecordViewPanel Layout.', mtInformation, [mbok], 0)
else if Component is TwwDataInspector then
MessageDlg('DataSet required to customize ObjectView Layout.', mtInformation, [mbok], 0)
else MessageDlg('Missing LookupTable', mtInformation, [mbok], 0);
end
else if (EditSelectedFieldsProperty(component, listHandle, DataSet, Designer, False, useTFields,
SelectedPropertyType)) then
begin
if useTFields then wwDataSetUpdateFieldProperties(DataSet, listHandle);
if Component is TwwCustomLookupDialog then
TwwCustomLookupDialog(Component).useTFields:= useTFields
else if Component is TwwDBCustomLookupCombo then
TwwDBCustomLookupCombo(Component).useTFields:= useTFields;
if Component is TwwDBCustomLookupCombo then
(Component as TwwDBCustomLookupCombo).refreshDisplay
else if Component is TwwRecordViewPanel then
(Component as TwwRecordViewPanel).RecreateControls
else if Component is TwwDataInspector then
(Component as TwwDataInspector).ApplySettings;
end
end;
Function TwwIndexFieldProperty.GetAttributes: TPropertyAttributes;
begin
result:= [paValueList, paSortList];
end;
procedure TwwIndexFieldProperty.GetValues(Proc : TGetStrProc);
var
LookupTable: TDataSet;
curpos, i: integer;
addedList: TStrings;
indexFieldName: string;
begin
if GetComponent(0) is TwwDBCustomLookupCombo then
LookupTable:= (GetComponent(0) as TwwDBCustomLookupCombo).LookupTable
else exit;
if (LookupTable<>Nil) then begin
if (LookupTable is TTable) or
(LookupTable is TwwTable) and ((LookupTable as TwwTable).Query.Count=0) then begin
addedList:= TStringList.create;
(LookupTable as TTable).IndexDefs.update;
for i:= 0 to (LookupTable as TTable).IndexDefs.count-1 do
begin
curpos:= 1;
indexFieldName:= strGetToken((LookupTable as TTable).IndexDefs.Items[i].fields, ';', curpos);
if (addedList.indexOf(indexFieldName)<0) then begin
Proc(indexFieldname);
addedList.add(indexFieldName);
end
end;
addedList.free;
end
else begin
for i:= 0 to LookupTable.FieldCount-1 do
Proc(LookupTable.Fields[i].FieldName);
end
end
end;
Function TwwSearchFieldProperty.GetAttributes: TPropertyAttributes;
begin
result:= [paValueList, paSortList];
end;
procedure TwwSearchFieldProperty.GetValues(Proc : TGetStrProc);
var
ds: TDataSource;
i: integer;
begin
if GetComponent(0) is TwwLocateDialog then
ds:= (GetComponent(0) as TwwLocateDialog).dataSource
else if GetComponent(0) is TwwFilterDialog then
ds:= (GetComponent(0) as TwwFilterDialog).dataSource
else exit;
if (ds<>Nil) and (ds.dataSet<>Nil) then begin
with ds.DataSet do begin
for i:= 0 to fieldCount-1 do begin
if (fields[i].dataType = ftBlob) or (fields[i].dataType=ftGraphic) or
(fields[i].dataType = ftVarBytes) or (fields[i].dataType=ftBytes) then
continue;
Proc(fields[i].FieldName);
end
end;
end
end;
procedure TwwTableProperty.GetValues(Proc : TGetStrProc);
{$ifndef win32}
var
I,J: Integer;
ownerComponent, dmComponent, Component: TComponent;
{$endif}
begin
{$ifdef win32}
Designer.GetComponentNames(GetTypeData(TypeInfo(TwwTable)), Proc);
{$else}
ownerComponent:= ((GetComponent(0) as TComponent).Owner);
if ownerComponent = nil then exit;
for I := 0 to ownerComponent.ComponentCount - 1 do
begin
Component := ownerComponent.Components[I];
if (Component is TwwTable) and (Component.Name <> '') then
Proc(Component.Name);
end;
{$endif}
end;
function TSelectedFieldsProperty.GetValue: string;
begin
result := 'wwDBGrid';
end;
function TSelectedFieldsProperty.GetAttributes: TPropertyAttributes;
begin
result:= [paDialog];
end;
procedure TSelectedFieldsProperty.Edit;
var
grid : TwwDBGrid;
useTFields: boolean;
begin
grid:= GetComponent(0) as TwwDBGrid;
if (grid.dataSource=Nil) then begin
MessageDlg('Grid requires a DataSource', mtInformation, [mbok], 0);
exit;
end;
if (grid.dataSource.dataset=Nil) then begin { 12/1/98 }
MessageDlg('Grid requires a DataSet', mtInformation, [mbok], 0);
exit;
end;
useTFields:= grid.useTFields;
if (EditSelectedFieldsProperty(grid, grid.Selected, grid.dataSource.dataset,
Designer, True, useTFields, sptNone)) then
begin
grid.useTFields:= useTFields;
// if not useTFields then grid.applyselected;
grid.redrawGrid;
end
else if not useTFields then grid.ApplySelected;
end;
procedure TwwDBGridComponentEditor.edit;
var
grid : TwwDBGrid;
useTFields: boolean;
begin
grid:= Component as TwwDBGrid;
if (grid.dataSource=Nil) then begin
MessageDlg('Grid requires a DataSource', mtInformation, [mbok], 0);
exit;
end;
if (grid.dataSource.dataset=Nil) then begin { 12/1/98 }
MessageDlg('Grid requires a DataSet', mtInformation, [mbok], 0);
exit;
end;
useTFields:= grid.useTFields;
if (EditSelectedFieldsProperty(grid, grid.Selected, grid.dataSource.dataset,
Designer, True, useTFields, sptNone)) then begin
grid.useTFields:= useTFields;
grid.redrawGrid;
end
else if not useTFields then grid.ApplySelected;
end;
procedure TwwRecordViewPanelComponentEditor.edit;
var
ListHandle: TStrings;
DataSet: TDataSet;
useTFields: boolean;
begin
GetComponentData(Component, listHandle, dataSet);
if (dataset=Nil) then begin
MessageDlg('Component requires a DataSourc/DataSet', mtInformation, [mbok], 0);
exit;
end;
useTFields:= False;
if (EditSelectedFieldsProperty(component, listHandle, DataSet,
Designer, True, useTFields, sptRecordViewType)) then
(Component as TwwRecordViewPanel).RecreateControls;
end;
Function TwwComboItemsProperty.GetAttributes: TPropertyAttributes;
begin
result:= [paDialog, paMultiSelect];
end;
Function GetItems(Component: TPersistent): TStrings;
var PropInfo: PPropInfo;
begin
Result:= Nil;
PropInfo:= Typinfo.GetPropInfo(Component.ClassInfo,'Items');
if PropInfo<>Nil then
result:= TStrings(GetOrdProp(Component, PropInfo));
end;
procedure TwwComboItemsProperty.Edit;
var MapList: boolean;
i: integer;
Function GetMapList(Component: TPersistent): boolean;
var PropInfo: PPropInfo;
begin
result:= false;
PropInfo:= Typinfo.GetPropInfo(Component.ClassInfo,'MapList');
if PropInfo<>Nil then
result:= Boolean(GetOrdProp(Component, PropInfo));
end;
Procedure SetMapList(Component: TPersistent; val: boolean);
var PropInfo: PPropInfo;
begin
PropInfo:= Typinfo.GetPropInfo(Component.ClassInfo,'MapList');
if PropInfo<>Nil then
SetOrdProp(Component, PropInfo, ord(val));
end;
begin
MapList:= GetMapList(GetComponent(0));
if wwEditComboList(GetItems(GetComponent(0)), MapList) then
begin
SetMapList(GetComponent(0), MapList); // 11/19/99 - Fix bug in not updating maplist property
for i:= 1 to PropCount-1 do {8/23/96 - Change all selected controls }
begin
GetItems(GetComponent(i)).assign(GetItems(GetComponent(0)));
SetMapList(GetComponent(i), MapList);
end;
// SetMapList(GetComponent(0), MapList);
Designer.modified;
end;
end;
Function TwwComboItemsProperty.GetValue: string;
begin
result:= '<' + inttostr(GetItems(GetComponent(0)).count) + ' Items>';
end;
function TwwPictureProperty.GetValue: string;
begin
with (GetComponent(0) as TwwCustomMaskEdit) do begin
result:= Picture.PictureMask;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -