Ordering elements on top of one another

xcmav66

Registered User.
Local time
Today, 03:14
Joined
Oct 29, 2008
Messages
29
I have some code written that makes a calendar visible when i click on a certain combo box (basically a pop up calendar control). For efficiency's sake, I put a list box on top of the calendar element. When the code unhides the calendar however, the list box obscures it. I've tried the bring to front/send to back options but they haven't worked. I also tried creating another calendar control to see if the order in which i created the elements made a difference. How should I fix this?
 
This is a stab in the dark but have you tried hiding the combo box when you make the calendar visible?
 
This is a stab in the dark but have you tried hiding the combo box when you make the calendar visible?

I would rather keep it visible for aesthetic purposes. I will also be adding other elements that will be occupying the same screen space as the calendar when it is hidden so i'm hoping to figure out a generic solution.
 
Sorry, I meant hide the list box that is showing up on top of the calendar...
 
Yeah I understand. I don't really want to be flashing things on and off when someone clicks on an element though.
 
So you have a list box. Then when something happens you want another control, in this case a calendar, to appear on top of it? Sounds like the form would look better if the list box disappeared and the calendar appeared - ? You're going to have a junked up looking form if you have controls laying around on top of others.... IMHO
 
So you have a list box. Then when something happens you want another control, in this case a calendar, to appear on top of it? Sounds like the form would look better if the list box disappeared and the calendar appeared - ? You're going to have a junked up looking form if you have controls laying around on top of others.... IMHO

I would tend to agree with Ken on this one.
 
It just pops up then disappears when the user selects a date from the calander. Is there a way to make it show up on top? If the list box shows up on top there should be a way for me to say that I want the other control on top.
 
I think you're going to be at the mercy of the order in which you place the controls on the form. So if you put the calendar on first then the list box, the list box will default to on top, etc...
 
Some controls don't stack well either. I've noticed that some of them do not allow others to show on top, even if you put them on after the other was added. So, if you post a screenshot of your form, we might be able to make some suggestions as to how you might arrange things to take advantage of this challenge.
 
And you can do the echo thing to prevent the screen flicker if that's a problem...
 
Screenshot.jpg


Here's the screenshot - this is after selecting the "Start Date" combo box. The "Operations" list box is showing up on top.

I have tried completely removing the calendar object and recreating it as the last object and I still get the same problem. Thanks for your continued help guys
 
So, why is the list box so wide when the data is so short?
 
it will be filled with much longer data that is just test data so far
 
IMHO... That whole control on top of the other is just bad juju. Sorry :)
 
How about changing the size of the list box in its Got Focus and Lost Focus events? So, figure out what the size is with it set to fit next to the calendar but not over it. And figure out the size with it the way you have it now. Then, in the got focus event you can use:

Code:
Me.YourListBoxName.Width = WhateverYourValueInInchesIs * 1440

and do the same in the Lost Focus but just replace WhateverYourValueInInchesIs with the smaller value.

So, because we have to use TWIPS (1440 twips per inch) then we can do this (say your list box is 5 inches wide when expanded and 2 inches wide when compressed):

Code:
Private Sub YourListBoxName_GotFocus()
   Me.YourListBoxName.Width = 5 * 1440
End Sub

Private Sub YourListBoxName_LostFocus()
   Me.YourListBoxName.Width = 2 * 1440
End Sub
 

Users who are viewing this thread

Back
Top Bottom