Z-Index for Custom Controls

J

Jayaveer Bhupalam

Hi,
I have created a DatePicker Cutom control, where i am displaying the
dates in the form of Hyperlinks in a table. The problem is if there is a
Combo or ListBox below the Datepicker Custom control then the table is going
back of the combobox or listbox. I have tried increasing the Z-Index of the
Datepicker Custom control, but there is no change. Can anyone got a solution
for this so that my Datepicker control stays on top always ???
 
A

Alvin Bruney [MVP]

you are between a rock and a hard place. i can only offer you a cushion.the
problem is because html elements are either windowed or windowless controls.
Windowed controls always float to the surface above windowless controls.
your datepicker is a windowless control, listboxes and activeX controls are
windowed. These will always be at the top. There is a hack but it is very
ugly. You can force your datepicker control into a windowed element using
javascript. Windowed elements respond to Z-ordering when paired with other
windowed controls.

Here is an excerpt from my forth-coming book (The Microsoft O.W.C. with
..NET)

Html elements are divided into two categories. Windowed controls and
windowless controls. ActiveX controls like the spreadsheet are actually
rendered as windowless controls. Windowed controls always float to the
surface when paired with windowless controls. The trick here is to design a
windowed element to sit on top of the browser. Here is one such approach.



<SCRIPT LANGUAGE="JScript">

var popper = window.createPopup();

var Body = popper.document.body;

Body.style.backgroundColor = "white";

Body.style.border = "double black 1px";

Body.innerHTML = "<DIV style='Z-INDEX: 104; LEFT: 324px; WIDTH: 180px;
POSITION: absolute; BORDER-TOP-STYLE: ridge;TOP: 150px; HEIGHT: 100px;
BACKGROUND-COLOR: gainsboro' ms_positioning='FlowLayout'></DIV> <INPUT
style='Z-INDEX: 105; LEFT: 440px; POSITION: absolute; TOP: 264px'
type='button' value='Button'>";


popper.show(100, 400, 200, 200, document.body);

</SCRIPT>




This code produces a panel with a ridged edge and a clickable button. With
the right amount of patience, you can get this window to look exactly like a
normal window. This approach could be used to build well-behaved fly-over
menus and the like that will play well with the spreadsheet control. Bear in
mind that stylesheets, scripting and links cannot be used inside this
window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top