📄 baservfrm.pas
字号:
else if Box is TListBox then
(Box as TListBox).Items := Items
else
(Box as TRadioGroup).Items := Items
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetXBoxItemCount(Box: TControl): Integer;
begin
{$IFDEF USERVKSDEVTE}
if Box is TTeComboBox then
Result := (Box as TTeComboBox).Items.Count
else if Box is TTeListBox then
Result := (Box as TTeListBox).Items.Count
else
Result := (Box as TTeRadioGroup).Items.Count
{$ELSE}
{$IFDEF USERVTNT}
if Box is TTntComboBox then
Result := (Box as TTntComboBox).Items.Count
else if Box is TTntListBox then
Result := (Box as TTntListBox).Items.Count
else
Result := (Box as TTntRadioGroup).Items.Count
{$ELSE}
if Box is TComboBox then
Result := (Box as TComboBox).Items.Count
else if Box is TListBox then
Result := (Box as TListBox).Items.Count
else
Result := (Box as TRadioGroup).Items.Count
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.ClearXBoxItems(Box: TControl);
begin
{$IFDEF USERVKSDEVTE}
if Box is TTeComboBox then
(Box as TTeComboBox).Items.Clear
else if Box is TTeListBox then
(Box as TTeListBox).Items.Clear
else
(Box as TTeRadioGroup).Items.Clear
{$ELSE}
{$IFDEF USERVTNT}
if Box is TTntComboBox then
(Box as TTntComboBox).Items.Clear
else if Box is TTntListBox then
(Box as TTntListBox).Items.Clear
else
(Box as TTntRadioGroup).Items.Clear
{$ELSE}
if Box is TComboBox then
(Box as TComboBox).Items.Clear
else if Box is TListBox then
(Box as TListBox).Items.Clear
else
(Box as TRadioGroup).Items.Clear
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.XBoxItemsAddObject(Box: TControl; const s: String;
obj: TObject; SysLanguage: Boolean = False);
begin
{$IFDEF USERVKSDEVTE}
if Box is TTeComboBox then
(Box as TTeComboBox).Items.AddObject(s, obj)
else if Box is TTeListBox then
(Box as TTeListBox).Items.AddObject(s, obj)
else
(Box as TTeRadioGroup).Items.AddObject(s, obj)
{$ELSE}
{$IFDEF USERVTNT}
if SysLanguage then begin
if Box is TTntComboBox then
(Box as TTntComboBox).Items.AddObject(s, obj)
else if Box is TTntListBox then
(Box as TTntListBox).Items.AddObject(s, obj)
else
(Box as TTntRadioGroup).Items.AddObject(s, obj)
end
else begin
if Box is TTntComboBox then
(Box as TTntComboBox).Items.AddObject(_GetWideString(s), obj)
else if Box is TTntListBox then
(Box as TTntListBox).Items.AddObject(_GetWideString(s), obj)
else
(Box as TTntRadioGroup).Items.AddObject(_GetWideString(s), obj)
end;
{$ELSE}
if Box is TComboBox then
(Box as TComboBox).Items.AddObject(s, obj)
else if Box is TListBox then
(Box as TListBox).Items.AddObject(s, obj)
else
(Box as TRadioGroup).Items.AddObject(s, obj)
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetXBoxItemIndex(Box: TControl;
ItemIndex: Integer);
begin
{$IFDEF USERVKSDEVTE}
if Box is TTeComboBox then
(Box as TTeComboBox).ItemIndex := ItemIndex
else if Box is TTeListBox then
(Box as TTeListBox).ItemIndex := ItemIndex
else
(Box as TTeRadioGroup).ItemIndex := ItemIndex;
{$ELSE}
{$IFDEF USERVTNT}
if Box is TTntComboBox then
(Box as TTntComboBox).ItemIndex := ItemIndex
else if Box is TTntListBox then
(Box as TTntListBox).ItemIndex := ItemIndex
else
(Box as TTntRadioGroup).ItemIndex := ItemIndex
{$ELSE}
if Box is TComboBox then
(Box as TComboBox).ItemIndex := ItemIndex
else if Box is TListBox then
(Box as TListBox).ItemIndex := ItemIndex
else
(Box as TRadioGroup).ItemIndex := ItemIndex;
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetListBoxSorted(Box: TControl);
begin
{$IFDEF USERVKSDEVTE}
(Box as TTeListBox).Sorted := True;
{$ELSE}
{$IFDEF USERVTNT}
(Box as TTntListBox).Sorted := True;
{$ELSE}
(Box as TListBox).Sorted := True;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetPageControlActivePageIndex(pc: TControl): Integer;
begin
{$IFDEF USERVKSDEVTE}
Result := (pc as TTePageControl).ActivePage.PageIndex;
{$ELSE}
{$IFDEF USERVTNT}
Result := (pc as TTntPageControl).ActivePage.PageIndex;
{$ELSE}
Result := (pc as TPageControl).ActivePage.PageIndex;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetPageControlActivePage(pc: TControl): TWinControl;
begin
{$IFDEF USERVKSDEVTE}
Result := (pc as TTePageControl).ActivePage;
{$ELSE}
{$IFDEF USERVTNT}
Result := (pc as TTntPageControl).ActivePage;
{$ELSE}
Result := (pc as TPageControl).ActivePage;
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetPageControlActivePage(pc: TControl; Page: TControl);
begin
{$IFDEF USERVKSDEVTE}
(pc as TTePageControl).ActivePage := TTeTabSheet(Page);
{$ELSE}
{$IFDEF USERVTNT}
(pc as TTntPageControl).ActivePage := TTntTabSheet(Page);
{$ELSE}
(pc as TPageControl).ActivePage := TTabSheet(Page);
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.HideTabSheet(ts: TControl);
begin
{$IFDEF USERVKSDEVTE}
(ts as TTeTabSheet).PageVisible := False;
{$ELSE}
{$IFDEF USERVTNT}
(ts as TTntTabSheet).TabVisible := False;
{$ELSE}
(ts as TTabSheet).TabVisible := False;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.IsTabSheetVisible(ts: TControl): Boolean;
begin
{$IFDEF USERVKSDEVTE}
Result := (ts as TTeTabSheet).PageVisible;
{$ELSE}
{$IFDEF USERVTNT}
Result := (ts as TTntTabSheet).TabVisible;
{$ELSE}
Result := (ts as TTabSheet).TabVisible;
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetFormCaption(const Caption: String);
begin
{$IFDEF USERVKSDEVTE}
tef.Caption := _GetWideString(Caption);
{$ELSE}
{$IFDEF USERVTNT}
Self.Caption := _GetWideString(Caption);
{$ELSE}
Self.Caption := Caption;
{$ENDIF}
{$ENDIF}
end;
type
TControlHack = class (TControl)
public
property Caption;
end;
procedure TfrmRVBase.SetControlCaption(Control: TControl;
const Caption: String);
begin
{$IFDEF USERVKSDEVTE}
if Control is TTeGroupBox then
TTeGroupBox(Control).Caption := _GetWideString(Caption)
else if Control is TTeButton then
TTeButton(Control).Caption := _GetWideString(Caption)
else if Control is TTeRadioButton then
TTeRadioButton(Control).Caption := _GetWideString(Caption)
else if Control is TTeCheckbox then
TTeCheckbox(Control).Caption := _GetWideString(Caption)
else if Control is TTeLabel then
TTeLabel(Control).Caption := _GetWideString(Caption)
else if Control is TTeEdit then
TTeEdit(Control).Text := Caption;
{$ELSE}
{$IFDEF USERVTNT}
if Control is TTntGroupBox then
TTntGroupBox(Control).Caption := _GetWideString(Caption)
else if Control is TTntButton then
TTntButton(Control).Caption := _GetWideString(Caption)
else if Control is TTntRadioButton then
TTntRadioButton(Control).Caption := _GetWideString(Caption)
else if Control is TTntCheckbox then
TTntCheckbox(Control).Caption := _GetWideString(Caption)
else if Control is TTntLabel then
TTntLabel(Control).Caption := _GetWideString(Caption)
else if Control is TTntEdit then
TTntEdit(Control).Text := Caption;
{$ELSE}
if Control is TEdit then
TEdit(Control).Text := Caption
else
TControlHack(Control).Caption := Caption;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetEditText(Edit: TControl): String;
begin
{$IFDEF USERVKSDEVTE}
Result := TTeEdit(Edit).Text;
{$ELSE}
{$IFDEF USERVTNT}
Result := TTntEdit(Edit).Text;
{$ELSE}
Result := TEdit(Edit).Text;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetEditFont(Edit: TControl): TFont;
begin
{$IFDEF USERVKSDEVTE}
Result := TTeEdit(Edit).Font;
{$ELSE}
{$IFDEF USERVTNT}
Result := TTntEdit(Edit).Font;
{$ELSE}
Result := TEdit(Edit).Font;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetEditSelLength(Edit: TControl): Integer;
begin
{$IFDEF USERVKSDEVTE}
Result := TTeEdit(Edit).SelLength;
{$ELSE}
{$IFDEF USERVTNT}
Result := TTntEdit(Edit).SelLength;
{$ELSE}
Result := TEdit(Edit).SelLength;
{$ENDIF}
{$ENDIF}
end;
function TfrmRVBase.GetEditSelStart(Edit: TControl): Integer;
begin
{$IFDEF USERVKSDEVTE}
Result := TTeEdit(Edit).SelStart;
{$ELSE}
{$IFDEF USERVTNT}
Result := TTntEdit(Edit).SelStart;
{$ELSE}
Result := TEdit(Edit).SelStart;
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetEditSelLength(Edit: TControl; Value: Integer);
begin
{$IFDEF USERVKSDEVTE}
TTeEdit(Edit).SelLength := Value;
{$ELSE}
{$IFDEF USERVTNT}
TTntEdit(Edit).SelLength := Value;
{$ELSE}
TEdit(Edit).SelLength := Value;
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetEditSelStart(Edit: TControl; Value: Integer);
begin
{$IFDEF USERVKSDEVTE}
TTeEdit(Edit).SelStart := Value;
{$ELSE}
{$IFDEF USERVTNT}
TTntEdit(Edit).SelStart := Value;
{$ELSE}
TEdit(Edit).SelStart := Value;
{$ENDIF}
{$ENDIF}
end;
procedure TfrmRVBase.SetEditSelText(Edit: TControl; const s: String);
begin
{$IFDEF USERVKSDEVTE}
TTeEdit(Edit).InsertText(s);
{$ELSE}
{$IFDEF USERVTNT}
TTntEdit(Edit).SelText := s;
{$ELSE}
TEdit(Edit).SelText := s;
{$ENDIF}
{$ENDIF}
end;
{$IFDEF RVASKINNED}
function CompareTabOrders(Item1, Item2: Pointer): Integer;
begin
if TControl(Item1) is TWinControl then
if TControl(Item2) is TWinControl then
Result := TWinControl(Item1).TabOrder-TWinControl(Item2).TabOrder
else
Result := 1
else
if TControl(Item2) is TWinControl then
Result := -1
else
Result := 0;
end;
procedure TfrmRVBase.OnCreateThemedControl(OldControl,
NewControl: TControl);
begin
end;
function TfrmRVBase.IsThemeAllowedFor(Component: TComponent): Boolean;
begin
Result := True;
end;
procedure TfrmRVBase.MoveChildren(OldControl, NewControl: TWinControl);
var i: Integer;
Children: TList;
begin
Children := TList.Create;
for i := OldControl.ControlCount-1 downto 0 do
Children.Add(OldControl.Controls[i]);
Children.Sort(CompareTabOrders);
for i := 0 to Children.Count-1 do
TControl(Children[i]).Parent := NewControl;
end;
{$ENDIF}
{$IFDEF USERVKSDEVTE}
function TfrmRVBase.IsTeFormAllowed: Boolean;
begin
Result := True;
end;
procedure TfrmRVBase.ApplyKSDevThemeEngine;
var teb: TTeButton;
terb: TTeRadioButton;
tecb: TTeCheckBox;
tegb: TTeGroupBox;
tecmb: TTeComboBox;
tetxt: TTeEdit;
tepc: TTePageControl;
tets: TTeTabSheet;
telbl: TTeLabel;
terg: TTeRadioGroup;
telst: TTeListBox;
i, j: Integer;
DialogBorder: Boolean;
ATabOrder: Integer;
ScrollAdapter: TTeaScrollAdapter;
begin
ScrollAdapter := nil;
if IsTeFormAllowed then begin
DialogBorder := BorderStyle=bsDialog;
tef := TTeForm.Create(Self);
if DialogBorder then begin
BorderStyle := bsSizeable;
tef.BorderStyle := kbsDialog;
tef.Dragging.Sizeable := False;
end;
tef.BorderIcons := tef.BorderIcons - [kbiMaximize, kbiMinimize, kbiRollUp];
RVA_Events.DoOnCreateTeForm(Self, tef);
tef.Loaded;
end;
for i := ComponentCount-1 downto 0 do begin
if not IsThemeAllowedFor(Components[i]) then
continue;
if Components[i] is TButton then
with TButton(Components[i]) do begin
teb := TTeButton.Create(Self);
teb.SetBounds(Left,Top,Width,Height);
teb.Caption := _GetWideString(Caption);
teb.OnClick := OnClick;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -