[Laszlo-dev] Positioning of imported library views

P T Withington ptw at pobox.com
Fri Sep 16 12:46:24 PDT 2005


Yep, we do get lots of cross-pollination on the lists and users  
helping users.  But you can be sure us 'paid' developers watch the  
lists looking for ways we can improve things and help out when we  
can.  I just wanted to point out the other options that are  
available, if you need better/faster responses.

On 16 Sep 2005, at 15:21, dhay at lexmark.com wrote:

>
> I'll talk to my boss, but I think a lot of people using open  
> source, and
> probably us too, are limited to the regular forums and mailing  
> lists except
> maybe in special circumstances.
>
> Using other open source project, like Struts, I was able to help  
> others
> when I got up to speed, and contributed to the source itself.  When  
> I get
> up to speed with Lazlo you can be sure I'll be helping where I can...
>
> cheers,
>
> David
>
>
>
> |---------+---------------------------->
> |         |           P T Withington   |
> |         |           <ptw at pobox.com>  |
> |         |                            |
> |         |           09/16/2005 02:57 |
> |         |           PM               |
> |         |                            |
> |---------+---------------------------->
>
>> --------------------------------------------------------------------- 
>> ----------------------------------------------------|
>>
>    
> |                                                                      
>                                                     |
>   |       To:        
> dhay at lexmark.com                                                       
>                                   |
>   |       cc:       laszlo- 
> dev at openlaszlo.org                                                     
>                            |
>   |       Subject:  Re: [Laszlo-dev] Positioning of imported  
> library views                                                  |
>
>> --------------------------------------------------------------------- 
>> ----------------------------------------------------|
>>
>
>
>
>
> Depending on your needs, you might consider either a support contract
> or using the Forums, where you can buy a-la-carte help (you can
> 'accelerate' a question for something like $200 I believe.
>
> In this particular case, I happened to know the answer off the top of
> my head so it was easy to respond and I think the question/answer
> will be useful to the general community.  But, clearly for harder or
> more project-specific questions, those from people with support
> contracts or accelerated questions take precedence.
>
> As to the place for 'somewhat tricky solutions' I think the mailing
> lists and forums are it.  Oyr doc team keeps an eye on all this stuff
> and will move generally applicable info into the doc.
>
> On 16 Sep 2005, at 14:36, dhay at lexmark.com wrote:
>
>
>>
>> Yes indeed!  I'm the Laszlo evangelist here in our office, and the
>> main
>> reason we are trying it on this project.  I've now got a class which
>> subclasses tabpane which loads a library when it is selected for
>> the first
>> time, so I'll post the code to the user list and forum in case it
>> helps
>> anyone else out there.  Is there a place that could house  
>> solutions to
>> "somewhat tricky situations"?
>>
>> We're finding the learning curve for straightforward stuff is fine,
>> but
>> when you try and do less straightforward things, it can be very
>> frustrating
>> to not find the answer in the docs, and have to bug people on the
>> mailing
>> list.
>>
>> I'm still having problems loading a library programmatically, so
>> I'm about
>> to post that on the list!
>>
>> I really do appreciate your help.
>>
>> cheers,
>>
>> David
>>
>>
>>
>> |---------+---------------------------->
>> |         |           P T Withington   |
>> |         |           <ptw at pobox.com>  |
>> |         |                            |
>> |         |           09/16/2005 02:28 |
>> |         |           PM               |
>> |         |                            |
>> |---------+---------------------------->
>>
>>
>>> -------------------------------------------------------------------- 
>>> -
>>> ----------------------------------------------------|
>>>
>>>
>>
>> |
>>                                                     |
>>   |       To:
>> dhay at lexmark.com
>>                                   |
>>   |
>> cc:
>>                                             |
>>   |       Subject:  Re: [Laszlo-dev] Positioning of imported
>> library views                                                  |
>>
>>
>>> -------------------------------------------------------------------- 
>>> -
>>> ----------------------------------------------------|
>>>
>>>
>>
>>
>>
>>
>> That's what open source is for.  :P
>>
>> Hey, I hope you're going to give Laszlo some nice publicity in  
>> return.
>>
>> On 16 Sep 2005, at 12:34, dhay at lexmark.com wrote:
>>
>>
>>
>>>
>>> Thanks!!
>>>
>>> That works great.  If only Laszlo's documentation was more detailed
>>> regarding the more complicated stuff!
>>>
>>> cheers,
>>>
>>> David
>>> x54680
>>>
>>>
>>> |---------+---------------------------->
>>> |         |           P T Withington   |
>>> |         |           <ptw at pobox.com>  |
>>> |         |                            |
>>> |         |           09/15/2005 10:59 |
>>> |         |           PM               |
>>> |         |                            |
>>> |---------+---------------------------->
>>>
>>>
>>>
>>>> ------------------------------------------------------------------- 
>>>> -
>>>> -
>>>> ----------------------------------------------------|
>>>>
>>>>
>>>>
>>>
>>> |
>>>                                                     |
>>>   |       To:
>>> dhay at lexmark.com
>>>                                   |
>>>   |       cc:       laszlo-
>>> dev at openlaszlo.org
>>>                            |
>>>   |       Subject:  Re: [Laszlo-dev] Positioning of imported
>>> library views                                                  |
>>>
>>>
>>>
>>>> ------------------------------------------------------------------- 
>>>> -
>>>> -
>>>> ----------------------------------------------------|
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> to dynamically attach a method to an event:
>>>
>>> <class ...>
>>>    <method name="doit"> ... </method>
>>>
>>>    <method event="init">
>>>      super.init();
>>>      this.myDel = new LzDelegate(this, 'doit', libraryName,
>>> 'onload');
>>>    </method>
>>>
>>> you need to clean up your delegate manually, if you destroy
>>> instances, or you will leak memory:
>>>
>>>    <method name="destroy">
>>>      this.myDel.unregisterAll();  // should probably be called
>>> destroy...
>>>      super.destroy();
>>>    </method>
>>>
>>> </class>
>>>
>>>
>>> On 15 Sep 2005, at 18:15, dhay at lexmark.com wrote:
>>>
>>>
>>>
>>>
>>>>
>>>> That's cool!  Didn't know you could do that!
>>>>
>>>> One more question, if you don't mind - I'm now wanting to include
>>>> the
>>>> loading within the tabpane custom class, so it's all encapsulated
>>>> there,
>>>> and each tabpane instance can just specify the name of the library
>>>> and
>>>> class to load.
>>>>
>>>> But that means that the reference="xxx" must be created dynamically
>>>> from
>>>> the library name received.
>>>>
>>>> Is there a way to do this too (the library name currently gets
>>>> passed in as
>>>> an attribute)?
>>>>
>>>> cheers,
>>>>
>>>> David
>>>>
>>>>
>>>>
>>>> |---------+---------------------------->
>>>> |         |           P T Withington   |
>>>> |         |           <ptw at pobox.com>  |
>>>> |         |                            |
>>>> |         |           09/15/2005 04:08 |
>>>> |         |           PM               |
>>>> |         |                            |
>>>> |---------+---------------------------->
>>>>
>>>>
>>>>
>>>>
>>>>> ------------------------------------------------------------------ 
>>>>> -
>>>>> -
>>>>> -
>>>>> ----------------------------------------------------|
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> |
>>>>                                                     |
>>>>   |       To:
>>>> dhay at lexmark.com
>>>>                                   |
>>>>   |       cc:       laszlo-
>>>> dev at openlaszlo.org
>>>>                            |
>>>>   |       Subject:  Re: [Laszlo-dev] Positioning of imported
>>>> library views                                                  |
>>>>
>>>>
>>>>
>>>>
>>>>> ------------------------------------------------------------------ 
>>>>> -
>>>>> -
>>>>> -
>>>>> ----------------------------------------------------|
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> You should be able to make a delegate that directly listens for the
>>>> onload from the import and instantiates the class (or calls a  
>>>> method
>>>> to do so).  Something like:
>>>>
>>>>    <method event="onload" reference="blueview">
>>>>       this.makeChild({name: 'blueview', ...});
>>>>    </method>
>>>>
>>>>
>>>> On 15 Sep 2005, at 15:18, dhay at lexmark.com wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I guess that makes sense, but severely limits the usefulness of  
>>>>> the
>>>>> import
>>>>> statement IMHO.
>>>>>
>>>>> Thanks for the tip - I create a class now which subclasses LzView
>>>>> and then
>>>>> when I've checked that the library has loaded I create an instance
>>>>> of it.
>>>>>
>>>>> By the way, am I missing an easy way to check that the library has
>>>>> loaded?
>>>>> I currently do the following, which seems way to much:
>>>>>
>>>>> - add onload() to <import> which calls a method to set a global
>>>>> variable
>>>>> "loaded" to true
>>>>> - in my tabpane onselected method, I load the library and then set
>>>>> up a
>>>>> delegate and timer which calls a method to see if the variable
>>>>> "loaded" is
>>>>> true, and if not resets the timer.  If it is true, I load the
>>>>> class.
>>>>>
>>>>> cheers,
>>>>>
>>>>> David
>>>>> x54680
>>>>>
>>>>>
>>>>> |---------+---------------------------->
>>>>> |         |           P T Withington   |
>>>>> |         |           <ptw at pobox.com>  |
>>>>> |         |                            |
>>>>> |         |           09/15/2005 02:01 |
>>>>> |         |           PM               |
>>>>> |         |                            |
>>>>> |---------+---------------------------->
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> ----------------------------------------------------------------- 
>>>>>> -
>>>>>> -
>>>>>> -
>>>>>> -
>>>>>> ----------------------------------------------------|
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> |
>>>>>                                                     |
>>>>>   |       To:
>>>>> dhay at lexmark.com
>>>>>                                   |
>>>>>   |       cc:       laszlo-
>>>>> dev at openlaszlo.org
>>>>>                            |
>>>>>   |       Subject:  Re: [Laszlo-dev] Positioning of imported
>>>>> library views                                                  |
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> ----------------------------------------------------------------- 
>>>>>> -
>>>>>> -
>>>>>> -
>>>>>> -
>>>>>> ----------------------------------------------------|
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Perhaps not intuitive, but that is the expected behavior.  Your
>>>>> import statement is at the top level.  The load() tells that  
>>>>> import
>>>>> to load, not where.
>>>>>
>>>>> To get the effect you want, you could define a class in your
>>>>> library
>>>>> and instantiate it dynamically.
>>>>>
>>>>> On 15 Sep 2005, at 12:34, dhay at lexmark.com wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I imported a library which contains a view, from within a
>>>>>> tabpane.  I
>>>>>> expected it to be included in the layout of that tabpane, but it
>>>>>> seems to
>>>>>> be added after all the tabs.  (code below).
>>>>>>
>>>>>> Can someone explain what's happening here, please?  Is this a
>>>>>> bug?  is
>>>>>> there a way to tell Laszlo to include it within the current pane?
>>>>>>
>>>>>> cheers,
>>>>>>
>>>>>> David
>>>>>>
>>>>>> Code Example:  onselect method on tabpane gets called when it's
>>>>>> selected.
>>>>>> code for bluebox.lzx is below this.
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>> <canvas debug="true">
>>>>>>
>>>>>> <import href="bluebox.lzx" name="blueview" stage="defer"/>
>>>>>>
>>>>>>     <debug x="220" y="20" width="250" height="200" />
>>>>>>
>>>>>>     <!-- tabpane with notificiation when the pane is selected -->
>>>>>>     <class name="tabpaneWithNotification" extends="tabpane" >
>>>>>>         <method event="oninit">
>>>>>>             if (this.tab.selected)
>>>>>>            {
>>>>>>       onSelected();
>>>>>>            }
>>>>>>         </method>
>>>>>>         <method event="onselect" reference="this.tab">
>>>>>>             if (this.tab.selected)
>>>>>>            {
>>>>>>       onSelected();
>>>>>>            }
>>>>>>         </method>
>>>>>>         <!-- this method should be overriden if necessary -->
>>>>>>         <method name="onSelected"/>
>>>>>>     </class>
>>>>>>
>>>>>>
>>>>>>     <simplelayout/>
>>>>>>     <tabs x="20" y="20" width="500" height="500">
>>>>>>
>>>>>>         <tabpaneWithNotification text="one">
>>>>>>             <method name="onSelected">
>>>>>>                   Debug.write("in selected for tabpane 1");
>>>>>>             </method>
>>>>>>             <simplelayout/>
>>>>>>             <view>
>>>>>>                   <button>tab1</button>
>>>>>>             </view>
>>>>>>         </tabpaneWithNotification>
>>>>>>         <tabpaneWithNotification text="two">
>>>>>>             <method name="onSelected">
>>>>>>                   blueview.load();
>>>>>>             </method>
>>>>>>             <simplelayout/>
>>>>>>         </tabpaneWithNotification>
>>>>>>         <tabpaneWithNotification text="three">
>>>>>>             <method name="onSelected">
>>>>>>                   Debug.write("in selected for tabpane 1");
>>>>>>             </method>
>>>>>>             <simplelayout/>
>>>>>>             <view>
>>>>>>                   <button>tab3</button>
>>>>>>             </view>
>>>>>>          </tabpaneWithNotification>
>>>>>>     </tabs>
>>>>>>
>>>>>> </canvas>
>>>>>>
>>>>>> bluebox.lzx:
>>>>>>
>>>>>> <library>
>>>>>>   <view height="100" width="100" bgcolor="blue"/>
>>>>>> </library>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Laszlo-dev mailing list
>>>>>> Laszlo-dev at openlaszlo.org
>>>>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>
>



More information about the Laszlo-dev mailing list