Function p_DefMaxPage(total)
maxpage=Int(total/(AreaDim-1))
EndFunction
Function p_pagehandling()
If page >= maxpage
page=maxpage
DisableButton(10)
EnableButton(11)
Undo(#TEXTOBJECT,10)
Else
EnableButton(10)
EndIf
If page = 0
DisableButton(11)
Undo(#TEXTOBJECT,11)
EndIf()
EndFunction
Function p_DisplayNationTab()
CopyBrush(tabbrush,99)
p_DefMaxPage(NationCount)
p_pagehandling()
SelectBrush(99)
SetFontColor(#BLACK)
Local fontsize = GetAttribute(#DISPLAY,0,#ATTRFONTSIZE)
Local y = 0
Locate(0,y)
Print("ID")
Locate(50,y)
Print("Nation")
For i = (page*(AreaDim-1)-page) To ((page+1)*(AreaDim-1))
If (i < NationCount)
y = y + fontsize
Locate(0,y)
Print(t_nation[i][0])
Locate(50,y)
Print(t_nation[i][1])
EndIf()
Next
EndSelect()
DisplayBrush(99,#CENTER,120)
FreeBrush(99)
EndFunction
Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 31 Aug 2009 12:53:38 +0200
Hello,
when using the following code the available memory gets reduced heavily and the free memory only knows one direction...
Is there a way to reduce the memoryconsumption?
Well, keep in mind that if layers are enabled, every call to Print() will insert a new layer. And every layer needs some memory. So you should implement some kind of layer managing mechanism: i.e. make sure that you kill all layers that you no longer need (using RemoveLayer()).
Hollywood can't do this automatically because it doesn't know when a layer is obsolete. You have to keep track of all your layers on your own.
Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 03 Sep 2009 22:25:01 +0200
By the way, tracking memory usage will be much easier with Hollywood 4.5 because it has a OpenResourceMonitor() function which opens a resource monitor that shows the number of brushes, anims, layers, bgpics, sounds, etc etc. currently in memory and constantly updates these values. This is very useful for debugging the memory efficiency of your scripts. If your layers constantly get more and more, then your code is bad