Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo Box ??? Values are added automatically to the lis
Message
 
To
13/06/2005 14:18:30
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01022845
Message ID:
01022864
Views:
12
>Borislav,
>
>I did not want to add VALUES to the table upon the initial insert.
>
>I need to use my FieldSetValue class routine to do it based on the _AddMode property value ...
>
>Is there a way to use INSERT INTO without inserting the values reight away?
>
>John
>
>
>WITH THIS
>APPEND BLANK IN (._cAlias)
>._lAddMode = .T. && Set Add Mode to true.
>.FieldSetValue("Key", SYS(2015) )
>.FieldSetValue("tAddStamp", DATETIME() ) && Perform
>.FieldSetValue("cAddBy", pcUserName )
>ENDWITH

Nope,
I fugured out what happens There is no much difference what button you press in this test form:
PUBLIC oform1

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


	**************************************************
*-- Form:         form1 (c:\program files\microsoft visual foxpro 9\test.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   06/13/05 09:24:00 PM
*
DEFINE CLASS form1 AS form


	Top = 51
	Left = 267
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT combo1 AS combobox WITH ;
		Height = 24, ;
		Left = 18, ;
		Top = 30, ;
		Width = 100, ;
		Name = "Combo1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 34, ;
		Left = 168, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "APPEND", ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 64, ;
		Left = 169, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "INSERT", ;
		Name = "Command2"


	PROCEDURE Load
		m1 = "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8"

		CREATE CURSOR cTest (cRewind C(2))
		c1 = ALINES(aaa,m1,7,",")
		FOR asd = 1 TO c1
		    INSERT INTO cTest VALUES (aaa[asd])
		NEXT
		BROWSE NORMAL
		GO TOP
	ENDPROC


	PROCEDURE Init
		WITH thisform.Combo1
		    .Style=  2
		    .RowSourceType = 1
		    .RowSource= "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8"
		    .BoundColumn = 1
		    .ControlSource = "cRewind"
		ENDWITH
	ENDPROC


	PROCEDURE command1.Click
		APPEND BLANK
		REPLACE cRewind WITH "BB"
	ENDPROC


	PROCEDURE command2.Click
		INSERT INTO cTest VALUES ("II")
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
So I suggest you:
1. Add Assign method for _lAddMode
in it:
*** default code here
IF m.vNewVal
   thisform.Combo1.ControlSource = NULL
ELSE
   thisform.Combo1.ControlSource = "YourTable.cRewind"
ENDIF
Can the user add more elemts of the list?

Here it is the code that works as you want:
PUBLIC oform1

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


	**************************************************
*-- Form:         form1 (c:\program files\microsoft visual foxpro 9\test.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   06/13/05 09:31:05 PM
*
DEFINE CLASS form1 AS form


	Top = 51
	Left = 267
	DoCreate = .T.
	Caption = "Form1"
	lappend = .F.
	Name = "Form1"


	ADD OBJECT combo1 AS combobox WITH ;
		Height = 24, ;
		Left = 18, ;
		Top = 30, ;
		Width = 100, ;
		Name = "Combo1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 34, ;
		Left = 168, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "APPEND", ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 64, ;
		Left = 170, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "SAVE", ;
		Name = "Command2"


	PROCEDURE lappend_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		THIS.lAppend = m.vNewVal
		IF m.vNewVal
		   thisform.Combo1.ControlSource = NULL
		ELSE
		   thisform.Combo1.ControlSource = "cTest.crewind"
		ENDIF
	ENDPROC


	PROCEDURE Init
		WITH thisform.Combo1
		    .Style=  2
		    .RowSourceType = 1
		    .RowSource= "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8"
		    .BoundColumn = 1
		    .ControlSource = "cRewind"
		ENDWITH
	ENDPROC


	PROCEDURE Load
		m1 = "1,2,3,4,5,6,7,8,A1,A2,A3,A4,A5,A6,A7,A8"

		CREATE CURSOR cTest (cRewind C(2))
		c1 = ALINES(aaa,m1,7,",")
		FOR asd = 1 TO c1
		    INSERT INTO cTest VALUES (aaa[asd])
		NEXT
		BROWSE NORMAL
		GO TOP
	ENDPROC


	PROCEDURE command1.Click
		thisform.lAppend = .t.
		APPEND BLANK
	ENDPROC


	PROCEDURE command2.Click
		REPLACE cRewind WITH thisform.Combo1.Value
		thisform.lAppend = .f.
		BROWSE NORMAL
	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