Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code works in object on form but not as class
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Code works in object on form but not as class
Miscellaneous
Thread ID:
00158755
Message ID:
00158755
Views:
71
I came up with the following code for a combobox to allow UPARROW and DNARROW to exit the control instead of scrolling the choices when set to .Style=2. The code works fine if put in a combobox used on a form. I then created a combobox class with this code and when used in a form the UPARROW works fine but the DNARROW blanks out the .Value before moving. The code is as follows:
In the Combobox.KeyPress I put the following
IF nKeyCode=5 OR nKeyCode=24     &&UPARROW or DNARROW
	This.Style=0                                 &&Set Style to Dropdown Combo
	DODEFAULT()
ENDIF

In the Combobox.Valid I put
This.Style=2           &&Set Style to Dropdown List
I did a Trace Events and discovered the following:
**Code directly in combobox on form
myform.KeyPress(24,0)
myform.mycombo.KeyPress(24,0)
myform.mycombo.text1.KeyPress(24,0)
myform.Paint()
myform.KeyPress(24,0)
myform.mycombo.Valid()
myform.mycombo..text1.Destroy()
myform.mycombo.LostFocus()

**Code in class/ class used on form
myform.KeyPress(24,0)
myform.mycombo.KeyPress(24,0)
<strong>myform.mycombo.text1.KeyPress(0,8)
myform.Paint()
myform.mycombo.InteractiveChange()</strong>
myform.mycombo.text1.KeyPress(24,0)
myform.Paint()
myform.KeyPress(24,0)
myform.mycombo.Valid()
myform.mycombo..text1.Destroy()
myform.mycombo.LostFocus()
3 extra events, shown in bold, are occurring when used as a class. I know these are the cause of the problem but I have no idea why they are occurring. Any help greatly appreciated, I'm going bald pulling my hair out over this one. TIA
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Next
Reply
Map
View

Click here to load this message in the networking platform