IE4: OnBlur / OnFocus Not Firing for ActiveX <OBJECT> 
Author Message
 IE4: OnBlur / OnFocus Not Firing for ActiveX <OBJECT>

I've developed some VBScript event handlers that will globally handle the
onblur and onfocus events generated by all the controls on an HTML form.  In
order to invoke the event handlers, I've added the event handler inside the
tag for the controls in question.  This works great for capturing the onblur
and onfocus events from elements such as <INPUT> and <SELECT>, but for some
reason these events are not being fired by any of the ActiveX controls I've
included as <OBJECT> tags in the HTML.

I'm using MSIE 4.01 w/ SP1.  The ActiveX controls in question were developed
using Visual Basic 5.0 w/ SP3.

Here is a pseudo-code example:

***

<!-- These are the global event handlers -->
<script  language="vbs">
    sub DoFocus
        ' do something
    end sub
    sub DoBlur
        ' do something
    end sub
</script>

<!-- This element fires the global DoBlur and DoFocus like it should... -->
<input id = "MyInput" onblur="DoBlur" onfocus="DoFocus">

<!-- This element doesn't... -->
<object id ="MyObject" classid="CLSID:..." onblur="DoBlur"
onfocus="DoFocus">

<!-- This doesn't work either... -->
<script language=vbs for="MyObject" event="OnFocus">
    DoFocus
</script>
<script language=vbs for="MyObject" event="OnBlur">
    DoBlur
</script>

<!-- Neither does this... -->
<script language=vbs>
    sub MyObject_OnFocus()
        DoFocus
    end sub
    sub MyObject_OnBlur()
        DoBlur
    end sub
</script>

***

As a cheesy workaround, I've created custom events in the ActiveX control
(MyFocus and MyBlur) that I raise inside the control when it gets/loses
focus.  I can then write VBScript code to capture these events.
Unfortunately, this slows down the loading/displaying of the page by a few
tenths of a second due to additional VBScript code (not to mention it is
rather annoying to type repeatedly).  Also, it would cause me serious
difficulty if I needed to add ActiveX controls that I didn't have the source
code for.  Here is some pseudo-code:

***

<object id ="MyObject" classid="CLSID:...">

<!-- These events are raised inside the ActiveX object -->
<script language=vbs for="MyObject" event="MyFocus">
    DoFocus
</script>
<script language=vbs for="MyObject" event="MyBlur">
    DoBlur
</script>

***
Any suggestions?  Is this a known bug or am I missing something obvious?

Thanks,



Sun, 14 Jan 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. <<<<<<<<ComboBox>>>>>>>>>>>>

2. HELP >>>>>>WIN API <<<<<<<<<<

3. ---------->>>> Object is not an array <<<<-------

4. IGNORE the ---->>>> Object not an array <<<<---- message

5. onfocus and onblur

6. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

7. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

8. <<<<HELP- OLE container Control>>>>>>>>>

9. VB5<->RDO2<->ODBC<->ORACLE Procedure Problem

10. <<<Cneck Box>>>

11. <<<Gif Files>>>

12. <<<CD ROM>>>

 

 
Powered by phpBB® Forum Software