Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: rino tenorio
  Where is rino tenorio?
 pasig
 Philippines
 rino tenorio
 Tags
Subject: RE: Combo box
Thread ID: 190056 Message ID: 190058 # Views: 48 # Ratings: 0
Version: Visual FoxPro 3 Category: Linux and VFP
Date: Tuesday, August 19, 2008 7:26:39 AM         
   


> Hi Experts,
>
> I had a combo box in visual foxpro with a Style - 0 Dropdown combo.
> When I run my form and I type something in the combo box. I lost the data before I went through the Valid event of the combobox.
>
> My objective is when I type something in the combobox without pressing the arrow button it will prompt me that my inputs are not in the list???
>

Hi Rino -

When the value is not in combo.RowSource yet, you may need to add it, at least temporarily.
(You can add a MessageBox() in combo.Valid() in the example.prg below).


hth
-Stefan


LOCAL loForm
loForm=NEWOBJECT("form1")
loForm.Show(1)
RETURN

DEFINE CLASS form1 AS form
	ADD OBJECT combo1 AS combobox WITH ;
		RowSourceType = 3, ;
		RowSource = "select * from temp into cursor (sys(2015))", ;
		Height = 24, ;
		Left = 72, ;
		Top = 60, ;
		Width = 100

	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 156, ;
		Top = 156, ;
		Width = 100, ;
		Value = 'focus dummy'

	PROCEDURE Load
		LOCAL lnSelect
		lnSelect = SELECT(0)
		CREATE CURSOR temp (test C(10))
		INDEX on test TAG test
		FOR i = 1 TO 3
			INSERT INTO temp VALUES (TRANSFORM(i))
		ENDFOR
		GO TOP
		SELECT (m.lnSelect)
	ENDPROC

	PROCEDURE combo1.Valid
		LOCAL lcValue
		lcValue	= TRIM(This.DisplayValue)
		IF !EMPTY(m.lcValue) AND !INDEXSEEK(m.lcValue,.F.,'temp','test')
			INSERT INTO temp VALUES (m.lcValue)
			This.Requery()
		ENDIF
	ENDPROC
ENDDEFINE




COMPLETE THREAD
Combo box Posted by rino tenorio @ 8/19/2008 7:11:35 AM
RE: Combo box Posted by Stefan Wuebbe @ 8/19/2008 7:26:39 AM
RE: Combo box Posted by rino tenorio @ 8/19/2008 7:37:26 AM
RE: Combo box Posted by Marcia Akins @ 8/19/2008 12:58:50 PM
RE: Combo box Posted by rino tenorio @ 8/20/2008 7:09:38 AM
RE: Combo box Posted by Marcia Akins @ 8/20/2008 12:42:45 PM
RE: Combo box Posted by rino tenorio @ 8/26/2008 6:40:56 AM