ТИПЫ КЛАССОВ
Подскажите пожалуйста какие типы классов реализованы в скриптовом языке .
Почему на такой код SL ругается.
Var
f:TForm;
b:TButton;
procedure ButtonClick(Sender:TButton);
begin
ShowMessage(Sender.Name);
f.ModalResult:=mrOk;
end;
procedure ButtonMouseMove(Sender: TButton);
begin
b.Caption:='moved over';
end;
Begin
f:= TForm.Create(nil);
with f do
begin
Caption:='ZDOROBO!';
BorderStyle:=bsDialog;
Position:=poScreenCenter;
end;
b:=TButton.Create(f);
with b do
begin
Name:='Button1';
Parent:=f;
SetBounds(20,20,175,55);
Caption:='CLICK MI';
OnClick:=@ButtonClick;{same as b.OnClick:='ButtonClick'}
OnMouseMove:=@ButtonMouseMove;
end;
with f do
begin
ShowModal;
Free;
end;
end.
Could not convert variant of type (NULL)into type (String)
С уважением Михаил.
Почему на такой код SL ругается.
Var
f:TForm;
b:TButton;
procedure ButtonClick(Sender:TButton);
begin
ShowMessage(Sender.Name);
f.ModalResult:=mrOk;
end;
procedure ButtonMouseMove(Sender: TButton);
begin
b.Caption:='moved over';
end;
Begin
f:= TForm.Create(nil);
with f do
begin
Caption:='ZDOROBO!';
BorderStyle:=bsDialog;
Position:=poScreenCenter;
end;
b:=TButton.Create(f);
with b do
begin
Name:='Button1';
Parent:=f;
SetBounds(20,20,175,55);
Caption:='CLICK MI';
OnClick:=@ButtonClick;{same as b.OnClick:='ButtonClick'}
OnMouseMove:=@ButtonMouseMove;
end;
with f do
begin
ShowModal;
Free;
end;
end.
Could not convert variant of type (NULL)into type (String)
С уважением Михаил.
на данный момент реализована поддержка:
[spoiler]TControl
property TControl.Parent
procedure TControl.Hide
procedure TControl.Show
procedure TControl.SetBounds(ALeft, ATop, AWidth, AHeight: Integer)
event TControl.OnCanResize
event TControl.OnClick
event TControl.OnDblClick
event TControl.OnMouseDown
event TControl.OnMouseMove
event TControl.OnMouseUp
event TControl.OnResize
TWinControl
procedure TWinControl.SetFocus
event TWinControl.OnEnter
event TWinControl.OnExit
event TWinControl.OnKeyDown
event TWinControl.OnKeyPress
event TWinControl.OnKeyUp
TCustomControl
TGraphicControl
TGroupBox
TLabel
TEdit
TMemo
TCustomComboBox
property TCustomComboBox.DroppedDown
property TCustomComboBox.ItemIndex
TComboBox
TButton
TCheckBox
TRadioButton
TCustomListBox
property TCustomListBox.ItemIndex
property TCustomListBox.SelCount
property TCustomListBox.Selected
TListBox
TControlScrollBar
TScrollingWinControl
TScrollBox
TCustomForm
procedure TCustomForm.Close
procedure TCustomForm.Hide
procedure TCustomForm.Show
function TCustomForm.ShowModal: Integer
event TCustomForm.OnActivate
event TCustomForm.OnClose
event TCustomForm.OnCloseQuery
event TCustomForm.OnCreate
event TCustomForm.OnDestroy
event TCustomForm.OnDeactivate
event TCustomForm.OnHide
event TCustomForm.OnPaint
event TCustomForm.OnShow
property TCustomForm.ModalResult
TForm
type TModalResult
type TCursor
type TShiftState
type TAlignment
type TAlign
type TMouseButton
type TAnchors
type TBevelCut
type TTextLayout
type TEditCharCase
type TScrollStyle
type TComboBoxStyle
type TCheckBoxState
type TListBoxStyle
type TFormBorderStyle
type TWindowState
type TFormStyle
type TBorderIcons
type TPosition
type TCloseAction
TChartValueList
TChartAxisTitle
TChartAxis
TCustomChartLegend
TChartLegend
TSeriesMarks
TChartGradient
TChartWall
TChartBrush
TChartTitle
TChartSeries
procedure TChartSeries.Clear
procedure TChartSeries.Add(const AValue: Double; const ALabel: String; AColor: TColor)
TSeriesPointer
TCustomSeries
TLineSeries
TPointSeries
TAreaSeries
TCustomBarSeries
TBarSeries
THorizBarSeries
TCircledSeries
TPieSeries
TFastLineSeries
TCustomChart
TChart
type TChartValue
type TLegendStyle
type TLegendAlignment
type TLegendTextStyle
type TChartListOrder
type TGradientDirection
type TSeriesMarksStyle
type TAxisLabelStyle
type THorizAxis
type TVertAxis
type TTeeBackImageMode
type TPanningMode
type TSeriesPointerStyle
type TMultiArea
type TMultiBar
type TBarStyle
TObject
constructor TObject.Create
procedure TObject.Free
TPersistent
procedure TPersistent.Assign(Source: TPersistent)
TList
function TList.Add(Item: TObject): Integer
procedure TList.Clear
procedure TList.Delete(Index: Integer)
function TList.IndexOf(Item: TObject): Integer
procedure TList.Insert(Index: Integer; Item: TObject)
function TList.Remove(Item: TObject): Integer
property TList.Count
property TList.Items
TStrings
function TStrings.Add(const S: string): Integer
function TStrings.AddObject(const S: string; AObject: TObject): Integer
procedure TStrings.Clear
procedure TStrings.Delete(Index: Integer)
function TStrings.IndexOf(const S: string): Integer
function TStrings.IndexOfName(const Name: string): Integer
function TStrings.IndexOfObject(AObject: TObject): Integer
procedure TStrings.Insert(Index: Integer; const S: string)
procedure TStrings.InsertObject(Index: Integer; const S: string; AObject: TObject)
procedure TStrings.LoadFromFile(const FileName: string)
procedure TStrings.LoadFromStream(Stream: TStream)
procedure TStrings.SaveToFile(const FileName: string)
procedure TStrings.SaveToStream(Stream: TStream)
property TStrings.CommaText
property TStrings.Count
property TStrings.Names
property TStrings.Objects
property TStrings.Values
property TStrings.Strings
property TStrings.Text
TStringList
function TStringList.Find(s: String; var Index: Integer): Boolean
procedure TStringList.Sort
property TStringList.Duplicates
property TStringList.Sorted
TStream
function TStream.Read(Buffer: string; Count: Longint): Longint
function TStream.Write(Buffer: string; Count: Longint): Longint
function TStream.Seek(Offset: Longint; Origin: Word): Longint
function TStream.CopyFrom(Source: TStream; Count: Longint): Longint
property TStream.Position
property TStream.Size
TFileStream
constructor TFileStream.Create(Filename: String; Mode: Word)
TMemoryStream
procedure TMemoryStream.Clear
procedure TMemoryStream.LoadFromStream(Stream: TStream)
procedure TMemoryStream.LoadFromFile(Filename: String)
procedure TMemoryStream.SaveToStream(Stream: TStream)
procedure TMemoryStream.SaveToFile(Filename: String)
TComponent
constructor TComponent.Create(AOwner: TComponent)
property TComponent.Owner
TfsXMLItem
constructor TfsXMLItem.Create
procedure TfsXMLItem.AddItem(Item: TfsXMLItem)
procedure TfsXMLItem.Clear
procedure TfsXMLItem.InsertItem(Index: Integer; Item: TfsXMLItem)
function TfsXMLItem.Add: TfsXMLItem
function TfsXMLItem.Find(const Name: String): Integer
function TfsXMLItem.FindItem(const Name: String): TfsXMLItem
function TfsXMLItem.Prop(const Name: String): String
function TfsXMLItem.Root: TfsXMLItem
property TfsXMLItem.Data
property TfsXMLItem.Count
property TfsXMLItem.Items
property TfsXMLItem.Name
property TfsXMLItem.Parent
property TfsXMLItem.Text
TfsXMLDocument
constructor TfsXMLDocument.Create
procedure TfsXMLDocument.SaveToStream(Stream: TStream)
procedure TfsXMLDocument.LoadFromStream(Stream: TStream)
procedure TfsXMLDocument.SaveToFile(const FileName: String)
procedure TfsXMLDocument.LoadFromFile(const FileName: String)
property TfsXMLDocument.Root
const fmCreate
const fmOpenRead
const fmOpenWrite
const fmOpenReadWrite
const fmShareExclusive
const fmShareDenyWrite
const fmShareDenyNone
const soFromBeginning
const soFromCurrent
const soFromEnd
TCommonDialog
function TCommonDialog.Execute: Boolean
TOpenDialog
TSaveDialog
TColorDialog
TFontDialog
TPrintDialog
TPrinterSetupDialog
type TOpenOptions
type TFileEditStyle
type TColorDialogOptions
type TFontDialogOptions
type TFontDialogDevice
type TPrintRange
type TPrintDialogOptions
[/spoiler]
В ближайших релизах добавим:
[spoiler]
TShape
TPaintBox
event TPaintBox.OnPaint
TImage
TBevel
TTimer
event TTimer.OnTimer
TPanel
TSplitter
TBitBtn
TSpeedButton
TCheckListBox
property TCheckListBox.Checked
TTabControl
TTabSheet
TPageControl
procedure TPageControl.SelectNextPage(GoForward: Boolean)
property TPageControl.PageCount
property TPageControl.Pages
TStatusPanel
TStatusPanels
function TStatusPanels.Add: TStatusPanel
property TStatusPanels.Items
TStatusBar
TTreeNode
procedure TTreeNode.Delete
function TTreeNode.EditText: Boolean
property TTreeNode.Count
property TTreeNode.Data
property TTreeNode.ImageIndex
property TTreeNode.SelectedIndex
property TTreeNode.StateIndex
property TTreeNode.Text
TTreeNodes
function TTreeNodes.Add(Node: TTreeNode; const S: string): TTreeNode
function TTreeNodes.AddChild(Node: TTreeNode; const S: string): TTreeNode
procedure TTreeNodes.BeginUpdate
procedure TTreeNodes.Clear
procedure TTreeNodes.Delete(Node: TTreeNode)
procedure TTreeNodes.EndUpdate
property TTreeNodes.Count
property TTreeNodes.Item
TTreeView
procedure TTreeView.FullCollapse
procedure TTreeView.FullExpand
property TTreeView.Selected
property TTreeView.TopItem
TTrackBar
TProgressBar
TListColumn
TListColumns
function TListColumns.Add: TListColumn
property TListColumns.Items
TListItem
procedure TListItem.Delete
function TListItem.EditCaption: Boolean
property TListItem.Caption
property TListItem.Checked
property TListItem.Data
property TListItem.ImageIndex
property TListItem.Selected
property TListItem.StateIndex
property TListItem.SubItems
TListItems
function TListItems.Add: TListItem
procedure TListItems.BeginUpdate
procedure TListItems.Clear
procedure TListItems.Delete(Index: Integer)
procedure TListItems.EndUpdate
property TListItems.Count
property TListItems.Item
TIconOptions
TListView
TToolButton
TToolBar
TMonthCalColors
TDateTimePicker
TMonthCalendar
type TShapeType
type TBevelStyle
type TBevelShape
type TResizeStyle
type TButtonLayout
type TButtonState
type TButtonStyle
type TBitBtnKind
type TNumGlyphs
type TTabPosition
type TTabStyle
type TStatusPanelStyle
type TStatusPanelBevel
type TSortType
type TTrackBarOrientation
type TTickMark
type TTickStyle
type TProgressBarOrientation
type TIconArrangement
type TListArrangement
type TViewStyle
type TToolButtonStyle
type TDateTimeKind
type TDTDateMode
type TDTDateFormat
type TDTCalAlignment
type TCalDayOfWeek
TFont
TPen
TBrush
TCanvas
procedure TCanvas.Draw(X, Y: Integer; Graphic: TGraphic)
procedure TCanvas.Ellipse(X1, Y1, X2, Y2: Integer)
procedure TCanvas.LineTo(X, Y: Integer)
procedure TCanvas.MoveTo(X, Y: Integer)
procedure TCanvas.Rectangle(X1, Y1, X2, Y2: Integer)
procedure TCanvas.RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer)
procedure TCanvas.StretchDraw(X1, Y1, X2, Y2: Integer; Graphic: TGraphic)
function TCanvas.TextHeight(const Text: string): Integer
procedure TCanvas.TextOut(X, Y: Integer; const Text: string)
function TCanvas.TextWidth(const Text: string): Integer
property TCanvas.Pixels
TGraphic
procedure TGraphic.LoadFromFile(const Filename: string)
procedure TGraphic.SaveToFile(const Filename: string)
property TGraphic.Height
property TGraphic.Width
TMetafile
TMetafileCanvas
TBitmap
property TBitmap.Canvas
type TFontStyles
type TFontPitch
type TPenStyle
type TPenMode
type TBrushStyle
[/spoiler]
Текст скрипта из вопроса
Var f:TForm; b:TButton; procedure ButtonClick(Sender:TButton); begin //ShowMessage(Sender.Name); if f <> nil then f.ModalResult := mrOk; end; procedure ButtonMouseMove(Sender: TButton); begin if b <> nil then b.Caption:='moved over'; end; begin f := TForm.Create(nil); with f do begin Caption := 'ZDOROBO!'; BorderStyle := bsDialog; Position := poScreenCenter; end; b := TButton.Create(f); with b do begin Name := 'Button1'; Parent := f; SetBounds(20, 20, 175, 55); Caption := 'CLICK MI'; OnClick := @ButtonClick; OnMouseMove:=@ButtonMouseMove; end; with f do begin ShowModal; Free; end; end.
Ваш код успешно компилируется и выполняется. Укажите версию SIMP? Единственное замечание по коду не использовать внутри обработчика нажатия на кнопку, показ сообщения. Объясню почему, сообщение выводится в не модальном режиме, т.е. выполнение Вашего кода продолжается, и исходя из логики созданная форма разрушается, далее после нажатия на кнопку в окне диалога, производится возврат в уже удаленную область, что приведет к ошибке.