Hey all,
A class of mine needs to tell the outside world when its buffer is not
empty. The problem is that C# seems to force you to put the
event-raising code in the base class. To illustrate, consider what I'll
do in Java:
public interface DataAvailabilit yListener extends java.util.Event Listener {
void dataArrived(Dat aAvailabilityEv ent event);
}
then, in my base class, I can do this:
public abstract class SmartQueue {
addDataAvailabi lityListener(Da taAvailabilityL istener listener);
}
then in my implementation class, say a memory-backed smart queue, I can
do this:
public class MemorySmartQueu e implements SmartQueue {
public void poolForData() {
// data available!
while(iter.hasN ext()) {
DataAvailabilit yListener lis =
(DataAvailabili tyListener)iter .next();
lis.dataArrived (someEvent);
}
}
}
Simple and straighforward. However, consider a C# implementation: in the
interface, I may have something like this:
public abstract class SmartQueue {
public event DataAvailabilit yEventHandler DataArrived;
}
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue {
public override void poolForData() {
// data available!
if(DataArrived == null) {
// BZZZZTTT!!! Can only do this in SmartQueue!
DataArrived(thi s, args);
}
}
}
I can't believe this. Either I'm missing a really obvious thing, or I
have to deal with this... this... awkward mechanism. Why the hell
doesn't it allow me to raise an event in the derived class? I don't want
to put any behaviour in my abstract class, I want to put just an interface!
Is there any way around this? (Plus I hope Whidbey will give us a Set
collection, dammit).
TIA!
Elder 18 2040
Oops, please replace "implements " with "extends" :)
Elder Hyde wrote: Hey all,
A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate, consider what I'll do in Java:
public interface DataAvailabilit yListener extends java.util.Event Listener { void dataArrived(Dat aAvailabilityEv ent event); }
then, in my base class, I can do this:
public abstract class SmartQueue { addDataAvailabi lityListener(Da taAvailabilityL istener listener); }
then in my implementation class, say a memory-backed smart queue, I can do this:
public class MemorySmartQueu e implements SmartQueue { public void poolForData() { // data available! while(iter.hasN ext()) { DataAvailabilit yListener lis = (DataAvailabili tyListener)iter .next(); lis.dataArrived (someEvent); } } }
Simple and straighforward. However, consider a C# implementation: in the interface, I may have something like this:
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived; }
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! if(DataArrived == null) { // BZZZZTTT!!! Can only do this in SmartQueue! DataArrived(thi s, args); } } }
I can't believe this. Either I'm missing a really obvious thing, or I have to deal with this... this... awkward mechanism. Why the hell doesn't it allow me to raise an event in the derived class? I don't want to put any behaviour in my abstract class, I want to put just an interface!
Is there any way around this? (Plus I hope Whidbey will give us a Set collection, dammit).
TIA! Elder
Hi,
It is standard to implement a method to fire the event, this method is the
event name prefixed with 'On'. So in your case the base class would have a
OnDataArrived, which can be called from anywhere. This has the advantage of
not having to cluter your code checking if the event has any delegates
before firing and also gives the derived implementation an alternative and
better performing method of handling the event by overriding the On...
method.
public abstract class SmartQueue
{
public event DataAvailabilit yEventHandler DataArrived;
// This is called to fire the event
public void OnDataArrived( YourEventArgs e )
{
if ( DataArrived != null )
DataArrived( this, e );
}
}
public class MemorySmartQueu e : SmartQueue
{
public override void poolForData()
{
// data available!
OnDataArrived( args ); // Fire the event
}
}
Hope this helps
--
Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/
"Elder Hyde" <no_way> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hey all,
A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate, consider what I'll do in Java:
public interface DataAvailabilit yListener extends java.util.Event Listener
{ void dataArrived(Dat aAvailabilityEv ent event); }
then, in my base class, I can do this:
public abstract class SmartQueue { addDataAvailabi lityListener(Da taAvailabilityL istener listener); }
then in my implementation class, say a memory-backed smart queue, I can do this:
public class MemorySmartQueu e implements SmartQueue { public void poolForData() { // data available! while(iter.hasN ext()) { DataAvailabilit yListener lis = (DataAvailabili tyListener)iter .next(); lis.dataArrived (someEvent); } } }
Simple and straighforward. However, consider a C# implementation: in the interface, I may have something like this:
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived; }
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! if(DataArrived == null) { // BZZZZTTT!!! Can only do this in SmartQueue! DataArrived(thi s, args); } } }
I can't believe this. Either I'm missing a really obvious thing, or I have to deal with this... this... awkward mechanism. Why the hell doesn't it allow me to raise an event in the derived class? I don't want to put any behaviour in my abstract class, I want to put just an
interface! Is there any way around this? (Plus I hope Whidbey will give us a Set collection, dammit).
TIA! Elder
How can we perform an Async event in C#?
Events are Synchronous usually. Do we just call BeginInvoke, if so, how
would we do this?
"Chris Taylor" <ch************ *@hotmail.com> wrote in message
news:#G******** ******@TK2MSFTN GP10.phx.gbl... Hi,
It is standard to implement a method to fire the event, this method is the event name prefixed with 'On'. So in your case the base class would have a OnDataArrived, which can be called from anywhere. This has the advantage
of not having to cluter your code checking if the event has any delegates before firing and also gives the derived implementation an alternative and better performing method of handling the event by overriding the On... method.
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived;
// This is called to fire the event public void OnDataArrived( YourEventArgs e ) { if ( DataArrived != null ) DataArrived( this, e ); } }
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! OnDataArrived( args ); // Fire the event } }
Hope this helps -- Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/ "Elder Hyde" <no_way> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hey all,
A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate, consider what I'll do in Java:
public interface DataAvailabilit yListener extends
java.util.Event Listener { void dataArrived(Dat aAvailabilityEv ent event); }
then, in my base class, I can do this:
public abstract class SmartQueue { addDataAvailabi lityListener(Da taAvailabilityL istener listener); }
then in my implementation class, say a memory-backed smart queue, I can do this:
public class MemorySmartQueu e implements SmartQueue { public void poolForData() { // data available! while(iter.hasN ext()) { DataAvailabilit yListener lis = (DataAvailabili tyListener)iter .next(); lis.dataArrived (someEvent); } } }
Simple and straighforward. However, consider a C# implementation: in the interface, I may have something like this:
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived; }
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! if(DataArrived == null) { // BZZZZTTT!!! Can only do this in SmartQueue! DataArrived(thi s, args); } } }
I can't believe this. Either I'm missing a really obvious thing, or I have to deal with this... this... awkward mechanism. Why the hell doesn't it allow me to raise an event in the derived class? I don't want to put any behaviour in my abstract class, I want to put just an interface! Is there any way around this? (Plus I hope Whidbey will give us a Set collection, dammit).
TIA! Elder
Hi Chris,
So there's really no way of escaping this? The thing is that I want my
abstract class to be really just an interface, with no implementation.
The way I'd like to organize it is something like:
public abstract class SmartQueue {
// all interface stuff only, plus
// static methods
}
public abstract class AbstractSmartQu eue : SmartQueue {
// put stuff that are common to base classes here.
}
public class MemorySmartQueu e : AbstractSmartQu eue {
// put memory-backed specific operations here
}
Now, I can't (or rather don't want to) make SmartQueue an interface,
because: I want to have static methods--it makes the most sense to put
them in SmartQueue. But anyway, OK, I know the way now. Thanks!
Regards,
Elder
Chris Taylor wrote: Hi,
It is standard to implement a method to fire the event, this method is the event name prefixed with 'On'. So in your case the base class would have a OnDataArrived, which can be called from anywhere. This has the advantage of not having to cluter your code checking if the event has any delegates before firing and also gives the derived implementation an alternative and better performing method of handling the event by overriding the On... method.
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived;
// This is called to fire the event public void OnDataArrived( YourEventArgs e ) { if ( DataArrived != null ) DataArrived( this, e ); } }
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! OnDataArrived( args ); // Fire the event } }
Hope this helps
Hi,
Mistake in my code, in my haste, I forgot to make the On.... virtual SORRY.
public virtual void OnDataArrived( YourEventArgs e )
Regards
--
Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/
"Chris Taylor" <ch************ *@hotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. Hi,
It is standard to implement a method to fire the event, this method is the event name prefixed with 'On'. So in your case the base class would have a OnDataArrived, which can be called from anywhere. This has the advantage
of not having to cluter your code checking if the event has any delegates before firing and also gives the derived implementation an alternative and better performing method of handling the event by overriding the On... method.
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived;
// This is called to fire the event public void OnDataArrived( YourEventArgs e ) { if ( DataArrived != null ) DataArrived( this, e ); } }
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! OnDataArrived( args ); // Fire the event } }
Hope this helps -- Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/ "Elder Hyde" <no_way> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hey all,
A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate, consider what I'll do in Java:
public interface DataAvailabilit yListener extends
java.util.Event Listener { void dataArrived(Dat aAvailabilityEv ent event); }
then, in my base class, I can do this:
public abstract class SmartQueue { addDataAvailabi lityListener(Da taAvailabilityL istener listener); }
then in my implementation class, say a memory-backed smart queue, I can do this:
public class MemorySmartQueu e implements SmartQueue { public void poolForData() { // data available! while(iter.hasN ext()) { DataAvailabilit yListener lis = (DataAvailabili tyListener)iter .next(); lis.dataArrived (someEvent); } } }
Simple and straighforward. However, consider a C# implementation: in the interface, I may have something like this:
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived; }
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! if(DataArrived == null) { // BZZZZTTT!!! Can only do this in SmartQueue! DataArrived(thi s, args); } } }
I can't believe this. Either I'm missing a really obvious thing, or I have to deal with this... this... awkward mechanism. Why the hell doesn't it allow me to raise an event in the derived class? I don't want to put any behaviour in my abstract class, I want to put just an interface! Is there any way around this? (Plus I hope Whidbey will give us a Set collection, dammit).
TIA! Elder
Happened to me all the time.. I hadn't been typing "virtual" for about 7
years, since I left C++ behind ;)
Chris Taylor wrote: Hi,
Mistake in my code, in my haste, I forgot to make the On.... virtual SORRY.
public virtual void OnDataArrived( YourEventArgs e )
Regards
Hi,
You could use BeginInvoke, and remember to always call EndInvoke. The events
will still be fired synchroneously, but in a separate thread. Something like
the following should do, this will be limited to only one handler however.
public virtual void OnDataArrived( EventArgs e )
{
if ( DataArrived != null )
DataArrived.Beg inInvoke( this, e, new AsyncCallback(
DataArrivedComp leted ), null );
}
private void DataArrivedComp leted( IAsyncResult ar )
{
if ( DataArrived != null )
DataArrived.End Invoke( ar );
}
You could also just use a separate thread to fire the event in, that way you
can have multiple handlers.
public virtual void OnDataArrived( EventArgs e )
{
if ( DataArrived != null )
System.Threadin g.ThreadPool.Qu eueUserWorkItem ( new
System.Threadin g.WaitCallback( FireDataArrived ), e );
}
private void FireDataArrived ( object e )
{
if ( DataArrived != null )
DataArrived( this, (EventArgs)e );
}
Then you can also fire each handler individually.
public virtual void OnDataArrived( EventArgs e )
{
if ( DataArrived != null )
foreach( DataAvailabilit yEventHandler d in
DataArrived.Get InvocationList( ) )
{
d.BeginInvoke( this, e, new AsyncCallback(D ataArrivedEvent Complete),
d );
}
}
private void DataArrivedEven tComplete( IAsyncResult ar )
{
DataAvailabilit yEventHandler e =
(DataAvailabili tyEventHandler) ar.AsyncState;
e.EndInvoke( ar );
}
Of course you would have to make sure the caller is aware of this
non-standard event calling and manage thread syncronization for shared data
etc. This code also lacks significant error handling, but should leave you
with a number of options.
Hope this helps
--
Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/
<di********@dis cussion.microso ft.com> wrote in message
news:Oj******** ******@TK2MSFTN GP11.phx.gbl... How can we perform an Async event in C#?
Events are Synchronous usually. Do we just call BeginInvoke, if so, how would we do this?
"Chris Taylor" <ch************ *@hotmail.com> wrote in message news:#G******** ******@TK2MSFTN GP10.phx.gbl... Hi,
It is standard to implement a method to fire the event, this method is
the event name prefixed with 'On'. So in your case the base class would have
a OnDataArrived, which can be called from anywhere. This has the advantage of not having to cluter your code checking if the event has any delegates before firing and also gives the derived implementation an alternative
and better performing method of handling the event by overriding the On... method.
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived;
// This is called to fire the event public void OnDataArrived( YourEventArgs e ) { if ( DataArrived != null ) DataArrived( this, e ); } }
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! OnDataArrived( args ); // Fire the event } }
Hope this helps -- Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/ "Elder Hyde" <no_way> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hey all,
A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate, consider what
I'll do in Java:
public interface DataAvailabilit yListener extends java.util.Event Listener { void dataArrived(Dat aAvailabilityEv ent event); }
then, in my base class, I can do this:
public abstract class SmartQueue { addDataAvailabi lityListener(Da taAvailabilityL istener listener); }
then in my implementation class, say a memory-backed smart queue, I
can do this:
public class MemorySmartQueu e implements SmartQueue { public void poolForData() { // data available! while(iter.hasN ext()) { DataAvailabilit yListener lis = (DataAvailabili tyListener)iter .next(); lis.dataArrived (someEvent); } } }
Simple and straighforward. However, consider a C# implementation: in
the interface, I may have something like this:
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived; }
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! if(DataArrived == null) { // BZZZZTTT!!! Can only do this in SmartQueue! DataArrived(thi s, args); } } }
I can't believe this. Either I'm missing a really obvious thing, or I have to deal with this... this... awkward mechanism. Why the hell doesn't it allow me to raise an event in the derived class? I don't
want to put any behaviour in my abstract class, I want to put just an interface! Is there any way around this? (Plus I hope Whidbey will give us a Set collection, dammit).
TIA! Elder
I would assume this is a rare case that we would need async events then if
its so much hassle.
I am basically trying to draw a similarity between Win32 PostMessage and
SendMessage. Usually I used PostMessage as a way to fire events rather than
SendMessage wheras on C# I am using the equivilent to SendMessage now.
"Chris Taylor" <ch************ *@hotmail.com> wrote in message
news:Oh******** ******@tk2msftn gp13.phx.gbl... Hi,
You could use BeginInvoke, and remember to always call EndInvoke. The
events will still be fired synchroneously, but in a separate thread. Something
like the following should do, this will be limited to only one handler however.
public virtual void OnDataArrived( EventArgs e ) { if ( DataArrived != null ) DataArrived.Beg inInvoke( this, e, new AsyncCallback( DataArrivedComp leted ), null ); }
private void DataArrivedComp leted( IAsyncResult ar ) { if ( DataArrived != null ) DataArrived.End Invoke( ar ); }
You could also just use a separate thread to fire the event in, that way
you can have multiple handlers.
public virtual void OnDataArrived( EventArgs e ) { if ( DataArrived != null ) System.Threadin g.ThreadPool.Qu eueUserWorkItem ( new System.Threadin g.WaitCallback( FireDataArrived ), e ); }
private void FireDataArrived ( object e ) { if ( DataArrived != null ) DataArrived( this, (EventArgs)e ); }
Then you can also fire each handler individually.
public virtual void OnDataArrived( EventArgs e ) { if ( DataArrived != null ) foreach( DataAvailabilit yEventHandler d in DataArrived.Get InvocationList( ) ) { d.BeginInvoke( this, e, new
AsyncCallback(D ataArrivedEvent Complete), d ); } }
private void DataArrivedEven tComplete( IAsyncResult ar ) { DataAvailabilit yEventHandler e = (DataAvailabili tyEventHandler) ar.AsyncState; e.EndInvoke( ar ); }
Of course you would have to make sure the caller is aware of this non-standard event calling and manage thread syncronization for shared
data etc. This code also lacks significant error handling, but should leave you with a number of options.
Hope this helps
-- Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/ <di********@dis cussion.microso ft.com> wrote in message news:Oj******** ******@TK2MSFTN GP11.phx.gbl... How can we perform an Async event in C#?
Events are Synchronous usually. Do we just call BeginInvoke, if so, how would we do this?
"Chris Taylor" <ch************ *@hotmail.com> wrote in message news:#G******** ******@TK2MSFTN GP10.phx.gbl... Hi,
It is standard to implement a method to fire the event, this method is the event name prefixed with 'On'. So in your case the base class would
have a OnDataArrived, which can be called from anywhere. This has the
advantage of not having to cluter your code checking if the event has any delegates before firing and also gives the derived implementation an alternative and better performing method of handling the event by overriding the On... method.
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived;
// This is called to fire the event public void OnDataArrived( YourEventArgs e ) { if ( DataArrived != null ) DataArrived( this, e ); } }
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! OnDataArrived( args ); // Fire the event } }
Hope this helps -- Chris Taylor http://dotnetjunkies.com/WebLog/chris.taylor/ "Elder Hyde" <no_way> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. > Hey all, > > A class of mine needs to tell the outside world when its buffer is
not > empty. The problem is that C# seems to force you to put the > event-raising code in the base class. To illustrate, consider what
I'll > do in Java: > > public interface DataAvailabilit yListener extends java.util.Event Listener { > void dataArrived(Dat aAvailabilityEv ent event); > } > > then, in my base class, I can do this: > > public abstract class SmartQueue { > addDataAvailabi lityListener(Da taAvailabilityL istener listener); > } > > then in my implementation class, say a memory-backed smart queue, I can > do this: > > public class MemorySmartQueu e implements SmartQueue { > public void poolForData() { > // data available! > while(iter.hasN ext()) { > DataAvailabilit yListener lis = > (DataAvailabili tyListener)iter .next(); > lis.dataArrived (someEvent); > } > } > } > > Simple and straighforward. However, consider a C# implementation: in the > interface, I may have something like this: > > public abstract class SmartQueue { > public event DataAvailabilit yEventHandler DataArrived; > } > > Now, consider what I have to do in MemorySmartQueu e: > > public class MemorySmartQueu e : SmartQueue { > public override void poolForData() { > // data available! > if(DataArrived == null) { > // BZZZZTTT!!! Can only do this in SmartQueue! > DataArrived(thi s, args); > } > } > } > > I can't believe this. Either I'm missing a really obvious thing, or
I > have to deal with this... this... awkward mechanism. Why the hell > doesn't it allow me to raise an event in the derived class? I don't want > to put any behaviour in my abstract class, I want to put just an interface! > > Is there any way around this? (Plus I hope Whidbey will give us a
Set > collection, dammit). > > TIA! > Elder
"Elder Hyde" <no_way> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hey all,
A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate, consider what I'll do in Java:
public interface DataAvailabilit yListener extends java.util.Event Listener
{ void dataArrived(Dat aAvailabilityEv ent event); }
then, in my base class, I can do this:
public abstract class SmartQueue { addDataAvailabi lityListener(Da taAvailabilityL istener listener); }
then in my implementation class, say a memory-backed smart queue, I can do this:
public class MemorySmartQueu e implements SmartQueue { public void poolForData() { // data available! while(iter.hasN ext()) { DataAvailabilit yListener lis = (DataAvailabili tyListener)iter .next(); lis.dataArrived (someEvent); } } }
Simple and straighforward. However, consider a C# implementation: in the interface, I may have something like this:
public abstract class SmartQueue { public event DataAvailabilit yEventHandler DataArrived; }
Now, consider what I have to do in MemorySmartQueu e:
public class MemorySmartQueu e : SmartQueue { public override void poolForData() { // data available! if(DataArrived == null) { // BZZZZTTT!!! Can only do this in SmartQueue! DataArrived(thi s, args); } } }
I can't believe this. Either I'm missing a really obvious thing, or I have to deal with this... this... awkward mechanism. Why the hell doesn't it allow me to raise an event in the derived class? I don't want to put any behaviour in my abstract class, I want to put just an
interface!
It is an annoying thing. The CLR does allow for a protected raise_
method(atleast, by a vauge reading), however C# doesn't appear to support
this currently(MC++ is the only one I know that does.
Anyway, if you don't want any serious implementation in your base class, you
can do
public abstract class BaseClass
{
public event MyEventHandler MyEvent
{
add
{
Delegate.Combin e(myEventDelega te,value);
}
remove
{
Delegate.Remove (myEventDelegat e,value);
}
}
//this will contain the invocation list, might wanna convert this
//to a protected property so that you don't *have* to back off
myEventDelegate .
protected MyEventHandler myEventDelegate ;
}
(note the syntax may be a touch off, I'm working from memory).
I would not be adverse to allowing a
raise
{
}
style method to events, however convincing the C# team of such may be
substatial work. Is there any way around this? (Plus I hope Whidbey will give us a Set collection, dammit).
TIA! Elder This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pavils Jurjans |
last post by:
Hallo,
I have been programming for restricted environments where Internet Explorer
is a standard, so I haven't stumbled upon this problem until now, when I
need to write a DOM-compatible code.
The question is about best practices for passing parameters to an event
function.
I have, say, the following HTML:
|
by: Eric |
last post by:
How can I dynamically assign an event to an element?
I have tried :
(myelement is a text input)
document.getElementById('myelement').onKeyUp =
"myfnc(param1,param2,param3)";
document.getElementById('myelement') = new
Function("myfnc(param1,param2,param3)");
|
by: Amir Hardon |
last post by:
I am dynamically adding rows to a table, and each row have a button which
removes it.
I have successfully implemented this for mozilla but I'm having troubles
with IE, here is how I did it:
Each new row's id is an index number, each button's name is the row's id,
and I'm adding this function as the click event listener for the button:
function removeline(event){
var row=document.getElementById("row" + event.target.name);
|
by: VK |
last post by:
My original idea of two trains, however pictural it was, appeared to be
wrong. The truth seems to be even more chaotic.
IE implements its standard down-up model: any mouse event goes from the
deepest visible element to the top. By carefully studying fromElement
and toElement properties, one can handle events on any point of their
way up.
NN/FF implements a "Russian hills" style: mouse events go first
up->down (window->deepest...
|
by: rich_poppleton |
last post by:
Help....
I've got a textarea where people type in a description. However for
certain reasons we need to stop them typing !$*^ .
I have a solution this which works fine in IE:
function keypress()
{
| |
by: Melissa |
last post by:
What specifically causes the Format event of a report's section to fire?
Thanks!
Melissa
|
by: Garibaldi |
last post by:
Folks,
I'm having a bad regex day and can sure use your help, please..
I have a Regex expression that works fine. It's purpose is to isolate all
data from the start of a string begining with 200~ to the end of the string
but before the start of the next 200~. Here's the regex expression and test
data:
(?ms)^200~(.*?)(?=^200~)
|
by: Jack Russell |
last post by:
My unstanding of all VB up to and including vb6 is that an event could
not "interrupt" itself.
For instance if you had a timer event containing a msgbox then you would
only get one message.
However in vb.net you get continual messages (even setting the system
modal property).
Firstly, are these two assumptions right and if so what is the approved
|
by: prabhdeep |
last post by:
Hi,
Can somebody explain, why in following code, i get "event not defined"
error
funcTest(sMenu)
{
doument.getElementById('id1').addEventListener('mousedown', function(){
click(sMenu, event); }, false);
}
|
by: afrotec2k |
last post by:
Hi I am trying to extract data using SQL Server 2005 from a table on an ODBC linked server using the following syntax:
select *
from ...
When I run the query the following message appears:
'Error converting data type DBTYPE_DBTIMESTAMP to datetime'
I know that this is because a date or dates have been incorrectly input into the source database (e.g. 200-06-01 instead of 2008-06-01)
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |