Re: [NTLK] Programming help - part 2

From: Daniel Padilla Roldán <dproldan_at_telefonica.net>
Date: Sat Aug 23 2008 - 09:44:27 EDT

Marisa Giancarla escribió:
> Thanks for posting that PidToPkgRef() method call - that was what I was
> missing to see the .parts array. I can now dump out the parts array but
> I am still not seeing anything like the data stored in the package file.
> For instance:
> foreach curPkg in GetPackages() do
> begin
> if (EndsWith(curPkg.title, ".prc:PCKTFCTN")) then
> begin
> print(curPkg.title);
>
> print(GetPkgRefInfo(PidToPkgRef(curPkg.id)).parts[0]);
> end;
> end;
>
> Dumps out the following:
>
> "maskedalib2.prc:PCKTFCTN"
> {app: |maskedalib2.prc:PCKTFCTN|,
> text: "maskedalib2.prc",
> icon: {bits: <bits, length 144>,
> mask: <mask, length 144>,
> bounds: {#60D0904D}},
> iconPro: {unhilited: {#60D09145},
> hilited: {#60D09345}},
> theForm: {viewBounds: {#60D095F1},
> viewFlags: 0,
> viewFormat: 0,
> ViewSetupDoneScript: <function, 0 arg(s) #60D0962D>,
> viewClass: 74,
> appSymbol: |maskedalib2.prc:PCKTFCTN|},
> installScript: <function, 1 arg(s) #60D22089>,
> removeScript: <function, 1 arg(s) #60D223B1>}
> #2 NIL
>
> Any ideas where the actual package data is stored?
>
> Marisa
>
>

          I'm not sure what you mean with package data, depending on
how you built your package, you should be able to access everything
from that pointer, following the slots.
   
       The usual way to get a foreign file format into the newton is
using the LoadDataFile method.

       Something like this: constants.txt contains this:

    DefineGlobalConstant( 'MyDataFile,
                                            
LoadDataFile("maskedalibi.prc",'binary),
                                        );

   
    You add constants.txt to your project, make sure it is above your
main layout or program, and then you can access it from the main layout
using the symbol 'MyDataFile.

    You can also take a look at how MOD files are made here for some
more hints: http://roger.trideja.com/newton/modplayer.html

    I also used this method for writing MP3 files into a soup, here's
some code:
http://dev.newtontalk.net/~dpadilla/progs/MP3Builder/MP3Builder.zip

HTH

Daniel

====================================================================
The NewtonTalk Mailing List - http://www.newtontalk.net/
The Official Newton FAQ - http://www.splorp.com/newton/faq/
The Newton Glossary - http://www.splorp.com/newton/glossary/
WikiWikiNewt - http://tools.unna.org/wikiwikinewt/
====================================================================
Received on Sat Aug 23 09:44:30 2008

This archive was generated by hypermail 2.1.8 : Sat Aug 23 2008 - 10:30:00 EDT