Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListBox: Setting Single Record as Value on Init
Message
 
To
09/10/2005 12:39:14
Lynn Bleck
Cents-Able Business Systems
Concord, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01057533
Message ID:
01057544
Views:
11
>Thank you for replying...I tried your suggestion and now the value is correct, however, when I issue the setfocus and refresh, the focus is still not activating on the selected record. I am using this code in the list init:
>
>SELECT t_pick
>IF SEEK(m.t_millordr, 't_pick')
> thisform.list1.value = t_pick.t_millordr
> m.lst = t_pick.t_millordr
> thisform.list1.setfocus
> thisform.list1.refresh
>ENDIF

Here an exaple that works for me:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (d:\works\traff\test.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   10/09/05 07:49:06 PM
*
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 314
	Width = 279
	ScrollBars = 1
	DoCreate = .T.
	ShowTips = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT list1 AS listbox WITH ;
		BoundColumn = 2, ;
		ColumnCount = 2, ;
		ColumnWidths = "150,60", ;
		ControlSource = "cTest1.Test", ;
		Height = 267, ;
		Left = 8, ;
		Top = 27, ;
		Width = 257, ;
		BoundTo = .T., ;
		Name = "List1"


	PROCEDURE Init
		thisform.List1.RowSourceType = 6 
		thisform.List1.RowSource     = [cTest.Name1, Numtest]

		SELECT cTest
		GO 5
		thisform.List1.Value = Numtest
		thisform.List1.Refresh()
		thisform.List1.SetFocus()
	ENDPROC


	PROCEDURE Load
		CREATE CURSOR cTest1 (test N(10))
		APPEND BLANK

		CREATE CURSOR cTest (Numtest N(10), Name1 C(10))
		FOR asd = 1 TO 10
		    INSERT INTO cTest VALUES (asd, "Name1"+TRANSFORM(asd))
		NEXT
		GO TOP
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform