View Full Version : Win * objects
Brian Nickel
16.06.2001, 00:35
After thinking over what Dan said about my WinMenu, I started work on a new DHTML API building on last one: WinObjects.
I started by creating an object I call WinColor. It gets the windows colors and if its not IE, gets the Standard Windows colors.
Then I created WinDlgBox. The box you see everywhere. Buttons, menus, windows, scrollers, they all follow the same structure: http://www.scriptguru.f2s.com/dObjects2/examples/WinDlgBox.html
After creating this, I proceeded to create the WinButton object. A button object that allows you to set the hover, mouseoff and mousedown appearance of the button, using the WinDlgBox: http://www.scriptguru.f2s.com/dObjects2/examples/WinButton.html
Afterwards, I saught to revise the WinMenu, the base of this spree of coding: http://www.scriptguru.f2s.com/dObjects2/examples/WinMenu.html
The WinMenu required me to make a new object, WinShape, this creates windows shapes, (checks and arrows) so you can add any color you want:http://www.scriptguru.f2s.com/dObjects2/examples/WinShape.html
Bear in mind these were designed with a IE5.5 intranet in mind, so if it fails in IE6 who cares? (Its your own fault for upgrading to a beta.) It does work in NS6.1PR1, but I doubt it works in NS6.01. IT WILL NOT WORK IN NS4, I gave up supporting it because the complex nature of what I'm doing would fuck it up royaly.
Give me your critizism.
ScriptGuru={
getName:function(){return 'Brian Nickel';},
getEmail:function(){return '[url:38gnjkg9e7]scriptguru@f2s.com[/url:38gnjkg9e7]';},
getURL:function(){return '[url:38gnjkg9e7]http://www.scriptguru.f2s.com[/url:38gnjkg9e7]';}
};
They seemed to work in NS6.0 a couple didn't work in IE6.. Kinda slow to and I've got a broadband connection..
They were kinda cool I like the winMenu.. It worked this time in IE6.
<font color=teal>xanth = createElement("person");
xanth.setAttribute("name", "Mike");
xanth.setAttribute("mail", "[url:1zcld41rs2]belgedin@earthlink.net[/url:1zcld41rs2]");
xanth.setAttribute("age", 16)
document.forum.appendChild(xanth);
</font id=teal>
Brian Nickel
16.06.2001, 03:07
Do you have any idea why the code wouldn't work right in IE6? All it is is DOM1 and some IE4 coding. Is it just a beta bug?
ScriptGuru={
getName:function(){return 'Brian Nickel';},
getEmail:function(){return '[url:k7q1zzvut4]scriptguru@f2s.com[/url:k7q1zzvut4]';},
getURL:function(){return '[url:k7q1zzvut4]http://www.scriptguru.f2s.com[/url:k7q1zzvut4]';}
};
Icestorm
16.06.2001, 06:35
The menu is really nice <img src=icon_smile_wink.gif border=0 align=middle> Should be quite recognizable for people that have never seen the internet but are familiar with windows. I haven't seen the code, but I guess what's left to do is optimizng the code... the menu looks like it's done.
-----<font face='Verdana'>
[url="http://e-syed.net/skriptlab/"]v2[/url:bvasjuc13q]</font id='Verdana'>
-----
Looking good. The menus are excellent!
<font face='Courier New'><font color=maroon>»» Dan
»» dan@pupius.net
»» www.pupius.net || www.endoflow.com</font id=maroon></font id='Courier New'>
Brian Nickel
16.06.2001, 18:26
Thanks for the comments. If you want to see an example of extendability:
[url:pfmgflfbg9]http://www.scriptguru.f2s.com/dObjects2/examples/EditedWinMenu.html[/url:pfmgflfbg9]
ScriptGuru={
getName:function(){return 'Brian Nickel';},
getEmail:function(){return '[url:pfmgflfbg9]scriptguru@f2s.com[/url:pfmgflfbg9]';},
getURL:function(){return '[url:pfmgflfbg9]http://www.scriptguru.f2s.com[/url:pfmgflfbg9]';}
};
<BLOCKQUOTE id=quote><font size=1 face="Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>Do you have any idea why the code wouldn't work right in IE6? All it is is DOM1 and some IE4 coding. Is it just a beta bug?<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Arial, Helvetica" size=2 id=quote>
No I haven't looked at the code...
Anyways the ones that didn't work in IE6 are...
http://www.scriptguru.f2s.com/dObjects2/examples/WinDlgBox.html
I could see them but they were all compacted until only the borders showed and the we stuck at the top of the window..
http://www.scriptguru.f2s.com/dObjects2/examples/WinButton.html
I could see the buttons and they worked but again they were stuck up and cut off at the top of the window.
http://www.scriptguru.f2s.com/dObjects2/examples/WinShape.html
Same as, http://www.scriptguru.f2s.com/dObjects2/examples/WinDlgBox.html
I'm pretty sure they all worked in NS6.. I don't have time to check cuz they're pretty slow loadingon IE6 so NS will keep me waiting awhile.
<font color=teal>xanth = createElement("person");
xanth.setAttribute("name", "Mike");
xanth.setAttribute("mail", "[url:es5pkojxom]belgedin@earthlink.net[/url:es5pkojxom]");
xanth.setAttribute("age", 16)
document.forum.appendChild(xanth);
</font id=teal>
Edited by - Xanth on 06/16/2001 17:29:41
Brian Nickel
17.06.2001, 02:08
WinMenu 1.02 has been created.
I fixed the following problems:
<ul> If you have more than 1 submenu, it would cause an error, due to the fact that javascript has trouble telling the difference between global and local variables. The unfortunate solution was a setTimeout(menu closer,1) which will be noticably slower with most processors. Due to the nature of the WinMenu, menus follow a Non-Linear pattern, that is, they aren't heiarchaly coded, I solved the problem of them not moving if they are open from another menu.[/list]
Examples:
http://www.scriptguru.f2s.com/dObjects2/examples/WinMenu.html - original appearance
http://www.scriptguru.f2s.com/dObjects2/examples/EditedWinMenu.html - altered appearance
http://www.scriptguru.f2s.com/dObjects2/examples/EditedWinMenu2.html - example of non-linear progression
Note: I'm not sure if non-linear is the best phrase to discribe it, but it sounds cooler. If it is incorrect and you have a better name, I would like to hear it.
ScriptGuru={
getName:function(){return 'Brian Nickel';},
getEmail:function(){return '[url:ovofedi33d]scriptguru@f2s.com[/url:ovofedi33d]';},
getURL:function(){return '[url:ovofedi33d]http://www.scriptguru.f2s.com[/url:ovofedi33d]';}
};
Garrett Smith
17.06.2001, 02:30
Here are my thoughts and observations on your menu:
The menus did not work in IE5 on mac. In NS 6.01, the menuItem text was unreadable, either invisible, clipped, or stacked below the menu.
The links worked, though, and the subs popped out as expected. It was kind of weird. I would click on an item and a window would open with a page, but I had no idea what I had clicked on.
Here is a picture:
http://dhtmlkitchen.com/temp(6-17)/WinMenu.gif
What I see you doing is experimenting with different ui features and their appearances. I am going through the same thing myself now, and I think its appropriate to bring the subject up now.
You could add a function (I'll call it 'getLookAndFeel') and have folders for osX, win98, metal, and default system (css ui).
If you want others to use your menu script, you should include some technical documentation explaining how to use the menu.
By the way, where can I get specs on the metal look and feel? Other than Steinman's dynWindows, I haven't seen such DHTML.
Garrett Smith
Still think the one using the UI colours is best. Not sure why those menu's are non-linear though, but I can't think of another way to describe it.
<font face='Courier New'><font color=maroon>»» Dan (dan@pupius.net)
»» www.pupius.net || www.endoflow.com</font id=maroon></font id='Courier New'>
Brian Nickel
17.06.2001, 18:02
Garrett,
NS6 has always rejected my cliping, and Macs and I don't get along, so I was afraid something like this would happen. If the problem goes away with 6.1, as I hope, then YAY, otherwise my laziness and apathy will prevent progress. As for IE, does it cause errors, or does it just not show up? If it doesn't appear, then the problem is with the way I coded WinColor (I think), and I can easily correct that.
BTW, thanks for the screen shot, your the first person who I can understand because of that.
Dan,
I call it non-linear because Menu B is not always a decendant of Menu A, it can be accessed from Menu C, D, E, etc. I've never been a fan of heiarchy (I've never used nested layers, believe it or not.)
<BLOCKQUOTE id=quote><font size=1 face="Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
non·lin·e·ar [non línnee ?r] adjective
<u>1. not in a line: not lying on the same straight line</u>
2. not predictable from past: varying markedly as a result of individual factors or circumstances and so difficult to anticipate or likely to depart from previous patterns
3. ALGEBRA not in direct proportion: used to describe a relationship or function that is not strictly proportional
Encarta® World English Dictionary © & (P) 1999 Microsoft Corporation. All rights reserved. Developed for Microsoft by Bloomsbury Publishing Plc.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Arial, Helvetica" size=2 id=quote>
ScriptGuru={
getName:function(){return 'Brian Nickel';},
getEmail:function(){return '[url:u79jlnw5py]scriptguru@f2s.com[/url:u79jlnw5py]';},
getURL:function(){return '[url:u79jlnw5py]http://www.scriptguru.f2s.com[/url:u79jlnw5py]';}
};
ah...hadn't noticed they were the same :)
<font face='Courier New'><font color=maroon>»» Dan (dan@pupius.net)
»» www.pupius.net || www.endoflow.com</font id=maroon></font id='Courier New'>
Brian Nickel
17.06.2001, 22:37
<BLOCKQUOTE id=quote><font size=1 face="Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>the more complicated examples look good sg but theyre too slow (big style), shame<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Arial, Helvetica" size=2 id=quote>Yeah, I figured they would be a bit useless for web scale development, but it would be nice to see something like them used on an intranet with gig+ processors
ScriptGuru={
getName:function(){return 'Brian Nickel';},
getEmail:function(){return '[url:7i26ipp7x7]scriptguru@f2s.com[/url:7i26ipp7x7]';},
getURL:function(){return '[url:7i26ipp7x7]http://www.scriptguru.f2s.com[/url:7i26ipp7x7]';}
};
Garrett Smith
19.06.2001, 19:21
Nice colors, but still no text in NS6.01 (same problem). This is bad, because I can't see your menus in any browser.
Also, I have a suggestion about your non-linear idea. I think of these as being relationship-based. That is, a label can have a menu and an ownerMenu. A label's ownerMenu contains the label. By virtue of this, it is quite easy to create a relationship between the label's menu and the label's ownerMenu.
It is also trivial to assign an activeSubmenu property to the menu.
Then, when a menuItem or label or whatever in a menu is moused over, the activeSubmenu can be hidden.
It's a lot more fun than using two and three dimensional arrays.
One other thought...
You can add style sheets and use the same CSS rules. This might mean less iteration (faster).
For IE, you can easily add an import:
here's what I mean:
with(document.styleSheets[0]){
if(MAC_IE5) addImport("menubars/macmenubar.css");
if(WIN_IE5) addImport("menubars/winmenubar.css");
}
One final idea (last one)
I found the fastest way to change styles is to swap the className. If (this.className=="menuItem") this.className="itemOver"
Garrett
"Hello world"
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.