When opening the list for a combo box, is there a way to set the pointer to a certain place. For example the combo box contains a list of names from A-Z. When the list is opened I want the list to start at a particular letter based on the value in a textbox.
PROCEDURE TEXT1.INTERACTIVECHANGE
FOR I = 1 TO THISFORM.COMBO1.LISTCOUNT
IF LEFT(UPPER(THISFORM.COMBO1.LIST(I)),1) = LEFT(UPPER(THIS.VALUE),1)
THISFORM.COMBO1.SELECTED(I)=.T.
ENDIF
ENDFOR
ENDPROC
PROCEDURE DESTROY
CLEAR EVENTS
ENDPROC
ENDDEFINE
*
*-- EndDefine: test
**************************************************
I entered the code in but the combo box still starts with Apples as being the selected. I tried to set teh value of the textbox to "Orange" and was trying to have the highlite bar positioned over "Orange".
The way I interpreted your requirement, without further info, was when the first character of a selection in the combobox is typed into the textbox, the respective combo item would be highlighted.
In other words, if you enter G in the textbox, Grapefruit would be selected.
Please advise your full requirement. What "code" are you referring to?
I have a combo box on a form, that can be left blank or filled in with a name. The name that will be filled in is stored in another table. I was hoping to do a query on the table that contains the name and have the combo box highlite item set to that name. If I place the name or part of the name in the combo box, the user will have to clear the field if the combo box should be left blank.
Paste this code in your program and execute. Entering a 2-char code in the textbox displays a particular record. It won't be exactly what you need to start with, but we can tailor it.
ADD OBJECT text1 AS TEXTBOX WITH ;
HEIGHT = 23, ;
LEFT = 72, ;
TABINDEX = 1, ;
TOP = 24, ;
WIDTH = 48, ;
NAME = "Text1"
PROCEDURE LOAD
SET SAFETY OFF
CREATE TABLE test FREE (CODE C(2), DESC C(15))
INSERT INTO test (CODE,DESC) VALUES ("01","Apples"
INSERT INTO test (CODE,DESC) VALUES ("02","Grapes"
INSERT INTO test (CODE,DESC) VALUES ("03","Bananas"
INSERT INTO test (CODE,DESC) VALUES ("04","Kiwi"
INSERT INTO test (CODE,DESC) VALUES ("05","Oranges"
ENDPROC
PROCEDURE text1.INTERACTIVECHANGE
LOCATE FOR ALLTRIM(CODE) = ALLTRIM(THIS.VALUE)
THISFORM.combo1.SELECTED(RECNO())=.T.
THISFORM.combo1.REQUERY
ENDPROC
ENDDEFINE
*
*-- EndDefine: test
**************************************************
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.