Combo Box dropdown list to appear on the right edge of control?

  • Thread starter Thread starter efandango
  • Start date Start date
E

efandango

At the moment, when I hit the arrow button on the combo, the drop-down list
appears directly below the combo-box control.

I want to have my drop-down list left edge appear on the right of the
control. Is this possible? I am using Access 2007 and have looked at all the
various options, but caanot find anything. I know that it will do this
automatically if the combo control is too near, or obscured by the edge of a
form, but there doesn't seem to be a way to manually request this.
 
Maybe this could be done with some tedious investigation of Windows API
calls. There's no way other way of doing it.
 
efandango said:
At the moment, when I hit the arrow button on the combo, the
drop-down list appears directly below the combo-box control.

I want to have my drop-down list left edge appear on the right of the
control. Is this possible? I am using Access 2007 and have looked at
all the various options, but caanot find anything. I know that it
will do this automatically if the combo control is too near, or
obscured by the edge of a form, but there doesn't seem to be a way to
manually request this.

The list drops left-aligned as long as there is room. If there is not room to
the left then it will move to the right as much as needed to make it fit. The
list will even drop *up* if there is no room to drop down. Other than those
behaviors I don't believe you can excercise any control over the list.
 
The list drops left-aligned as long as there is room. If there is not room to
the left then it will move to the right as much as needed to make it fit. The
list will even drop *up* if there is no room to drop down. Other than those
behaviors I don't believe you can excercise any control over the list.

Why not just use a textbox with a listbox that appears and positions
itself accordingly? It's got to be easier than API'ing the thing to
death, which may not be possible anyway.

-- James
 
Minton M said:
Why not just use a textbox with a listbox that appears and positions
itself accordingly? It's got to be easier than API'ing the thing to
death, which may not be possible anyway.

-- James

Then you lose the ability of the thing to automatically move to the other
side if it's moving off of the screen (or out of the window). This too can
be handled with API calls, but it's very, very, very difficult (figuring out
exactly where an Access object is on the screen is hugely difficult when the
object is on a subform). Really, the OP should just accept the default
behaviour and go have a Christmas drinkie.
 
Then you lose the ability of the thing to automatically move to the other
side if it's moving off of the screen (or out of the window). This too can
be handled with API calls, but it's very, very, very difficult (figuring out
exactly where an Access object is on the screen is hugely difficult when the
object is on a subform). Really, the OP should just accept the default
behaviour and go have a Christmas drinkie.

Baz, I'm all in favor of a Christmas drinkie and I'm thinking of
starting early, but I was thinking about this (pre-drinkie) idea:

Private Sub Text0_GotFocus()

Me.List4.Visible = True

If (Me.Text0.Left + Me.Text0.Width + Me.List4.Width) >
Form.WindowWidth Then
Me.List4.Left = Form.WindowWidth - Me.List4.Width - 600
Else
Me.List4.Left = Me.Text0.Left + Me.Text0.Width
End If

End Sub

..... you could do the same thing for height and then hide the control
in the lost_focus event. You could have the events fired on a form
resize too.

-- James
 
Minton M said:
Baz, I'm all in favor of a Christmas drinkie and I'm thinking of
starting early, but I was thinking about this (pre-drinkie) idea:

Private Sub Text0_GotFocus()

Me.List4.Visible = True

If (Me.Text0.Left + Me.Text0.Width + Me.List4.Width) >
Form.WindowWidth Then
Me.List4.Left = Form.WindowWidth - Me.List4.Width - 600
Else
Me.List4.Left = Me.Text0.Left + Me.Text0.Width
End If

End Sub

.... you could do the same thing for height and then hide the control
in the lost_focus event. You could have the events fired on a form
resize too.

-- James

Hi James,

The positioning of a combo box drop-down list responds not only to the edge
of the *window* but also to the edge of the *screen*. This is very, very
difficult to replicate particularly if, as I mentioned before, you want it
to work with controls on subforms. It can be done (I did it years ago to
get a date picker form to pop up in the correct place) but it is far from
easy and I certainly wouldn't recommend attempting it when the default combo
box behaviour already does the job perfectly adequately.

Now I'm off for another drinkie. Merry Christmas!

Baz
 
Back
Top