Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change width of List Box onMouseOver 1

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
0
0
US
Is there any way to change the width of a DTC ListBox on MouseOver. Rob
Just my $.02.
 
It may be - using the style property of the listbox - thru which you can apply the rich set of CSS facilities. You would clearly need JavaScript and a good DOM implementation - typically IE 5 upwards fully supports the style property, but NS4 is fairly poor.

But to start, you need to get the DTC to generate an 'onmouseover="something"' with the listbox. To do this you must 'Advise' the listbox to see the mouseover and mouseout events:

lstMyList.Advise "onmouseover", "dummy()"
lstMyList.Advise "onmouseout", "dummy()"

And you may need to implement an empty server-side subroutine called 'dummy()'.

The generated listbox HTML will now include the onmouseover and onmouseout event - and these will both call some strange system function. So how to call YOUR Client-Side code? Well, you can trap it in the onbeforeserverevent javascript function...

1. ensure you have a PageObjectDTC for the page
2. find the Script Outline view in VI (it could be a tab of the toolbox panel on the left)
3. find the 'thisPage' twig on the Client Object branch (the top branch).
4. double-click the onbeforeserverevent - and hey-presto a bundle of JavaScript is added to your page. It will need adjusting though....

The 'onbeforeserverevent' is raised by ALL DTC's before they do a server-round-trip. The system passes 2 parameters to the function - but you have to add these yourself. The parameters are both strings, and say the name of the object (the listbox, for example) and the event ('onmouseover') Adjust the VI created code as follows:


<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function thisPage_onbeforeserverevent(
i_strObject, i_strEvent
) {

if (i_strObject == 'lstMyListbox')
{
if (i_strEvent == 'onmouseover')
{
//do the listbox sytle change here
document.thisForm.lstMyList.style....
// and cancel the server-round trip
thisPage.cancelEvent = true;
}
else if (i_strEvent == 'onmouseout')
//etc...

}

//-->
</SCRIPT>


Just add the stuff in bold above. You will have to figure out which style properties you need to adjust.

NOTE: VI will NOT pop-up the listbox name when typing the
document.thisForm.
bit (you MUST include 'document.' if this is to be used by Netscape). However, the listbox will exist when this code runs - so it will work.
 
Thanks a million Merlin. I appreciate you taking the time to help me.

Rob
Just my $.02.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top