[08 Feb 2008] Getting Layered

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
lairdpleng

[08 Feb 2008] Getting Layered

Post by lairdpleng »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 08 Feb 2008 12:03:47 -0000

I'm having some real problems with layers.

I have attached some code to a page in my Designer project which looks a little like this:

Code: Select all

Function GetDrawerNames(firstdrawerno)

         For drawerloop = 1 to 5
              drawernames$[drawerloop] = (drawers$[drawerloop + firstdrawerno])
         Next

         SetFont("CGTimes.font", 40)
         SetFontColor($EA000D)
         t$ = ("[edge=$180F77,1]"..drawernames$[1])
         HideLayer(951)
         CreateTextObject (901,t$, #LEFT, 0)
         InsertLayer (951, #TEXTOBJECT, 901, 886, 270)

         ;... (the above is then repeated 4 times, plotting the layers at different positions)

EndFunction
I call the function the first time the page is drawn by attaching the following code to an object

Code: Select all

fdn=1
GetDrawerNames(fdn)
I also have some code attached to an images click-event:

Code: Select all

fdn=fdn+1
GetDrawerNames(fdn)
I would expect the function to fail on its initial execution at the start of the page with a 'specified layer is out of range', as Layer 951 is hidden before it is created. If this were the case I could Disable ExitOnError for that section of the code. However the code executes perfectly the first time around, but fails when I call it again from the image-click with 'specified layer is out of range'. The line of code which it points to as failing is HideLayer(951)

Any ideas? Thanks in advance!
User avatar
Clyde
Posts: 351
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

[11 Feb 2008] Re: Getting Layered

Post by Clyde »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 11 Feb 2008 20:56:16 +0100

Well, what exactly does 'specified layer is out of range' mean? Is it some kind of memory or array restriction (like when an array has 4 elements and you want to have the 5th one) or does it mean that the layer does not exist? If I do a HideLayer() on an uninitialized iayer I get this message in German: "Der angegebene Layer exisitert nicht!" which means something like "This layer does not exist".

So, if "out of range" = "does not exist" then maybe you remove the layer (or the object) or you skip a page in Designer and the layer is not available there?

Greetings
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
lairdpleng

[12 Feb 2008] Re: Getting Layered

Post by lairdpleng »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 12 Feb 2008 11:38:03 -0000

Hi, thanks for the response. It seems to mean that the layer does not exist. Upon looking at the Hollywood code which is generated it looks like all the layers are freed once the page has been drawn, which isn't terribly helpful :S

Still doesn't explain why the error message is not displayed first time the code is run though. Very strange.
User avatar
Clyde
Posts: 351
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

[12 Feb 2008] Re: Getting Layered

Post by Clyde »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 12 Feb 2008 13:29:21 -0000

Well ... you use the layer number 951. Do you really have a thousend objects? So, maye you preload/create all these >= 951 objects at the beginning of the code before you execute the first time this code. If I understand it right, then every object is put into a layer automatically and that's why the Layer #951 is available and no error appears.

But if the layers are really deleted after ghe page has been drawn ... I can't really imagin that this really happens, it would be definitely strange ...!?!? :-/
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
lairdpleng

[12 Feb 2008] Re: Getting Layered

Post by lairdpleng »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 12 Feb 2008 16:20:58 -0000

I used 951 just because I knew it definitely wouldn't conflict with any other layers I might create. I think I currently have 37 layers in my code, so 951 definitely isn't created by the time I first call HideLayer(951).

The main interface isn't complete yet so I just chose a very high layer number to give me plenty of breathing space.

The main program loop does indeed appear to remove all layers, and indeed brushes and animations. Here is the code for the main presentation loop, which is generated by Hollywood Designer:

Code: Select all

Repeat
nextpage = pages[nextpage]()
FreeLayers
For k = 1 To bc Do FreeBrush(k)
For k = 1 To ac Do FreeAnim(k)
Until nextpage = 3
Locked