O$: Instance name from Subwindow

Bastiaan Olij lists at basenlily.nl
Mon Apr 13 18:36:54 EDT 2009


Hey Fred,

$cwind() as was mentioned before is the reference to the current window,
so the window itself that is open on which the subwindow resides. $cinst
points to the current instance which when you are running code within,
which would be your subwindow.
There is no direct path to the subwindow instance, its not in
'$iwindows' as it is contained within a window. $cinst().$name within
the subwindow therefor gives you the name of the subwindow field on the
window which is correct.

But prosuming your subwindow is directly on your parent window, you can
access the subwindow through notation through
$iwindows.mywindowinstance.$objs.mysubwindowfield

The funny thing is that notation wise, your subwindow instance is
superimposed ontop of the subwindow field so if the notation can be
resolved on the subwindow field, that is what you get, but if it can
not, Omnis then evaluates the notation towards the subwindow instance.
So $iwindows.mywindowinstance.$objs.mysubwindowfield.$top return the
$top value of the subwindow field relative to its container but
$iwindows.mywindowinstance.$objs.mysubwindowfield.$objs.$first().$top
returns the $top value of the first object within your subwindow instance.

You have to be careful where you place such code as you may end up using
your subwindow in other places as well and you do not want to be
dependent on a fixed notational path that may no longer be valid.

Alternatively you can simply use $cinst().$ref to get an item reference
to your subwindow instance.

Or on your subwindow field on your parent window use the old:
----
$construct
set reference ivSubWinRef as $cfield().$ref
----
trick.

Finally, you can always examine the outcome of $cinst().$fullname to get
the full notational path in text from within a method in your subwindow.

Hope that helps,

Bas

Fred Brinkman wrote:
> Guys,
>
> How do I get the name from the window-itance from within a subwindow
> in that instance?
> I tried things like $cinst.$wind().$name and alike but I always get
> the name of the window class (wMyWIndow), not the instance
> (wMyWindow_155)
>
> I know it's something obvious, but...
>
> Thanks
>
> Fred
>
>
>
> Fred Brinkman
> http://www.euromnis.org
>
> **********************************************
> Fred Brinkman Consultancy
> B-1000 Brussels
>
> Tel. +32-474-83 80 80
> Fax +32-2-330 10 31 (on request)
> mailto:fred.brinkman at euromnis.org
> *********************************************
>
>
>
>
>
>
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
>


-- 
Kindest Regards,

Bastiaan Olij
e-mail/MSN: bastiaan at basenlily.nl
web: http://www.basenlily.nl
Skype: Mux213
http://www.linkedin.com/in/bastiaanolij




More information about the omnisdev-en mailing list