Source code |
|
1 2 3 4 5 6 7 8 |
' Visual Basic 6.0 Private Sub MyControls() For Each Control in Me.Controls If TypeOf Control Is CheckBox Then Control.Value = False End If Next End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
Public Sub Form_Load() 'intended for the Jabaco framework 'in IDE add some controls and a ComboBox 'Note: for ComboBox and Slider the names are not being retrieved; why? They are recognized though!! For i = 0 To Me.Controls.size - 1 Debug.Print i & ". Control: " & Me.Controls.get(i).getClass Debug.Print i & ". Control: " & Me.Controls.get(i).toString If IsClass(Me.Controls.get(i), #JComboBox) Then Dim myCont As VB#ComboBox myCont = Cast(Me.Controls.get(i), VB#ComboBox) myCont.enabled = False End If Next i End Sub Public Property Get Controls() As java#util#ArrayList On Error Resume Next Dim comp() As java#awt#Component comp = getParentComponents.getComponents() Controls = New java#util#ArrayList Dim i As Integer, v As Integer For i = Ubound(comp) To 0 Step -1 Controls.add comp(i) If IsClass(comp(i), #PictureBox) Then Dim picCont As #PictureBox picCont = Cast(comp(i), #PictureBox) For v = 0 To picCont.getComponentCount() - 1 Controls.add picCont.Parent.getComponent(v) Next v ElseIf Isclass(comp(i), #Frame)Then Dim fraCont As #Frame fraCont = Cast(comp(i), #Frame) For v = 0 To fraCont.getComponentCount() - 1 Controls.add fraCont.Parent.getComponent(v) Next v End If Next i End Property Private Function getParentComponents() As Container ' Let the added component resize, If its Anchor wants it Dim comp() As java#awt#Component Dim i As Integer comp = Me.getComponents() Dim rootComp As Container For i = 0 To Ubound(comp) If comp(i).getClass.getName.equals("javax.swing.JRootPane") Then rootComp = Cast(comp(i), Container) End If Next i comp = rootComp.getComponents Dim layerComp As Container For i = 0 To Ubound(comp) If comp(i).getClass.getName.equals("javax.swing.JLayeredPane") Then layerComp = Cast(comp(i), Container) End If Next i comp = layerComp.getComponents Dim panelComp As Container For i = 0 To Ubound(comp) If comp(i).getClass.getName.equals("javax.swing.JPanel") Then panelComp = Cast(comp(i), Container) End If Next i comp = panelComp.getComponents Dim boxComp As Container For i = 0 To Ubound(comp) If comp(i).getClass.getName.equals("VB.Form$PictureBox") Then boxComp = Cast(comp(i), Container) End If Next i getParentComponents = boxComp End Function Private Sub AnchorResize() Dim comp() As java#awt#Component Dim i As Integer comp = getParentComponents().getComponents For i = 0 To Ubound(comp) If IsClass(comp(i), VB#IJabacoControl) Then Dim myCont As VB#IJabacoControl myCont = Cast(comp(i) , VB#IJabacoControl) myCont.ResizeTrigger(Parent.getContentPane.getWidth, Parent.getContentPane.getHeight) End If Next i End Sub |
Quoted
For some reason for ComboBox and Slider Control names are not being retrieved. They are accessible though!
I don't know why.
Jabaco Source |
|
1 2 3 |
Public Sub Command1_Click() Debug.print Me End Sub |
Source code |
|
1 |
Form1[frame0,386,263,508x434,layout=java.awt.BorderLayout,title=Form,resizable,normal,defaultCloseOperation=EXIT_ON_CLOSE,rootPane=javax.swing.JRootPane[,4,30,500x400,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true] |
Jabaco Source |
|
1 2 3 4 5 6 7 |
Public Sub Command1_Click() Debug.print Me End Sub Public Function toString() As String toString = "I am the Form component" End Function |
Quoted
I am the Form component
This post has been edited 1 times, last edit by "theuserbl" (Feb 3rd 2014, 12:45am)
Source code |
|
1 2 |
For some reason for ComboBox and Slider Control names are not being retrieved. They are accessible though! I don't know why. |
Jabaco Source |
|
1 |
Me.Controls.get(i).getClass |
Jabaco Source |
|
1 |
Debug.Print i & ". Control: " & Me.Controls.get(i).hashCode |
Source code |
|
1 |
Public Property Get Controls() As java#util#ArrayList |