REALBasic问题

在REALBasic中,如何遍历Window1中的所有对象? Window1及其所有子节点是否有一些数组属性?另外,如何设置对象的自定义属性:例如Me.isFlamingo = true 提前致谢!     
已邀请:
要遍历窗口上的控件,请使用以下代码:
  ListBox1.DeleteAllRows

  For i As Integer = 0 To Self.ControlCount-1
    ListBox1.AddRow(Self.Control(i).Name)
  Next
(对于此示例,请务必向窗口添加至少一个ListBox。) 属性的设置与您描述的类似:ObjectInstance.PropertyName。 如果您遇到已拖动到窗口的对象,则可以使用Me.PropertyName修改其属性。否则,您将使用对象名称。     
将属性添加到内置类(如按钮)可以通过两种方式完成。更好的方法是子类化PushBustton类并向子类添加属性,就像使用任何自定义类一样。另一种有点丑陋的方法是使用一对像这样的重载函数:
Function isFlamingo(Extends ByRef pb As PushButton) As Boolean
  Dim flamingo As Boolean
  //Do stuff to figure out if the PushButton is Flamingo-y
  //and Return a Boolean based on the result
  Return flamingo
End Function
和:
Sub isFlamingo(Extends ByRef pb As PushButton, Assigns b As Boolean)
  If b Then
    //Do stuff that makes the PushButton flamingo-y
  Else
    //Do stuff that makes the PushButton not flamingo-y
  End If
End Sub
    

要回复问题请先登录注册