Combining Loadpanel with Pushpanel
Load txt file Revision
Load txt file License
Load txt file Readme
Clear File
Get URL
Reload
Download here
Requirements:
DynAPI.include('dynapi.api.*');
DynAPI.include('dynapi.event.*')
DynAPI.include('dynapi.util.thread.js');
DynAPI.include('dynapi.util.pathanim.js');
DynAPI.include('dynapi.gui.button.js');
DynAPI.include('dynapi.gui.scrollbar.js');
DynAPI.include('dynapi.gui.viewport.js');
DynAPI.include('dynapi.gui.scrollpane.js');
DynAPI.include('dynapi.gui.dynimage.js');
DynAPI.include('dynapi.gui.label.js');
DynAPI.include('dynapi.gui.loadpanel.js')
DynAPI.include('richard.gui.skinwindow.js')
Usage:
In short this is an example of adding one object to another,
instead of adding it to DynAPI.document first.
Like this:
lp = new LoadPanel();
lp.setSize(850,200);
lp.moveTo(10,10);
scrollobj = new ScrollPane(lp) // loadpanel will be set as the content
scrollobj.setSize(600,250)
scrollobj.moveTo(20,250)
These two are then simply added to the skinWindow.canvas
as a child layer.
I added the onrepaint event to skinwindow.js for the resizing, so you have to download this one.
A source example:
</script>
<script language="Javascript">
DynAPI.onLoad = function() {
MetalScrollPaneURL = DynAPI.librarypath+"/dynapi/images/scrollpane/"
lp = new LoadPanel();
lp.setSize(850,200); // height will be overwritten by default
lp.moveTo(10,10);
counter = 0;
var el = new EventListener()
el.onload = function(e) {
status = 'got load event '+ counter++;
}
lp.addEventListener(el)
scrollobj = new ScrollPane(lp) // loadpanel will be set as the content
scrollobj.setSize(600,250)
scrollobj.moveTo(3,8)
myWindow = new CoreSkinWindow(10,180,622,279,'the title',theme)
myWindow.setCloseButton(0,4,16,16)
myWindow.setMinimizeButton(36,4,0,16,16)
myWindow.setMaximizeButton(18,4,0,16,16)
myWindow.setResizeable()
myWindow.canvas.setBgColor('gold')
skinWindow(myWindow) // this function is located in the style.js file
DynAPI.document.addChild(myWindow)
myWindow.setVisible(true)
myWindow.canvas.addChild(scrollobj)
lp.setURL("../README");
//if (is.ie) document.body.onselectstart = function() { return false }
myListener = new EventListener(myWindow)
myListener.onrepaint=function(e) {
var o = e.getSource();
scrollobj.setSize(o.w-22,o.h-29);
}
myWindow.addEventListener(myListener)
}
</script>
</head>
<body bgcolor=beige><h2>Combining Loadpanel with Pushpanel</h2>
<a href="javascript: lp.setURL('../REVISION');">Load txt file Revision</a><br>
<a href="javascript: lp.setURL('../LICENSE');">Load txt file License</a><br>
<a href="javascript: lp.setURL('../README.txt');">Load txt file Readme</a><br>
<br>
<a href="javascript: lp.clearFile();">Clear File</a><br>
<a href="javascript: alert(lp.getURL());">Get URL</a><br>
<a href="javascript: lp.reload();">Reload</a><br>