Re: VFP9SP2 order of objects issue

2012-11-08 Thread MB Software Solutions, LLC

On 11/8/2012 4:32 PM, Richard Kaye wrote:

I've manipulated zorder when adding objects to a form at runtime. Depending on the order 
of instantiation, things can get a little tricky when adding containers to containers. 
IIRC tab order controls instantiation order which is why even though your labels aren't 
necessarily something the user "TABs" through, you should be able to make sure 
that your dependency between controls by manipulating that.


As you could guess, this was a kludgey form.  lol


--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16

___
Post Messages to: ProFox@leafe.com
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/509c2d0a.4000...@mbsoftwaresolutions.com
** 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.


RE: VFP9SP2 order of objects issue

2012-11-08 Thread Tracy Pearson
Rafael Copquin wrote on 2012-11-08: 
>> I do not expect any object on the form to exist until the form gets to
its
>> INIT method.
>> 
>  According to the order in which events fire, all contained objects
>  instantiate (ie exist) _before_ the form init.
>  

Rafael,

Let me clarify. My code does not expect another object to exist on the form
until the INIT of the form fires.

Tracy Pearson
PowerChurch Software


___
Post Messages to: ProFox@leafe.com
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/000901cdbdfa$bade0ac0$309a2040$@powerchurch.com
** 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.


Re: VFP9SP2 order of objects issue

2012-11-08 Thread Rafael Copquin

I do not expect any object on the form to exist until the form gets to its
INIT method.


According to the order in which events fire, all contained objects 
instantiate (ie exist) _before_ the form init.


You can test this by placing code like this in the init methods of the 
DE, the form and all contained objects:


DEBUGOUT "label1 init"

DEBUGOUT "form init"

etc

You can also put that code in the load,destroy and unload events of the 
form, the valid, keypress,lostfocus, etc of all contained objects.
Just create a test form and put the debugout keyword with a text 
indicating what event is firing and run the form.
The debug window will open and you will see in writing how each event is 
firing.
You will notice that all contained objects init events fire before the 
form's init


BTW, I use a form like this every time things do not happen the way my 
logic says they should and oftentimes I am proven wrong.


Rafael Copquin



El 08/11/2012 05:52 p.m., Tracy Pearson escribió:

MB Software Solutions, LLC wrote on 2012-11-08:

  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,

If your labels are on the form, not in containers you could use the SETALL()
method of the form to call a method in the label. This was VFP 6 days for
me.

If you have containers, this is a good use of BINDEVENTS.
To use BINDEVENTS you need to have 2 methods on the label class.
 FormInitEvent
 FormInitMethod

 Procedure FormInitEvent
THIS.FormInitMethod()
 EndProc

 Procedure FormInitMethod
 ** Your code goes here
 EndProc

 Procedure Init
 BINDEVENT(THISFORM, "INIT", THIS, "FORMINITEVENT")
 EndProc

If you call the method directly, anticipate strange behavior.
Once in the FormInitMethod procedure you can access objects outside of the
label. Inside the FormInitEvent, it is hit or miss. In my experience, it is
usually a miss in the runtime.

I do not expect any object on the form to exist until the form gets to its
INIT method.

Tracy Pearson
PowerChurch Software



