You are not logged in.

Dani

Intermediate

  • "Dani" started this thread

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

1

Saturday, April 12th 2014, 12:03pm

Me.Controls - Collection / now available for the Jabaco Framework

Hey there,

I am kind of in a hurry today so I will just outline here:

inspired by theuserbls' Anchor implementation I came up with a Form.Controls Property aproach.
as described here:
Me.Controls - Collection

I have now uploaded the code to the framework!
Use it like this:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
Public Sub Form_Load()
   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


It works for Dialogs too.

From what I read about java#awt#Component there seems to be no way to retrieve a components name given at designtime after compilation.
Simply because it is only a reference for the programmer and removed at runtime! So you are getting the type of component in the component array!
This is enough to bulk change properties when you have many controls of a kind (e.g. the backcolor of 100 labels)
However, it is possible to uniquely identify a component within its lifecycle by its hashCode:

Jabaco Source

1
Debug.Print i & ". Control: " & Me.Controls.get(i).hashCode


Dialogs can now also make use of theuserbls' Anchor property.


Dani

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

2

Saturday, April 12th 2014, 1:38pm

Nice. :)
Thanks for your contribution.

Binary of the Jabaco Framework is is uploaded again. You can download it at:
[ http://www.jabaco.org/wiki/Latest_JabacoFramework_Binary ]


Additional information:
For most controls other then the usercontrol, it will possible more helpful to write instead

Jabaco Source

1
Debug.Print i & ". Control: " & Me.Controls.get(i).getClass
this one:

Jabaco Source

1
Debug.Print i & ". Control: " & Me.Controls.get(i).getClass.getSuperclass


To combine both posts, I want to mention, that Dani have already before written about it:
[ http://www.jabaco.org/board/1097-me-controls-collection.html ]

Greatings
theuserbl

Rate this thread
WoltLab Burning Board