>PUBLIC oform1,Choice > >Choice=0 > >oform1=NEWOBJECT("form1") >oform1.Show >RETURN > >DEFINE CLASS form1 AS toolbar > > > 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 >A VFP's Toolbar is the genesis of the bugs,
PUBLIC oform1,Choice Choice=1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS toolbar Caption = "TOOLBAR" DATASESSION = 2 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 ADD OBJECT combo1 AS combobox WITH ; ColumnCount = 2, ; ColumnWidths = "100,200", ; Left = 192, ; Top = 72,; RowSourceType = 3 PROCEDURE combo1.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?") this.RowSource = "select * from test where f1= m.Choice into cursor cxxx" ENDPROC PROCEDURE combo1.MouseDown LPARAMETERS nButton, nShift, nXCoord, nYCoord this.Requery ENDPROC PROCEDURE combo1.keyPress LPARAMETERS nKeyCode, nShiftAltCtrl * IF KEY OPEN LIST this.Requery * ENDIF ENDPROC ENDDEFINEFabio