Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GPF: User defined combo box class in grid
Message
From
16/11/2001 09:48:05
 
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00582300
Message ID:
00582687
Views:
51
I went to the Bug Report page http://support.microsoft.com/Support/vfoxpro/report/report.asp and don't see an option to upload examples...

Any other way to approach VFP team?

Hard at work on app right now, so this will be low order priority.

>BTW, you can send this example of crash to MS VFP team as a product feedback for VFP. Such kind of crashes (like assigning of value to DisplayValue property) are subject for fixed in the next versions of VFP. Though I glad it works for you.
>
>>Wow! I am humbled and grateful for your help. That works, and is very much appreciated.
>>
>>Thank you.
>>
>>Andrew
>>>Hi!
>>>
>>>The crash was in following line in the class quikcbo.Init method:
>>>.DisplayValue = luValue
>>>
>>>Really, it is very dangerous. This is because when you load a form, and combobox is refreshed by a value that is not in the list to display it correctly (you do it just by adding it to the list of values and the refreshing combobox above way), field value is also changes that mark record as changed. This can cause confusing for user - user changed nothing, but when form is closed, it detects that something changed and ask user to save changes. So I removed 2 lines of code:
>>>.DisplayValue = luValue
>>>.Value = luValue
>>>
>>>And instead added following line:
>>>.ControlSource=.ControlSource
>>>after a call to requery method of the combobox. This also does refresh of the value.
>>>
>>>BTW, it is also recommended to refresh value of combobox after requery, not before. This is becuase list could nto contain the value at all ;)
>>>
>>>So the changes you need the one described above, then change the Valid event and Refresh event of class by following way:
>>>1. In the Valid event call Refresh() with parameter .T., in other words:
>>>llRetVal = This.Refresh(.T.)
>>>
>>>2.In the Refresh event add
>>>lparameters llCalledFromValid
>>>
>>>3. Then in the Refresh event change
>>>.DisplayValue = luValue
>>>.Value = luValue
>>>
>>>to following:
>>>
>>>if llCalledFromValid
>>>	.Value = m.lcOldValue
>>>else
>>>	if .parent.BaseClass=="Column"
>>>		.parent.ControlSource=.parent.ControlSource
>>>	else
>>>		.ControlSource=.ControlSource
>>>	endif
>>>endif
>>>
>>>
>>>Above way will assure no changes made to the alias when user did not changed anything, as well as concistent working.
>>>BTW, notice that DisplayValue is not required to be assigned - just Value is enough.
>>>The parameter to Refresh is used to distinguish a case when we really need to assign to Value (and change the field value this way) - after typing in the new value that is not in combobox list.
>>>
>>>HTH.
>>>
>>>P.S.The reason why it crashed could be simple. Init of the combobox runs before Init of the form. As a result, some internal refreshing might occur when you change the DisplayValue property. Because form is not displayed yet, this causes the crash.
>>>
>>>
>>>
>>>
>>>>Thanks for your interest, Vlad.
>>>>
>>>>I have forwarded my example to you via e-mail attachment, as I don't yet know how to attach via this forum.
>>>>
>>>>Andrew
>>>>
>>>>>Hi!
>>>>>
>>>>>I would like to look at it. Used comboboxes several times inside of the grid, and never got a GPF just because combobox. It is interesting for me. There could be also another reason. Lets see if it could be fixed/workarounded.
>>>>>
>>>>>>I have tried this in both VFP 6.0 and 7.0 and get the same result.
>>>>>>
>>>>>>I have a ComboBox class (extended from work found here on the Thread) that mimics QuickBooks interface elements. The class finally works just the way I want it to, except for one glaring problem.
>>>>>>
>>>>>>If I have the control on the form it works A-OK. If I put the control inside the grid as a column active control oject, I get a GPF when I run the form.
>>>>>>
>>>>>>I have spent a fair amount of time trying to understand/fix this problem, but do not know what else to try, so I turn to the Thread.
>>>>>>
>>>>>>Is there a channel whereby I can approach MS with this? If there is anybody here that would like to take a look at it, I have made a small demonstration form that I can submit.
>>>>>>
>>>>>>Thanks in advance,
>>>>>>
>>>>>>Andrew Jennings
On a CLEAR day you can see forever.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform