Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox slider question

Status
Not open for further replies.

Ed Andres

IS-IT--Management
Mar 27, 2001
142
US
Can the scroll bar on a combobox be tied to the data so when you slide it up and down using your mouse, the items in the box scroll with it in real time?

Ed
 
When I have a combo with enough data for a scrollbar, pulling the thumb does move the data I see.

Are you really asking how to change the selection in the combo in that case?

Tamar
 
I have a combobox with several hundred records. When I drop the list down and grab the slider with the mouse, I'd like the records to scroll with the slider. Right now, the records do not scroll but when I let go of the slider, it jumps to a new record in the list wherever the slider is.

I hope I am explaining this correctly.

For example, when you drag the slider on a web page of your browser, the page scrolls with it. Imagine that the page did not scroll but when you let go of the slider, it scrolled to that location.

This is how my combobox is acting.

By the way, using VFP 9 SP1

Ed
 
Ed,

I don't know any way of doing this. But I would argue that several hundred records is too many for a combo box. Apart from being somewhat slow, it is very difficult for the user to negotiate.

Instead, I would go for a grid, with some sort of incremental search added. But that still wouldn't meet your requirement to hook the scroll bar in with the display. To solve that, perhaps you need to look for a third-party control.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,
You are probably right about using the combobox this way but the good thing is, if the user knows what they are looking for, they can begin to type and they will go to the record they are looking for.

I thought about a grid but it seemed like overkill for this. I'll keep looking.

Thanks

Ed
 
In a simple test form, I'm seeing exactly the behavior you're asking for. Here's the code as generated by the Class Browser. Does this work for you?

Code:
**************************************************
*-- Form:         form1 (d:\fox\testcode\vfp9\longcombo.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   11/07/07 04:42:00 PM
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	*-- XML Metadata for customizable properties
	_memberdata = ""
	Name = "Form1"


	ADD OBJECT combo1 AS combobox WITH ;
		RowSourceType = 2, ;
		RowSource = "Junk", ;
		Left = 60, ;
		Top = 36, ;
		Name = "Combo1"


	PROCEDURE Load
		CREATE CURSOR Junk (cFld C(5))

		FOR n=1 TO 300
			INSERT INTO Junk VALUES ("ab" + TRANSFORM(n))
		ENDFOR 
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
 
Hello Ed;
Unfortunately what you want cannot be done with the base combobox control. But you can create your own "combobox" control to do what you want using a textbox with an arrow next to it and when clicked a grid is made visible (to look like the choices portion of the combobox) and when the user "slides" on the choices in the grid the textbox will show each choices.
Having said that; Its simple enough to implement but IMO not worth the effort as you are really not accomplishing anything.
 
Wow - this is strange. I tried Tamar's code on my computer at work and got nothing. Tried it on my computer at home and it works just like I want.

Guess I'll spend the rest of the night trying to figure out what is different between the two computers. Any ideas where to start?

Ed
 
Ok, so I have no clue why it would work on my home computer and not at work. Both systems are running Windows XP Pro sp2 with all the patches, VFP 9 sp1. The only difference is that one is part of a corporate network and one is not.

Curious??

Ed
 
Hello Ed;

If I understand you correctly;

You want the choices highlighted in the dropdown portion of the combobox to be displayed in the text portion, The value in the text portion should change accordingly when another choice is highlighted...am I correct?

If so I am curious as to how it works on your home computer with just the code Tamar posted...IMO it cannot be done with the combobox base control.
 
No, I want the items in the drop down to scroll with the slider when you grab the slider with your mouse and slide it up and down. This happens on my home computer and not my work system. It appears to work on Tamar's computer but maybe not Mike's.

Ed
 
Oh! Now I understand. If you are using Tamars code i.e. 300 items they should scroll. This should be the case on every machine. (works on mine)
Is the displayvalue of the combobox set to 0 ?(this is the default that will display 7 items)
 
That's weird, and apparently others also don't see the scrolling. The first place I'd look is VFP settings. Compare all your SET commands.

But I actually wonder if this is a Windows setting. Can't turn anything up in Control Panel.

Tamar
 
I can change the DisplayCount to any number and it still does not scroll. I think it is some sort of VFP setting as it is being passed to the compiled executable.

I will look closer at my machine at home and see what I can turn up.

Thanks for hanging with me.

Ed
 
I guess it's the graphics card and it's driver. Perhaps hardware accelleration is set to low on the machine so scrolling won't be done. It also may be a windows setting. I'd not search within vfp for differences, there is no such setting in vfp cpntrolling the scroll behaviour.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top