Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding an event to the value change of a combobox
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00894793
Message ID:
00895414
Vues:
17
Bill,

Perhaps you can post some code. This seems to be working for me as you expect it to work:
**************************************************
*-- Class Library:  c:\vfp8app\misc\bill1.vcx
**************************************************

**************************************************
*-- Class:        cbox (c:\vfp8app\misc\bill1.vcx)
*-- ParentClass:  combobox
*-- BaseClass:    combobox
*-- Time Stamp:   04/15/04 08:58:02 PM
*
DEFINE CLASS cbox AS combobox

	Height = 24
	Style = 2
	Width = 100
	Name = "cbox"

	PROCEDURE onchange
		debugout program()
	ENDPROC

	PROCEDURE InteractiveChange
		dodefault()

		this.OnChange()
	ENDPROC

	PROCEDURE ProgrammaticChange
		dodefault()

		this.OnChange()
	ENDPROC

ENDDEFINE
**************************************************
I dropped an instance on a form with this code:
PUBLIC oform1

SET CLASSLIB TO c:\vfp8app\misc\bill1.vcx ADDITIVE

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


	**************************************************
*-- Form:         form1 (c:\vfp8app\misc\cbo1.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   04/15/04 09:01:04 PM
*
DEFINE CLASS form1 AS form

	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT cbox1 AS cbox WITH ;
		Left = 86, ;
		Top = 45, ;
		Name = "Cbox1"

	PROCEDURE Init
		activate window "debug output"

		with this.cbox1
		   for i = 1 to 10
		      .AddItem( "item " + transform( i ) )
		   endfor
		endwith
	ENDPROC

	PROCEDURE Click
		thisform.cbox1.Value = 2
	ENDPROC

ENDDEFINE
I ran the form, turned on event logging in the debugger, And as I select items in the cbo via click the drop button and select an item, or press the up/down arrow keys I see InteractiveChange fire and then the custom OnChange method. If I click the form the ProgramatticChange, OnChange fire off.


>I'm sure I'm missing somthing simple here, but in my base combo class I created an onchange method. Its style is set to list, and I went the rout of calling onchange from the programatic and interactive change events and it seemed to be ignored when I select a new value. I tried binding the new method to the value property of the combo box but that also doesn't seem to fire the event. What am I missing here. What I am trying to do is make the interface refresh and update its data as soon as the user selects a new value in the combo box but I don't want the user to have to move to a new control to fire the refresh.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform