From: Bob Butler on 19 Mar 2010 18:13 "David" <NoWhere(a)earthlink.net> wrote in message news:%23O3qC96xKHA.404(a)TK2MSFTNGP02.phx.gbl... > Thanks for both responses. > It doesn't happen for me when the style is set to 2-DropDown List; if you don't need the users to be able to edit the text then that would be the solution.
From: Bob Butler on 19 Mar 2010 18:23 "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message news:%23xLamY6xKHA.5132(a)TK2MSFTNGP05.phx.gbl... > "Bob Butler" <noway(a)nospam.ever> schrieb im Newsbeitrag > news:%233WUxB6xKHA.1548(a)TK2MSFTNGP02.phx.gbl... >> >> "David" <NoWhere(a)earthlink.net> wrote in message >> news:u4CH185xKHA.5576(a)TK2MSFTNGP05.phx.gbl... >>>I have a combobox where some of the items are longer than the >>> listbox part of the combo. >>> >>> If the item text width selected is <= the combo width the item text >>> displays correctly. >>> >>> However if the item text width is > the combo width then the item text >>> shows as right justified cutting off the left portion of the item text. >>> >>> Anyway to resolve so you see the left not right side of the item text? >> >> That's not normal for the standard VB combobox control. Is the >> RightToLeft property of the control set to True? What version of VB are >> you using? What version of Windows? What locale? >> > > > Bob, > > I just checked it. It's normal for the Standard VB combobox. > If you select an item from the list portion of the combobox, > it shows up highlighted in the text field, and if it's longer than > the text field the left part is hidden, the cursor is on the rightmost > side. > Of course, then setting Combo.SelLength = 0 would do the trick, > but no event of the combo is triggered by the users action :-( the user's action triggers the Click event but setting the sellength there doesn't work; one quick hack is to use a timer to create your own event after the combo finishes it's work Private Sub Form_Load() Dim x As Long For x = 1 To 20 Combo1.AddItem "L" & String$(50, Chr$(64 + x)) & "R" Next End Sub Private Sub Combo1_Click() Timer1.Interval = 10 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Combo1.SelStart = 0 Combo1.SelLength = 0 Timer1.Enabled = False End Sub
From: David on 19 Mar 2010 22:02 Mr. Butler: Thanks for your time. Hadn't checked setting to "Drop Down List" May work for me in this situation as using as overlay on MSFlexgrid. Will give it a try. Your Timer idea may work in another context. I !@#$% these workarounds. Wish M$ would still support Classic VB so some of this could get corrected without having to subclass or whatever. David "Bob Butler" <noway(a)nospam.ever> wrote in message news:eeItKM7xKHA.1548(a)TK2MSFTNGP02.phx.gbl... > > "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message > news:%23xLamY6xKHA.5132(a)TK2MSFTNGP05.phx.gbl... >> "Bob Butler" <noway(a)nospam.ever> schrieb im Newsbeitrag >> news:%233WUxB6xKHA.1548(a)TK2MSFTNGP02.phx.gbl... >>> >>> "David" <NoWhere(a)earthlink.net> wrote in message >>> news:u4CH185xKHA.5576(a)TK2MSFTNGP05.phx.gbl... >>>>I have a combobox where some of the items are longer than the >>>> listbox part of the combo. >>>> >>>> If the item text width selected is <= the combo width the item text >>>> displays correctly. >>>> >>>> However if the item text width is > the combo width then the item text >>>> shows as right justified cutting off the left portion of the item text. >>>> >>>> Anyway to resolve so you see the left not right side of the item text? >>> >>> That's not normal for the standard VB combobox control. Is the >>> RightToLeft property of the control set to True? What version of VB are >>> you using? What version of Windows? What locale? >>> >> >> >> Bob, >> >> I just checked it. It's normal for the Standard VB combobox. >> If you select an item from the list portion of the combobox, >> it shows up highlighted in the text field, and if it's longer than >> the text field the left part is hidden, the cursor is on the rightmost >> side. >> Of course, then setting Combo.SelLength = 0 would do the trick, >> but no event of the combo is triggered by the users action :-( > > the user's action triggers the Click event but setting the sellength there > doesn't work; one quick hack is to use a timer to create your own event > after the combo finishes it's work > > Private Sub Form_Load() > Dim x As Long > For x = 1 To 20 > Combo1.AddItem "L" & String$(50, Chr$(64 + x)) & "R" > Next > End Sub > > Private Sub Combo1_Click() > Timer1.Interval = 10 > Timer1.Enabled = True > End Sub > > Private Sub Timer1_Timer() > Combo1.SelStart = 0 > Combo1.SelLength = 0 > Timer1.Enabled = False > End Sub > >
From: Martin Trump on 20 Mar 2010 12:03 David wrote: > Anyway to resolve so you see the left not right side of the item text? Just a suggestion. Doesn't do what you want but might give you a start. A new .exe with a combo. Option Explicit Dim fulltxt() As String Private Sub Form_Load() Dim i As Long, chopped() As String For i = 1 To 2 Combo1.AddItem "ABCDEFGHI" Next i Combo1.AddItem "ABC" Combo1.AddItem "1234567890123456" ReDim fulltxt(Combo1.ListCount - 1) ReDim chopped(Combo1.ListCount - 1) For i = 0 To Combo1.ListCount - 1 fulltxt(i) = Combo1.List(i) chopped(i) = Left$(Combo1.List(i), 4) Next i For i = 0 To Combo1.ListCount - 1 Combo1.List(i) = chopped(i) Next i End Sub Private Sub Combo1_Click() MsgBox fulltxt(Combo1.ListIndex) End Sub Martin
From: Martin Trump on 21 Mar 2010 08:20
David wrote: > I have a combobox where some of the items are longer than the > listbox part of the combo. > > If the item text width selected is <= the combo width the item text > displays correctly. > > However if the item text width is > the combo width then the item text > shows as right justified cutting off the left portion of the item text. > > Anyway to resolve so you see the left not right side of the item text? You could try this. Populate your combo then copy the entries into a string array. Now replace the combo entries with, say Left$(whatever,6). The user sees the truncated ones but you use the string array item. HTH. Martin |