Fox Pro 9 Forms Order of Operations

I am still a bit confused as to the over all flow of information through the forms and the order of operations used. I know the basic order is  Load(),Init(),Show(), and Activate.

Yet each tool also has an order that it seems to follow to

If I were to want a caption on a label to change based upon a certain field value in a given table that the form talks to,where would the following code go

if thisform.checkbox1.value=.f.
thisform.label1.caption="NO"
endif

And how would it update as records are being stepped through Using standard buttion groups-Top/bottom/previous Etc?



if thisform.checkbox1.value=.f.
thisform.label1.caption="NO"
endif

Open in new window

MalibucompanyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
I would put them in Refresh and call it on record change or bind it to other events that I need.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Olaf DoschkeSoftware DeveloperCommented:
For that aspect you should use an optiongroup with options "YES" and "NO" and bind to (iif(table.logicalfield,1,2)), which translates .T. to option 1 and .F. to option 2.

I would find it rather disturbing, if the caption beside a checkbox would turn from YES to NO when checked or unchecked. Don't you think it will make the user really unsure what to do with that checkbox? The normal semantic is, that checked a checkbox means what it captions says, unchecked it means NOT that. So an uncheckeed NO means YES and a checked YES means YES, then I'd expect this control to be useless ;)

Bye, Olaf.
0
Olaf DoschkeSoftware DeveloperCommented:
besides that, there is the InterActiveChange Event (and ProgrammaticChange) for that:

In fact this is redundant code for the two events and should ideally be put in yet another method that is called bot by interactive/programmticChange. But then it's only one line...

Bye, Olaf.
* both in interactivechange() and programmaticchange() of a checkbox control put
this.caption = iif(this.value,'YES','NO')

Open in new window

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

pcelbaCommented:
As Captain wrote, the form's refresh should update all controls on the form. If you move the record pointer then you have to call refresh method of the form and it does all the work for included controls. Controls on the form should not comunicate directly but each change must be propagated to other controls via certain form's method. Only form knows about contained controls. This will ensure relative independency of form controls.

In your example both checkbox and label seems to be data dependent, so they don't need to know each other but form knows about them and the form's refresh method should update both of them.

If you would like to update some label caption based on interactive change on some checkbox then the checkbox InteractiveChange method should call THISFORM.CheckBoxChanged() method and the form has to decide what to do and how to update the label caption if necessary (the label will probably be based on some class which is able to recieve some controlling messages from its parent).
0
Olaf DoschkeSoftware DeveloperCommented:
pcelba, a checkbox has a label/caption itself. I'd use that.

Otherwise your thought on a CheckBoxChanged method is okay, although I'd perhaps use Refresh to propagate all record changes or record pointer movements in a form, that's what it's for. If you want to minimize this kind of "messaging" between checkbox and label, as they are the only ones involved in this boolean field change, but then record pointer movement is not handled by a CheckBoxChanged() method.

Bye, Olaf.
0
pcelbaCommented:
My idea was to call CheckBoxChanged() method after its manual state change only. But together with messaging it was a little bit out of this topic...

The record change should refresh the whole form, of course.

And yes, I know the checkbox has its own caption, and hope Malibucompany knows it, also. I suppose the label is not as close to the checkbox as you mean :-).
0
Olaf DoschkeSoftware DeveloperCommented:
Well, "messaging". If you call a method due to a interactivechange, and that method then does forward this change somewhere else on the form, you could say that it is messaging. Not what you normally would call messaging, but it in fact already has many aspects of it, especially decoupling the manual change of the checkbox from the change of the label via a third party, which in this case is the form, not really messaging.

If you'd introduce a method for each control change, you'd end up with rather much method's tough. You can use the Refresh() method from the interactivechange of any control you know it's change implies a change elsewhere too and then let the refresh propagate to each control, which then in it's refresh() method can adapt to the new data, that is you could also do the label caption change in the label's refresh, and that then should read the boolean field value from the alias bound to the checkbox, not from the checkbox.value, if it's really the case, that the label is not the one within the checkbox.

Bye, Olaf.
0
Olaf DoschkeSoftware DeveloperCommented:
pcelba, you'r eright from the outset, Malibucompany talks of thisform.checkbox1 and thisform.label1, but I assumed Malibucompany didn't realized a checkbox has it's own label and there's no need to use a seerate label control.

Even if, the refresh mechanism would work this way:
in checkbox.interactivechange() do thisform.refresh()
this cascades refresh() to every control on the form, so also lable.refresh() will run
in label.refresh() do this.caption = iif(alias.field,'YES','NO')

Bye, Olaf.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.