Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to programicly change active element in a listbox
Message
From
28/06/2000 15:05:52
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00385962
Message ID:
00385989
Views:
15
>when I look at the listbox the "pointer" doesn't move, I then hit the up or down arrow and it puts me back at the top of the listbox

Hmmm, well, what is the record source of you're List Box? What is the control source? You can simply update the field the control is bound too, and refresh() it.

Here's is what I was doing in my first example:
oForm = createobject('listsearch')
oForm.Show(1)
DEFINE CLASS listsearch AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "listsearch"


	ADD OBJECT list1 AS listbox WITH ;
		RowSourceType = 1, ;
		RowSource = "a,b,c,d,e,f,g,h", ;
		Height = 170, ;
		Left = 60, ;
		Top = 60, ;
		Width = 240, ;
		Name = "List1"


	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 60, ;
		Top = 12, ;
		Width = 240, ;
		Name = "Text1"


	PROCEDURE text1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		if nKeyCode = 13
			thisform.list1.value = this.value
			if thisform.list1.listindex = 0
				messagebox('Value not found')
			endif
		endif
	ENDPROC


ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform