|
From: Raides J. <ra...@te...> - 2001-01-11 13:02:18
|
> Raymond Smith wrote: > > You know what we need. A super button widget. I just noticed I have for js > calls for differing button type. The ideal button would: > > 1) Contain the ability to; > a) be defined and colored ala HTML (button.js) > b) pull in images (ala ButtonImage), but have three states: static, mouseover > and clicked > c) act as a 'href clicked marker", ie.... have a chnage state per session if > it has been clicked once. > d) perform as a check box (boolean toggle, imagebutton.js) > e) and have the abilty to be skined and defined by multiple themes. > > I have all this spread across 4 differing widgets, once I integrate this into > a super hacked version of what little I know I will contribute it. > > Later It's not just that, but I have two .js that I can send you under request (different versions available, so you have to ask which one you choose) that implement what I call an "active area", i.e. a region in web-page space which responds to mouse events and generates its own event calls, and what I call an "icon", which is a 4-state imagebutton (all 4 images can be the same). The "Icono" (the name of the object icon) object has methods to activate it (state=0), deactivate it (state=3) and change it's default state (0=on, 1=mouseover, 2=click, 3=off). They generate just the "onClick" event when clicked and active with a parameter which is the index of the icon in the "Area" (the active area object) they MUST be contained on to work. This way you can group them logically and assign the same method to the "onClick" event of each related group of buttons and then differentiate in code using a "switch()" statement. One interesting "side-effect" derived from the way I have implemented the "Icono" is that you can have a different image in place of the icon, and it gets replaced on the first mouse event on the icon. Other side-effect is that you can have the area and the icon responding to mouse events in one place of the page and the associated image changing state in other part ;) The "Area" object is rather different. One of the versions needs always a DynLayer 1.0 version of layer to attach itself to for the dimension information (the older version). The other two versions can be created independent of any other object or attached to DynLayers 1.0 and DynAPI DynLayers respectively. They have methods to change the size of the active area, to move the top-left corner, to activate and deactivate them, and to dump it's internal information as an "alert" method. The events fired are of a wide sort and ALL provide the mouse coordinates in RELATIVE or ABSOLUTE (page relative) vaues when the event fired. Overimposed areas fire all at the same time if they are active, so multiple areas can react to a single mouse event at once. The mouse events are: onMouseIn --> Fires just when the mouse enters the area and just once onMouseDown --> Fires on the mouse down phase of a button press (just the left button) onMouseUp --> Fires on the mouse up phase of a button press (just the left button). This only fires IF the mouse is INSIDE the area. In case it's moved outside while the mouse is down (dragging), the event fired will be the next one. onMouseOut --> Fires just once the mouse exits from the area and after an "onMouseIn" event has occurred. It can fire in the middle of an "onMouseDown"-"onMouseUp" sequence. onMouseOver --> Fires WHILE the mouse is INSIDE the area. onClick --> Fires IF the "onMouseDown" AND the "onMouseUp" events occur in sequence and INSIDE the area. If the mouse gets out of the area before the button is up, no event is fired. The usual sequence for this events is: "onMouseIn" - "onMouseOver" (more than once) - "onMouseOut" for the mouse movement events, and "onMouseDown" - "onMouseUp" - "onClick" for the button mouse events. This more than extends the standard behaviour and you can easily add an "onMouseUpOut" event to capture the button release when it started inside and ended outside of the area, so an "Area.mueveA(x,y)" with the appropiate coordinates will effectively "drag" the area (and its related DynLayer, if any) to the new mouse coordinates. They also rely on two small "all-purpose" auxiliar files: "funcaux.js" and "funcesp.js" that give some general methods to simplify code. The complete list will be posted or sent on request, but I will just mention the cross-browser compatible "BuscaImagen(nombre)" that searches for any image in any layer of the document by name, even in nested layers in NS4. Returns "null" on error and the image object on success. I hope these (and other objects I have created) will help developers get a more interactive content to their DHTML pages. Raides J. |