First development version of HTML+JS window framework
Tuesday, 21. August 2007, 21:35:28
Since I finished the first milestone for my window framework during the first day of development, I will let you to see the code. I don't speak Javascript fluently, but some of you may learn some things from my code.
I use a simple pattern where I make data in the object private. You can also learn some things on how to use absolute positioning and DOM.
What this code implements right now is a view system. Each view has a size and a position, and a background color. A view can not have content. A view can have any number of child views. At the top there is a root view, that basically acts as a window. You should not place views belonging to the same parent on top of each other (even if I have done that in my example), since the order they are painted is undefined. (actually, the order is currently, first added, first painted)
This code is not rocket science. Of course more things will be added later, like content in the views, but this a good amount of code for people to learn how things work.
...and it works in both Opera and Firefox, KHTML untested (broken package in Ubuntu it seems), and IE also untested, I doubt that it works in IE.
I use a simple pattern where I make data in the object private. You can also learn some things on how to use absolute positioning and DOM.
What this code implements right now is a view system. Each view has a size and a position, and a background color. A view can not have content. A view can have any number of child views. At the top there is a root view, that basically acts as a window. You should not place views belonging to the same parent on top of each other (even if I have done that in my example), since the order they are painted is undefined. (actually, the order is currently, first added, first painted)
This code is not rocket science. Of course more things will be added later, like content in the views, but this a good amount of code for people to learn how things work.
...and it works in both Opera and Firefox, KHTML untested (broken package in Ubuntu it seems), and IE also untested, I doubt that it works in IE.








