Ellaborating on Alan's code, I imagine something like this:
Init event of all labels:
this.addproperty(´lInstantiated')
In the TOP labels:
this.lInstantiated = .t.
In the BOTTOM labels
this.lInstatiated = .f.
if this.lInstantiated
dodefault()
** here goes your special code
else
nodefault
endif
If the property is false, the label would not instantiate, because of
the NODEFAULT clause
In the case of the TOP labels, lInstantiate would be true, therefore the
dodefault() code would run and they should instantiate first.
After all of them instantiate, you can set the lInstantiated property to
.t. in all labels
for i = 1 to thisform.controlcount
if lower(thisform.controls(i).class) = 'label'
thisform.controls(i).lInstantiated = .t.
endif
endfor
thisform.refresh
If my thinking is correct, the TOP labels would instantiate first, and
then would instantiate the rest of them.
But I never did something like this, so I might be wrong ( I really
never fooled around with nodefault)
BTW, why would you play with labels values like that, I'm curious? Could
you not set the value of your properties in any other way?
Rafael Copquin
El 08/11/2012 04:01 p.m., Alan Bourke escribió:
I'd say you might be better examining the whole approach. That strikes
me as being a particularly delicate house of cards that could get upset
continually.
Maybe have a RefreshMe() method on each label, and a
MyForm.RefreshLabels() which iterates through all label-type objects and
does RefreshMe(), and call MyForm.RefreshLabels() in the Form class
Init():
Local llOk
llOk=DoDefault() && -- Run form init, which will init all labels
in whatever order.
If llOk
* -- Iterate through all label objects and call RefreshMe() on
each. We can guarantee at this point that they are ll inited.
Endif
Return llOk
On Thu, Nov 8, 2012, at 06:52 PM, MB Software Solutions, LLC wrote:
I've got a form where some labels should appear in the TOP of the object
hierarchy and hence instantiate before some other objects that depend on
them to have a custom property. Without the proper order, some other
objects encounter an error because the Init of those labels didn't yet
happen to create a custom property on them.
Is this something I have to hack the SCX to achieve? I tried deleting
and re-adding the objects but that didn't help. I'm guessing it has
something to do with the timestamp in the SCX?
tia,
--Mike
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.