>PUBLIC oform1 > >oform1=NEWOBJECT("form1") >oform1.Show >RETURN > > > ************************************************** >*-- Form: form1 (d:\test\test combobox.scx) >*-- ParentClass: form >*-- BaseClass: form >*-- Time Stamp: 10/01/04 10:25:12 AM >* >DEFINE CLASS form1 AS form > > > DoCreate = .T. > Caption = "Form1" > Name = "Form1" > > > ADD OBJECT combo1 AS combobox WITH ; > ColumnCount = 2, ; > ColumnWidths = "100,200", ; > Height = 24, ; > Left = 192, ; > Top = 72, ; > Width = 100, ; > Name = "Combo1" > > > ADD OBJECT optiongroup1 AS optiongroup WITH ; > ButtonCount = 2, ; > Value = 2, ; > Height = 46, ; > Left = 24, ; > Top = 72, ; > Width = 132, ; > Name = "Optiongroup1", ; > Option1.Caption = "Option1", ; > Option1.Value = 0, ; > Option1.Height = 17, ; > Option1.Left = 5, ; > Option1.Top = 5, ; > Option1.Width = 61, ; > Option1.Name = "Option1", ; > Option2.Caption = "Option2", ; > Option2.Value = 1, ; > Option2.Height = 17, ; > Option2.Left = 5, ; > Option2.Top = 24, ; > Option2.Width = 61, ; > Option2.Name = "Option2" > > > PROCEDURE Init > create cursor test (f1 i, f2 c(10)) > insert into test values (1, "Hello") > insert into test values (1, "World") > insert into test values (2, "How") > insert into test values (2, "are") > insert into test values (2, "you?") > ENDPROC > > > PROCEDURE combo1.DropDown > this.RowSourceType = 0 > this.Clear() > this.RowSourceType = 3 > this.RowSource = ; > "select * from test where f1=" + ; > transform(thisform.optiongroup1.Value) + ; > " into cursor cxxx" > this.Requery() > ENDPROC > > >ENDDEFINE >* >*-- EndDefine: form1 >************************************************** >This is a example with Requery:
PUBLIC oform1,Choice Choice=0 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT optiongroup1 AS optiongroup WITH ; ControlSource = "m.Choice",; ButtonCount = 2, ; Value = 2, ; Height = 46, ; Left = 24, ; Top = 72, ; Width = 132, ; Name = "Optiongroup1", ; Option1.Caption = "Option1", ; Option1.Value = 0, ; Option1.Height = 17, ; Option1.Left = 5, ; Option1.Top = 5, ; Option1.Width = 61, ; Option1.Name = "Option1", ; Option2.Caption = "Option2", ; Option2.Value = 1, ; Option2.Height = 17, ; Option2.Left = 5, ; Option2.Top = 24, ; Option2.Width = 61, ; Option2.Name = "Option2" ADD OBJECT combo1 AS combobox WITH ; ColumnCount = 2, ; ColumnWidths = "100,200", ; Height = 24, ; Left = 192, ; Top = 72, ; Width = 100, ; Name = "Combo1",; Choice = 0,; RowSourceType = 3 ,; RowSource = "select * from test where f1= m.Choice into cursor cxxx" PROCEDURE Init create cursor test (f1 i, f2 c(10)) insert into test values (1, "Hello") insert into test values (1, "World") insert into test values (2, "How") insert into test values (2, "are") insert into test values (2, "you?") ENDPROC PROCEDURE combo1.Gotfocus this.Requery() ENDPROC ENDDEFINE