Yesterday, I talked about creating a class for custom tags for form controls.
In particular, I have a class I’ll call FormResizer. I want FormResizer to be able to set and read top, left, width, and height properties for the original attributes of the control so that the code can resize it to the correct aspect ratio.
So, right now, FormResizer is typically setup inside the form I want to resize.
I think there are different ways I could implement these custom tags.
Yesterday, I was imagining a custom wrapper for a control that could contain whatever tags I wanted.
But I want to review how I’m going to be using it. I have to visit every form on the control anyway and I’m going to be messing with the actual form properties. The best way to do this is to iterate over the Form Controls collection. Then I can look at each form control and set the properties. It would be nice to be able to extend the actual form control object to add my custom controls, but I really can’t do that because VBA doesn’t let you extend Access objects.
So I think creating a collection that will be indexed by control name with another collection inside with all the tags would be nice.
I’ll consider a structure now and some properties
Class: CustomTags
Method: Item(TagName As String) As String
This would return the set value of the tag. I am saying here you would use a string as the index and it would return a string.
CustomTags.Item(“originalTop”) = “0”
CustomTags.Item(“originalLeft”) = “0”
Hmm.. I don’t think I can end up doing that. Can I? I’m going to have to experiment I guess. That format would generally be a Property Set item. The problem is that you can’t pass an argument that way.
MAYBE I could make Item a collection and populate it with another custom class and make the default property of the class a value and I could create a setter to use it. I would want to do all that initialization internally though. But if the method “Item” returns a collection or even a specific instance of another class, then maybe this could work.
Ok, tomorrow I’ll dig deeper and see what I can do.