Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bindevents and classes
Message
From
09/11/2007 14:27:06
 
 
To
09/11/2007 14:07:33
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Database:
MS SQL Server
Miscellaneous
Thread ID:
01267991
Message ID:
01268087
Views:
17
>>>>Hi All,
>>>>
>>>>I am trying something new < g >, Bindevents().
>>>>
>>>>I need to run a different init of class object then the normal one. The main problem I see, is that this code that I am replaces has a lot of THIS and THISFORM.object in it. I still need most of those things done.
>>>>
>>>>Will this be a problem?
>>>>
>>>>The code is for a combobox init and looks like this:
>>>>
>>>>LOCAL i
>>>>PUBLIC aWizFList
>>>>DIMENSION aWizFList[1]
>>>>=AFIELDS(aWizFList)
>>>>FOR m.i = FCOUNT() TO 1 STEP -1
>>>>  IF INLIST(aWizFList[m.i,2],"G","M","U")	&&Memo field
>>>>    =ADEL(aWizFList,m.i)
>>>>    DIMENSION aWizFList[MAX(1,ALEN(aWizFList,1)-1), ALEN(aWizFList, 2)]
>>>>  ENDIF
>>>>ENDFOR
>>>>THIS.RowSourceType = 5
>>>>THIS.RowSource = "aWizFList"
>>>>THIS.VALUE = THIS.LIST[1]
>>>>
>>>>
>>>>can this be done?
>>>
>>>Not quite sure why would you need to bindevent an .init() for this. There are several ways to do this:
>>>
>>>- you can subclass your combo class and have your new init in the subclass
>>>
>>>- this code may better go into .requery() - and you don't even need the code to be a part of the combo, it could be elsewhere; you pass the combo as a parameter to it, and instead of "this." use the parameter.
>>>
>>>And, while we're at it, the array shouldn't be public, it should be a property of the combo itself. The .rowsource="this.aWizFlist" then.
>>
>>Hi Dragan,
>>
>>this is a wizard class. And we are not allowed to change the code. But Microsoft, when doing the wizards, did not take CA into account when they were set up, and pcount() returns the wrong number for the cursor. I need to have it do a afields() and use that count for the loop count. Since this code is buried in the searchform, searchobject, I thought maybe I could do a bindevent to get around this problem.
>>
>>But I cannot change the wizard class at all. And subclass will not work, because that is changing the class.
>
>Then just have this somewhere in your form (or wherever you intended to have bindevent() done), and just override the .init of the combo in it - that's not subclassing, that's your instance. Or, alternately, have a method in your form to which you'll pass a reference to the combo as a parameter (and yes you can add an array property to it programmatically and redimension it as you please).
>
>So even if you aren't allowed to subclass (though that sounds too restrictive to me), there's still a lot you can do to an instance of a class - and all that you want to do here can be done that way.

The problem is not that simple, I did that already for one area, just overrode the inherited code by putting code in the object on the form. But with this one, it is more complex. I think I have not explain it enough, so, here goes:

My form as a button which calls another form from a class by way of createobject(), within this class form, there is another class that is used for an object on that form. This lowest class has my problem code in the init of it.

Going back over your answer, I am not sure what you are saying. And not sure how to ask an intelligent question about it. I have the name/reference of the form that is created with the createobject(), but can I get down to the object I need, before its init is fired?

Thanks for the info.
Beth
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform