I need some clarification...
Pop up menu show when you push up/down arrow in listbox?
What is the point of using Popup when you already see item in list?
Also Popup menu is kind-of modal form, out of focus turns visible to off
monarchmk
Junior Poster in Training
71 posts since Mar 2011
Reputation Points: 34
Solved Threads: 16
In a timer with say an interval of 1000, the following -
mnuPopup.Visible = False
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
If my list box item is too long, and that is not visible in my list box because of list box width.
Then, you want to put all invisible (items out of bounds of list box) items in popup menu?
If this is point, why not put columns in list box?
Also how big will be popup window?
popup and List-box sizes are almost same size, so i do not thing that you will gain space using popup and not enlargeing listbox. Except on small forms.
monarchmk
Junior Poster in Training
71 posts since Mar 2011
Reputation Points: 34
Solved Threads: 16
If it is a length problem, why not you use a Frame (empty captioned) with label inside (only label can not be put in front of listbox)? There is much less complications.
monarchmk
Junior Poster in Training
71 posts since Mar 2011
Reputation Points: 34
Solved Threads: 16
You have existing list1 and lstName. by properties that you use, I think lstName is label. If you can use that or any other label, please check following code
On every list1 item that is longer than 18 characters it will show label above list1. And hide it if length is < 18 characters.
Some of the code inside this procedure (like width. height of label) is not intend to be here but for sake of the sample i must use it this way.
Check is this works for you...
Private Sub List1_KeyUp(KeyCode As Integer, Shift As Integer)
'lstName.Caption = List1.Text
If Len(List1.Text) > 18 Then
lstName.Caption = List1.Text
lstName.Width = Len(List1.Text) * 100
lstName.Height = 300
lstName.BorderStyle = 1
lstName.Left = List1.Left
lstName.Top = List1.Top - lstName.Height
lstName.Visible = True
lstName.ZOrder (0)
Else
lstName.Visible = False
End If
End Sub
monarchmk
Junior Poster in Training
71 posts since Mar 2011
Reputation Points: 34
Solved Threads: 16
Can you post a snap shot your UI here, just for reference.
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
Dear Sir,
Thanks for replying sir, "LstName" is the name of pop up menu. In my previous thread also some respected member suggested to use label. But my requirement is not that actually. I think i will not get the appropriate answer here. Any way, thank you once again sir.
giving up so easy?...
What about TextBox? If you do not like Label, use TextBox. If you make it property Flat(appearance=0) and BorderStyle=0 (none) it will look same as PopUp. Even with standar settings looks almost same as PopUp. Down you can find same code for textbox control with your measurements for position same as PopUp. Even you can select text or parts of text inside.
And if must be PopUp, there must be some specific reason. Let us hear it, maybe if this could not be solved with popup, We can try find similar control for you!
Private Sub List1_KeyUp(KeyCode As Integer, Shift As Integer)
If Len(List1.Text) > 1 Then
Text1.Text = List1.Text
Text1.Width = Len(List1.Text) * 200
Text1.Height = 400
Text1.Left = List1.Left + List1.Width / 2
Text1.Top = List1.Top + List1.Height / 2
Text1.Visible = True
Else
Text1.Visible = False
End If
End Sub
monarchmk
Junior Poster in Training
71 posts since Mar 2011
Reputation Points: 34
Solved Threads: 16
I agree with monarchmk.
I gave the suggestion on the previous posting using a popup menu. The problem here is that the popup will not change its visible property if not clicked on. The OP wants a "popup" to show when scrolling down the list, using the up/down arrow keys.
The text box control can be manipulated and used as a popup as monarch has suggested.
What I would like to know from P. Manidas, why do you need to show a popup if the user can see what text is highlighted in the list box? Maybe there is another , easier solution for you.
Also, as Das has suggested, show us a picture of your screen, maybe we will understand better of what you need. It seems we are all guessing, and it also seems that we are guessing wrong.:)
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
Difference between tooltip, textbox or any similar text control is almoust none...
They all look almost same.
I see problem on other side. You can not control where is current(active) row in listbox and you cannot position any controls below or inline with active row.
As for tooltip VB does not have any tools that could change any property of it. And also in VB tooltips are not show if there is no mouse involved.
monarchmk
Junior Poster in Training
71 posts since Mar 2011
Reputation Points: 34
Solved Threads: 16
I have changed your code a bit. I have only used your list2 and the up/down arrow keys -
Move text1 so that list2 and text1's tops is the same.
Private Sub List2_KeyUp(KeyCode As Integer, Shift As Integer)
Text1.Visible = False
Text1.BackColor = &HD8FCFE
Text1.BorderStyle = 1
If KeyCode = vbKeyDown Then
Text1.Visible = True
If Len(List2.Text) >= 1 Then
If Text1.Top >= (List1.Top + List1.Height) - (Text1.Height + 50) Then
Text1.Top = Text1.Top
Else
Text1.Top = Text1.Top + 170
End If
Text1.Text = List2.Text
Text1.Width = Len(List2.Text) * 150
Text1.Left = (List2.Left + List2.Width) + 50
Text1.Visible = True
Else
Text1.Visible = False
End If
ElseIf KeyCode = vbKeyUp Then
Text1.Visible = True
If Len(List2.Text) >= 1 Then
If Text1.Top >= (List1.Top + List1.Height) - (Text1.Height + 50) Then
Text1.Top = Text1.Top - 170
ElseIf Text1.Top <= List1.Top Then
Text1.Top = List1.Top
Else
Text1.Top = Text1.Top - 170
End If
Text1.Text = List2.Text
Text1.Width = Len(List2.Text) * 150
Text1.Left = (List2.Left + List2.Width) + 50
Text1.Visible = True
Else
Text1.Visible = False
End If
End If
End Sub
This should be what you were looking for.
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
It was only a pleasure P. Happy coding.:)
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350