|
-
Oct 18th, 2002, 07:39 PM
#1
Thread Starter
PowerPoster
How to edit the combobox's text like a normal textbox?
I have a combobox that I use as a url address bar in my app. The problem I am having is I can't use my mouse to highlight certain parts of the text. When I click on the text, it is all highlighted, but then when I try to click at the end of the text and drag my mouse over it as to highlight certain parts of it, it doesn't work.
For example, if I have this text in the combobox:
http://www.vbforums.com/something.htm
and I want to highlight the /something.htm part of it so I can delete it, I can't. I would have to position the cursor at the end, and push the backspace key.
Is there a way to fix this?
-
Oct 19th, 2002, 12:14 PM
#2
Thread Starter
PowerPoster
No one huh? Am I going to have to make a custom control just to do this? Seems unreasonable, but will do it if I have to.
-
Oct 19th, 2002, 02:58 PM
#3
Fanatic Member
Seems to me you could mess with the ComboBox.SelectionStart and SelectionLength properties on the MouseDown event, or just get comfortable with the MS editing keys (control-shift-left, control-shift-right to select a word at a time).
-
Oct 19th, 2002, 03:52 PM
#4
Thread Starter
PowerPoster
Seems like an awful lot of code to do this for something a textbox does automatically.
I think I would rather create my own control that is based on the textbox, but add some combo box functionality....not sure yet.
Anyone else have any ideas? A property that I am forgetting maybe?
-
Oct 20th, 2002, 02:56 AM
#5
Fanatic Member
Dunno if it's going to end up any simpler to add pulldown guts to TextBox than it will be to add mouse selection guts to ComboBox... Good luck though.
-
Oct 20th, 2002, 01:12 PM
#6
Thread Starter
PowerPoster
Originally posted by Slow_Learner
Dunno if it's going to end up any simpler to add pulldown guts to TextBox than it will be to add mouse selection guts to ComboBox... Good luck though.
I am not so sure. I can easily make a user control that has a combobox under a textbox, and only the down arrow showing. Then when ever the text is changed in one, it is reflected in the other... Seems easy, but who knows. Of course, then I have to deal with the resizing, and maybe do a little GDI+ work to make it look pretty.
-
Oct 20th, 2002, 07:45 PM
#7
This may or may not help you but I wanted a specific look to a combo for a project, basically a label with a dropdown list. So I made a wrapper class to add the label over the combo. You'd have to add a button too but it should give you a way to easily replace teh text part of the combo with a normal textbox without making a whole new control. All hail inheritance.
Last edited by Edneeis; Oct 20th, 2002 at 08:01 PM.
-
Oct 20th, 2002, 08:09 PM
#8
Actually it turns out there is no Sunday night football game so I worked up one that uses a textbox and button. It might need some fine tuning to your liking but it should get you a good start.
-
Oct 20th, 2002, 09:13 PM
#9
Thread Starter
PowerPoster
Thanks a lot, that was exactly what I was thinking of doing, just didn't do it yet....
Thanks again.
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
|