----- Original Message -----
Sent: Wednesday, June 20, 2001 12:15
PM
Subject: Re: [Dynapi-Help] Converting an
external stylesheet..
Yes, like this:
(if you make it into a widget you might need
to use the oncreate event instead of onprecreate.)
(unless you hack open dynlayer, and add a
setClass function)
.flat {
color:
#996699;
background-color: #eeeeee;
border-style:
outset;
text-align: center;
font-weight :
bold;
padding: 5px;
/*border: 5px;*/
/*margin:
5px;*/
}
.outset {
color:
#996699;
background-color: #eeeeee;
border-style:
outset;
text-align: center;
font-weight :
bold;
padding: 5px;
}
.inset {
color:
#996699;
background-color: #eeeeee;
border-style:
inset;
text-align: center;
font-weight :
bold;
padding-left: 4px;
padding-top:
6px;
}
.highlight {
color:
#996699;
background-color: #dddddd;
border-style:
outset;
text-align: center;
font-weight :
bold;
padding: 5px;
}
DynAPI. {
button1 = new
DynLayer(null,100,40,100,40)
button1.setHTML('Click Me')
DynAPI.document.addChild(button1);
var
c=button1.elm
c.className='flat'
var l=new
EventListener()
l.
{c.className='outset'}
l.
{c.className='highlight'}
l.
{c.className='flat'}
l.
{c.className='inset'}
button1.addEventListener(l)
}
I just saw I might have forgotten the .elm bit in
the previous post, ah well, I'll just up the unfinished example
here:
Only tested in IE mind you.
Cheers,
Richard Bennett
----- Original Message -----
Sent: 20 June, 2001 20:52
Subject: Re: [Dynapi-Help] Converting
an external stylesheet..
While on this topic...
I have been watching this thread with some
interest since I have related issues.
I have worked with all three implementations as
Richard illustrated in his e-mail. What I would like to know is this: If I
create a button widget and use
MenuButton.setHTML('<span
class="buttonClass">This is a span inside a DynLayer with
class="buttonClass"</span>')
in the onprecreate of the button, what I
would like to do with the onmouseover and onmousedown event handlers is to
swap the css class, as in
MenuButton.listener.> var o = e.getSource()
o.class =
"buttonClassOver"
}
This does not seem to work.
Is there a way to simply swap css classes on
the fly?
Jim
----- Original Message -----
Sent: Wednesday, June 20, 2001 11:27
AM
Subject: Re: [Dynapi-Help] Converting
an external stylesheet..
There are three things I know work, only the
first is supported by NS4, and even then not if objects become nested to
deep.
get a style sheet:
<STYLE
TYPE="text/css">
<!--
.testClass {
color:
green;
font-family: arial;
font-size:
26;
background-color:
yellow;
}
-->
</STYLE>
Then either: 1)
myLayer=new
DynLayer(null,10,50,50,50,'green')
myLayer.setHTML('<span
class="testClass">This is a span inside a DynLayer with
class="testClass"</span>')
DynAPI.document.addChild(myLayer)
Or 2):
myLayer=new
DynLayer(null,10,50,50,50,'green')
myLayer.setHTML('This is plain text inside a
DynLayer with class="testClass"')
DynAPI.document.addChild(myLayer)
myLayer.className = "testClass"
//This ony works after a dynlayer as been
added to the document.
Or 3):
myLayer=new
DynLayer(null,10,50,50,50,'green')
myLayer.setHTML('This is plain text inside a
DynLayer with the css altered.')
DynAPI.document.addChild(myLayer)
myLayer.css.padding="4px"
myLayer.css.borderWidth="2px"
myLayer.css.borderColor="lightsalmon"
myLayer.css.borderStyle="solid"
As stated the last to don't seems to work in Ns4.(or not
always)
Cheers,
Richard Bennett
----- Original Message -----
Sent: 20 June, 2001 17:15
Subject: [Dynapi-Help] Converting
an external stylesheet..
Can anyone please tell me the syntax
for converting an external stylesheet into a dynLayer. Is it
something like: myDynLayer=new DynLayer("MyExternalCSS")
??
Does the imported DynLayer contains the
same properties as those set in the .css file??
Yours
Kasper