|
-
Mar 11th, 2001, 11:54 PM
#1
Thread Starter
Member
The subject pretty much says it all but what I want to do is create a text entry field inside of a list box at the end of the list when a button is clicked. Any help is welcomed. TIA.
-
Mar 11th, 2001, 11:57 PM
#2
PowerPoster
-
Mar 11th, 2001, 11:59 PM
#3
just curious, what is the purpose of this?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 12th, 2001, 01:43 PM
#4
Thread Starter
Member
I don't think it was understood what I was wanting to do. I have a listbox. When a user clicks a command button I want a text box to appear inside the listbox at the very bottom (under the last entry) so that text can be typed. When the user clicks outside of the text box I want the text inside the text box to become the (new) last entry on the list. I suppose the same end result (an new entry at the end of the box) could be achieved using a text box on the form or something like that but I've seen this done and would like to use this method as it's more visual appealling and cuts down on form space used.
-
Mar 12th, 2001, 02:25 PM
#5
Fanatic Member
I think I know what you mean, this can be done by using a ListView instead of a ListBox with the LabelEdit property set to Automatic (or Manual if you want to activate is using a command button). It fires the BeforeLabelEdit and AfterLabelEdit events, which you can use to determine if the user has changed the label.
Good luck!
-
Mar 12th, 2001, 02:55 PM
#6
Use the SetParent API function.
Code:
Private Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, ByVal hWndNewParent As _
Long) As Long
Private Sub Form_Load()
SetParent Text1.hWnd, List1.hWnd
End Sub
-
Mar 12th, 2001, 04:39 PM
#7
Fanatic Member
Code:
Private Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, ByVal hWndNewParent As _
Long) As Long
Private Sub Command1_Click()
Text1.Visible = True
Text1.SetFocus
End Sub
Private Sub Form_Load()
SetParent Text1.hWnd, List1.hWnd
Text1.Left = -30
Text1.Top = List1.Height - Text1.Height - 30
End Sub
Private Sub Form_Resize()
List1.Width = Me.ScaleWidth
Text1.Width = List1.Width
Me.Height = 3600
End Sub
Private Sub Text1_LostFocus()
List1.AddItem Text1.Text, List1.ListCount
Text1.Visible = False
Text1.Text = ""
End Sub
I just used Matthew's suggestion and tested what you were talking about, hope this is what you needed.
-
Mar 12th, 2001, 10:55 PM
#8
Thread Starter
Member
Suhweet
Thanks guys...that's exactly what I was after. I hate to sound greedy but can anyone tell me how I can place it right under the last entry so that the textbox will pop-up in the same place that the text in contains will appear after Command1_LostFocus() is called?? Many thanks.
-Adam
p.s. If not it's no big deal but if so that would be great.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|