Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid event order
Message
From
16/05/2019 16:05:42
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
16/05/2019 14:58:20
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01668663
Message ID:
01668666
Views:
69
>I ran into something weird this morning. I'm pretty sure I know how to work around it, but curious whether anyone else has noticed and if there's a way to prevent it.
>
>I have a grid class that's using MemberClass to specify a custom Column class (colBase). The custom Column class, in turn, has a custom Header class. In the relevant form, I've replaced the default textboxes with a custom textbox class. I added some code to the column's class Init that uses a custom property of the column, but when it runs, it doesn't see the value (assigned in the PropSheet) of that property.
>
>I noticed in the debugger that when running the Init code for the columns, it wasn't referring to the columns by their assigned names, but as colBase1, etc. So I turned on Event Tracking and got this (I've removed some irrelevant bits):
>
>
>...
>42706.654, frmchooseproducts.Load()
>42706.674, frmchooseproducts.grdproducts.colbase1.Init()
>42706.684, frmchooseproducts.grdproducts.colbase2.Init()
>42706.694, frmchooseproducts.grdproducts.colbase3.Init()
>42706.704, frmchooseproducts.grdproducts.colbase4.Init()
>42706.704, frmchooseproducts.grdproducts.colbase5.Init()
>42706.714, frmchooseproducts.grdproducts.colbase6.Init()
>42706.714, frmchooseproducts.grdproducts.colbase7.Init()
>42706.724, frmchooseproducts.grdproducts.colbase8.Init()
>42706.736, frmchooseproducts.grdproducts.colbase9.Init()
>42706.782, frmchooseproducts.cmdclose.Init()
>...
>42706.793, frmchooseproducts.grdproducts.colstockno.header1.Init()
>42706.794, frmchooseproducts.grdproducts.colstockno.txtreadonly1.Init()
>42706.794, frmchooseproducts.grdproducts.colstkdesc1.header1.Init()
>42706.795, frmchooseproducts.grdproducts.colstkdesc1.txtreadonly1.Init()
>42706.796, frmchooseproducts.grdproducts.colstkdesc2.header1.Init()
>42706.797, frmchooseproducts.grdproducts.colstkdesc2.txtreadonly1.Init()
>...
>
>
>That is, the column Init is running before the Inits for the header and textbox in the column. I checked on a form with a default grid, and of course, it went from the inside out, so the header and textbox Inits ran before the column Init.
>
>Anybody explored this deeply and have any understanding to share? As I said, I'm pretty sure I know how to work around in a generic way, but it's quite a shock.

Ditto for pageframes with member classes, but didn't have much experience with those. With grids, the init()s that members run are not the inits of their instances, they are those of their classes, and the PEMs set for the instance are seen as their default values as defined at the class level. Now whether the local inits and PEMs will eventually run is beyond what I've checked - I only had to work around few such issues from time to time and my solution was to use some builder I wrote years ago to convert a grid into a columnless one and use the builder-generated code in its .init() to build the columns, headers etc. Then it all behaves.

My conclusion then was that member classes are a kludge, and the event firing sequence for the members is not what I'd expect. I'd rather build a regular grid, run my builder to get all in code, then in that code replace class names in each addObject() with what I want.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform