Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox problem
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00156692
Message ID:
00158998
Views:
37
Colin,

I get the same sequence of events either way. It also clears the Value of the cbo when I use the up/down arrow in the cbo, it doesn't when I tab. Altering the Style of the cbo doesn't seem to be such a good idea. The subclass won't ever display the selected value chosen from the dropped list.

It's rather revealing to see mycombo.text1, it looks like VFP is internally building the cbo from a button and a textbox. And the nShiftAltCtrl value of 8 doesn't make sense according the the help file.

You may have to just stop messing around with Style and set a flag to know how to handle the up/down arrow keys.

>I encountered an odd problem with this solution. If I put this code directly into the combobox on the form it works fine. If I put this code into a combobox class used on a form the UPARROW works fine but the DNARROW blanks out the value. I turned on event tracking for both and discovered the following:
>
>**code directly into the combobox on the 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 into a combobox class used on a 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()
>
>
>I'm at a loss for the extra 3 events. Any thoughts? TIA
>
>>Colin,
>>
>>Clever solution.
>>
>>>I finally came up with a solution that is actually pretty simple and thought I'd pass it along.
>>>
>>>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
>>>
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform