PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form BindControls = .F. ADD OBJECT combo1 AS combobox WITH ; RowSourceType = 5, ; RowSource = "thisform.ax", ; && WHEN THE FORM START, "ax" don't exist Height = 24, ; Left = 161, ; Top = 30, ; Width = 100, ; Name = "Combo1" ADD OBJECT combo2 AS combobox WITH ; RowSourceType = 5, ; Height = 24, ; Left = 162, ; Top = 74, ; Width = 100, ; Name = "Combo2" ADD OBJECT command1 AS commandbutton WITH ; Top = 30, ; Left = 69, ; Height = 27, ; Width = 84, ; Caption = this.Combo1.RowSource, ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; Top = 74, ; Left = 69, ; Height = 27, ; Width = 84, ; Caption = "swap", ; Name = "Command2" PROCEDURE Init ADDPROPERTY(this,"ax[10]") && bind Combo1 thisform.BindControls=.T. * stop bind new source thisform.BindControls = .F. * every set to this.Combo2.RowSource = this.Combo1.RowSource * this don't unbind Combo1 this.Combo1.RowSource = "" && this respect BindControls ENDPROC PROCEDURE command1.Click this.Caption = thisform.Combo1.RowSource ENDPROC PROCEDURE command2.Click thisform.BindControls = .T. ENDPROC ENDDEFINEthis is a funny example:
PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form autocenter = .T. Height = 399 Width = 561 DoCreate = .T. Caption = "Form1" BindControls = .F. Name = "Form1" ADD OBJECT text1 AS textbox WITH ; ControlSource = "cc.ff", ; Height = 23, ; Left = 184, ; Top = 47, ; Width = 100, ; Name = "Text1" ADD OBJECT text2 AS textbox WITH ; ControlSource = "cc.ff", ; Height = 23, ; Left = 186, ; Top = 87, ; Width = 100, ; Name = "Text2" PROCEDURE Init this.BindControls=.T. && this force a controlsource eval at this point this.BindControls=.F. && stop * blank all thisform.setall("ControlSource"," ") && look space(1) * thisform.setall("ControlSource","") && empty string don't respect BindControls = .F. replace cc.ff WITH "new value" ENDPROC PROCEDURE Load CREATE CURSOR cc (ff C(10)) INSERT INTO cc (ff) VALUES ('1234567890') ENDPROC PROCEDURE text1.Valid thisform.text2.Refresh ENDPROC ENDDEFINE