My suspicion is This is not possible, but …
I do have a solution to my problem that doesn’t use any references to any window, but I’m just looking for info. If you can think of a way please post. Otherwise I’ll eventually delete this question.
I have a window which I usually open as modal window (BWindow or child), I would like to reopen or Convert this BWindow into a non-modal window. I use BWindow to display data from a row from a dictionary (AWindow or parent). The BWindow is good for enabling copying data from one place in the program to another.
BWindow has a property (PWind as Window) that is a reference to the Parent Window. That means I cannot access parent windows peculiar properties and methods.
I also have an AWindow (dictionary or just parent window) that I use for searching for records and Id like to open several windows of this BWindow modal type. I also need to keep a reference (?) in the Dictionary as it has an array of type window.
AWindow has a property (CDw as Window) as a reference to the child window. That means I cannot access child windows peculiar properties and methods
My problem is in the conversion from modal window to a normal window.
One Advantage apparently with this modal / child window system is I can close the parent without memory problems.
There are 3 problems with this conversion to not modal.
Cannot use WeakRef. I apparently cannot use WeakRef as a way to add an element to an array of windows.
CDw = New WeakRef(LilDWindow) will not compile
Cannot subclass a window. I apparently cannot subclass a window. If I could, then I could access the others methods and uhmm personal properties.
References cannot actually access the other windows methods; only properties.
The basic problem is BWindow also has a reference to the opening window. This has the purpose of calling the parent window AWindow, if there is an array, and BWindow is closed, that AWindow can remove the array item to the BWindow.
You can. You just have to CAST the property to the correct type. Suppose the parent window has a property named ReferenceValue. You can access that via the generic PWind property by casting it to the correct window type.
myValue = ParentWindowType(PWind).ReferenceValue
I hope I understood the question. Note that you should use ISA to protect your code from IllegaleCastException errors.
Actually what I need mostly is for the other direction. From inside the Parent to the Child.
So, where do I find documentation on [quote]ParentWindowType[/quote] .
I think that is what I want, but I can’t find any reference except for you
You shared that word with me a while ago.
I have a couple of lines from the array version that I want. I’ll post the current and then modify it hopefully
the period between LilDWindow.CDw(i) says you want to reference the member CDw(i) of the class LilDWindow. By using the parentheses (note no period between LilDWindow and the opening parenthesis)
App.LilWinTitleD = LilDWindow(CDw(i)).Title
you are indicating you want to cast CDw(i) to the type LilDWindow.
Perhaps breaking it down by using an intermediate variable will make the syntax clearer:
Dim ldw As LilDWindow
If CDw(i) IsA LilDWindow Then
ldw = LilDWindow(CDw(i))
App.LilWinTitleD = ldw.Title
End If
Does this help? And as Tim suggested, wrap it in an IsA test so you don’t throw an exception if CDw(i) somehow is a reference to a different type of object.
[quote=374293:@Edward Palmer]Edward Palmer 2 hours ago Tampa, FL, USA
In your sample
App.LilWinTitleD = LilDWindow.CDw(i).Title
the period between LilDWindow.CDw(i) says you want to reference the member CDw(i) of the class LilDWindow. By using the parentheses (note no period between LilDWindow and the opening parenthesis)
App.LilWinTitleD = LilDWindow(CDw(i)).Title
you are indicating you want to cast CDw(i) to the type LilDWindow.[/quote]
Thanks. I have avoided learning how to cast, simply because I’ve had other things to learn.
Your example is very complete.
I miss the days when WE had a dictionary of terms that came with the IDE.
I also went looking for definitions of “cast” and “type cast” and they aren’t easy to understand and extrapolate.
It will be useful.