[Laszlo-dev] Bug loading library programatically?

Vikas Bhatia vikas.bhatia at gmail.com
Tue Sep 20 07:29:53 PDT 2005


I dont get what you are trying to do. I changed your loadLib

function loadLib(){
			Debug.write("loading library!");
			var libName = "bluebox.lzx";
			//foo.load();
			blueboximport.load();
		}

and it worked fine.

Also, why are you checking for the canvas loaded?
<canvas width="800" height="400" debug="true">

	<import href="bluebox.lzx" name="blueboximport" id="blueboximport"
		stage="defer" />

	<script>
		var foo = new LZLibrary(canvas);

		function loadLib(){
			Debug.write("loading library!");
			var libName = "bluebox.lzx";
			//foo.load();
			blueboximport.load();
		}
	</script>

	<simplelayout />

	<button>
		Load Programmatically!
		<method event="onclick">loadLib();</method>
	</button>
	<button>
		Test Load Programmatically
		<method event="onclick">
			Debug.write("loaded programmatically: " + foo.loaded);
			Debug.write("loaded programmatically: " + blueboximport.loaded);
		</method>
	</button>
</canvas>

removed some extra lines there. bluebox is still the same. hope we are
talking about the same thing

V.

On 9/19/05, dhay at lexmark.com <dhay at lexmark.com> wrote:
>
> Yes, indeed, I have read this page numerous time.  It leaves me entirely
> frustrated when trying to load a library programmatically, however,
>
> The only line I find in it is this one:
>
> "LzLibrary.load("uri", object) loads a library. The global values that the
> library defines are placed as attributes in object. If the function is
> called with only one parameter, the global values are placed in globals
> instead. "
>
> I have also downloaded the complete source, and performed a search for
> LzLibrary.  As far as I can tell, this one line is the only thing in the
> docs that even hints at loading a library programmatically.  I was
> expecting to find an LzLibrary page with the reference, but for some reason
> it doesn't exist.
>
> So I have been trying to figure this out from the single line above, along
> with some code snippets someone on this list was kind enough to send
> (although they don't work either).  There is also a snippet on the forum,
> but that person is trying to load a .lzo rather than a .lzx.
>
> Hence my question.  I have tried every which way I know, and cannot get
> this working.  I am either missing something, or it is a bug.
>
> I would really appreciate it if anyone could tell me which, so I can
> atleast think about fixing the bug if it exists, or trying some other
> method.
>
> cheers,
>
> David
>
>
>
> |---------+---------------------------->
> |         |           P T Withington   |
> |         |           <ptw at pobox.com>  |
> |         |                            |
> |         |           09/19/2005 02:34 |
> |         |           PM               |
> |         |                            |
> |---------+---------------------------->
>  >-------------------------------------------------------------------------------------------------------------------------------------------------|
>  |                                                                                                                                                 |
>  |       To:       dhay at lexmark.com                                                                                                                |
>  |       cc:       laszlo-dev at openlaszlo.org                                                                                                       |
>  |       Subject:  Re: [Laszlo-dev] Bug loading library programatically?                                                                           |
>  >-------------------------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
> Have you read http://www.laszlosystems.com/lps-3.0/docs/design/
> program-structure.html?
>
> On 19 Sep 2005, at 14:01, dhay at lexmark.com wrote:
>
> >
> > Would someone be able to verify whether this is a bug, or if I am
> > missing
> > something in the syntax?
> >
> > cheers,
> >
> > David
> >
> >
> >
> > |---------+--------------------------------->
> > |         |           dhay at lexmark.com      |
> > |         |           Sent by:              |
> > |         |           laszlo-dev-bounces at ope|
> > |         |           nlaszlo.org           |
> > |         |                                 |
> > |         |                                 |
> > |         |           09/16/2005 04:10 PM   |
> > |         |                                 |
> > |---------+--------------------------------->
> >
> >> ---------------------------------------------------------------------
> >> ----------------------------------------------------|
> >>
> >
> > |
> >                                                     |
> >   |       To:       laszlo-
> > dev at openlaszlo.org
> >                            |
> >   |
> > cc:
> >                                             |
> >   |       Subject:  [Laszlo-dev] Bug loading library
> > programatically?
> >  |
> >
> >> ---------------------------------------------------------------------
> >> ----------------------------------------------------|
> >>
> >
> >
> >
> >
> > Hi,
> >
> > I have the simple test case below to illustrate my problem loading a
> > library programatically.
> >
> > If you drop bluebox.lzx in the same directory, you'll see that it
> > will load
> > just fine using the <import> tag.  However. trying to do the same
> > thing
> > programmatically doesn't throw any errors, but the library never
> > loads.
> > I've also tried this to no avail:
> >
> >       var foo = new LzLibrary(canvas, {name: 'mylib', href:
> > 'bluebox.lzx'});
> >
> > Is this a bug?  Or what am I missing?
> >
> > cheers,
> >
> > David
> >
> > <canvas width="800" height="400" debug="true">
> >
> > <import href="bluebox.lzx" name="blueboximport" id="blueboximport"
> > stage="defer"/>
> >
> > <script>
> > var foo = new LZLibrary(canvas);
> >
> > function loadLib(){
> >    foo.load();
> > }
> > </script>
> >
> > <simplelayout/>
> >
> > <button>Load Programmatically!
> >    <method event="onclick">
> >       loadLib();
> >    </method>
> > </button>
> > <button>Test Load Programmatically
> >       <method event="onclick">
> >             Debug.write("loaded programmatically: " + foo.loaded);
> >       </method>
> > </button>
> >
> > <button>Load via import
> >    <method event="onclick">
> >       blueboximport.load();
> >    </method>
> > </button>
> > <button>Test Load via import
> >       <method event="onclick">
> >             Debug.write("loaded via import: " + blueboximport.loaded);
> >       </method>
> > </button>
> >
> > </canvas>
> >
> >
> > bluebox.lzx is in the same directory and simply contains:
> >
> > <library>
> > <view name="blueboxview" height="100" width="100" bgcolor="blue">
> > <button>heeloo</button>
> > </view>
> > </library>
> >
> >
> > _______________________________________________
> > Laszlo-dev mailing list
> > Laszlo-dev at openlaszlo.org
> >  http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
> >
> >
> >
> >
> > _______________________________________________
> > Laszlo-dev mailing list
> > Laszlo-dev at openlaszlo.org
> > http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
> >
>
>
>
>
>
> _______________________________________________
> 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