O$: Instance name from Subwindow
Fred Brinkman
fred.brinkman at euromnis.org
Mon Apr 13 19:21:09 EDT 2009
Bas,
No, I need the name of the class where the subwindow resides in...
$class().$name and $cinst().$classname give me the classname of the
subwindow itself
$cinst.$class.$name and $cinst.$wind.$class().$name give me the
classname of the window the subwindow resides in (the one I was
looking for)
As always it turns out there's more than one way to skin the cat...
Thanks for your insights,
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
*********************************************
Op 14 apr 2009, om 01:11 heeft Bastiaan Olij het volgende geschreven:
> Hi Fred.
>
> You need the classname for the subwindow? Well thats even easier. A
> subwindow lives within a subwindowfield and the subwindow field
> contains
> the information about the class of the window living within it. So
> anywhere within your subwindow code simply do $cinst().$classname
> ($classname is a property of your subwindow field). From outside
> access
> $classname on the subwindow field as you would with any other
> property,
> so $iwindows.mywindow.$objs.mysubwindowfield.$classname.
>
> If you need the class of a window you can also do $cinst.$class().
> $name.
> For some reason I remember that not working all to well on
> subwindows, i
> think because it defaults to trying to resolve this on the subwindow
> field. $cclass().$name can also work but that has some problems if you
> are running code in a super class.
>
> Code I often use if I have a class that can be both subwindow or
> window
> or for code in my baseclass window that is used by both windows and
> subwindows is:
> calculate lvClassName as
> pick(len($cinst().$classname),$cinst().$class().$name,
> $cinst().classname)
> Works 99% of the time for me.
>
> Greetz,
>
> Bas
>
> Fred Brinkman wrote:
>> Thanks Christine, Bas,
>>
>> Turns out I put my question the wrong way around... It should be a
>> bit
>> to early in the evening to make mistakes like this, but still...
>>
>> I had the instance ($cinst.$wind().$name) but I needed the class and
>> not the other way around... must be age.
>> I have 2 ways to get the name of the class from my subwindow in an
>> instance of that class, both giving the same result
>>
>> 1) $cinst.$wind.$class().$name
>> 2) $cwind.$class().$name
>>
>> is there a 'correct' or a 'preferred' one and if yes, why?
>>
>> 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
>> *********************************************
>>
>>
>>
>>
>>
>>
>>
>>
>> Op 14 apr 2009, om 00:36 heeft Bastiaan Olij het volgende geschreven:
>>
>>> 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
>>>
>>> _____________________________________________________________
>>> Manage your list subscriptions at http://lists.omnis-dev.com
>>
>> _____________________________________________________________
>> 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
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list