[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
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/509c25bb.5010...@fibertel.com.ar
** 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.


RE: VFP9SP2 order of objects issue

2012-11-08 Thread Richard Kaye
I've manipulated zorder when adding objects to a form at runtime. Depending on 
the order of instantiation, things can get a little tricky when adding 
containers to containers. IIRC tab order controls instantiation order which is 
why even though your labels aren't necessarily something the user "TABs" 
through, you should be able to make sure that your dependency between controls 
by manipulating that.

--
rk

-Original Message-
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of MB Software 
Solutions, LLC
Sent: Thursday, November 08, 2012 3:36 PM
To: profoxt...@leafe.com
Subject: Re: VFP9SP2 order of objects issue

On 11/8/2012 3:02 PM, Richard Kaye wrote:
> Isn't that something you can control to a certain extent by setting tab order 
> or zorder?

That's what I thought.  Although I've never coded in the ZOrder method.


___
Post Messages to: ProFox@leafe.com
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/DF1EEF11E586A64FB54A97F22A8BD0442178305DDB@ACKBWDDQH1.artfact.local
** 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.


RE: VFP9SP2 order of objects issue

2012-11-08 Thread Kurt Wendt
I also thought that Tab Order should resolve your problem - I find it
strange that it doesn't. I've also dabbled with ZOrder before, if I
remember - getting a Container to appear On Top and then Back Under -
during runtime...

-K-

-Original Message-
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of MB
Software Solutions, LLC
Sent: Thursday, November 08, 2012 3:36 PM
To: profoxt...@leafe.com
Subject: Re: VFP9SP2 order of objects issue

On 11/8/2012 3:02 PM, Richard Kaye wrote:
> Isn't that something you can control to a certain extent by setting
tab order or zorder?

That's what I thought.  Although I've never coded in the ZOrder method.


-- 
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: ProFox@leafe.com
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/289ea162f5642645b5cf64d624c66a140e260...@us-ny-mail-002.waitex.net
** 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.


RE: VFP9SP2 order of objects issue

2012-11-08 Thread Tracy Pearson
MB Software Solutions, LLC wrote on 2012-11-08: 
>  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,

If your labels are on the form, not in containers you could use the SETALL()
method of the form to call a method in the label. This was VFP 6 days for
me.

If you have containers, this is a good use of BINDEVENTS.
To use BINDEVENTS you need to have 2 methods on the label class.
FormInitEvent
FormInitMethod

Procedure FormInitEvent
   THIS.FormInitMethod()
EndProc

Procedure FormInitMethod
** Your code goes here
EndProc

Procedure Init
BINDEVENT(THISFORM, "INIT", THIS, "FORMINITEVENT")
EndProc

If you call the method directly, anticipate strange behavior.
Once in the FormInitMethod procedure you can access objects outside of the
label. Inside the FormInitEvent, it is hit or miss. In my experience, it is
usually a miss in the runtime.

I do not expect any object on the form to exist until the form gets to its
INIT method.

Tracy Pearson
PowerChurch Software


___
Post Messages to: ProFox@leafe.com
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/000801cdbdf2$e83d9e20$b8b8da60$@powerchurch.com
** 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.


Re: VFP9SP2 order of objects issue

2012-11-08 Thread MB Software Solutions, LLC

On 11/8/2012 3:02 PM, Richard Kaye wrote:

Isn't that something you can control to a certain extent by setting tab order 
or zorder?


That's what I thought.  Although I've never coded in the ZOrder method.


--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16

___
Post Messages to: ProFox@leafe.com
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/509c17bd.3090...@mbsoftwaresolutions.com
** 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.


RE: VFP9SP2 order of objects issue

2012-11-08 Thread Richard Kaye
Isn't that something you can control to a certain extent by setting tab order 
or zorder?

--
rk

-Original Message-
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of MB Software 
Solutions, LLC
Sent: Thursday, November 08, 2012 1:53 PM
To: profoxt...@leafe.com
Subject: VFP9SP2 order of objects issue

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


___
Post Messages to: ProFox@leafe.com
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/DF1EEF11E586A64FB54A97F22A8BD0442178305D90@ACKBWDDQH1.artfact.local
** 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.


Re: VFP9SP2 order of objects issue

2012-11-08 Thread Rafael Copquin

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: ProFox@leafe.com
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/509c0833.7020...@fibertel.com.ar
** 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.


Re: VFP9SP2 order of objects issue

2012-11-08 Thread Alan Bourke
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: ProFox@leafe.com
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/1352401308.31375.140661151224245.5a700...@webmail.messagingengine.com
** 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.