Solved

Fox Pro 9   Forms Order of Operations

Posted on 2009-06-29
8
439 Views
Last Modified: 2015-01-05
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

0
Comment
Question by:Malibucompany
  • 5
  • 2
8 Comments
 
LVL 27

Accepted Solution

by:
CaptainCyril earned 66 total points
ID: 24739853
I would put them in Refresh and call it on record change or bind it to other events that I need.
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 310 total points
ID: 24740128
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
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 310 total points
ID: 24740176
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
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 124 total points
ID: 24740871
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 310 total points
ID: 24742715
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
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 124 total points
ID: 24743115
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
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 310 total points
ID: 24743222
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
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 310 total points
ID: 24743235
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

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Viewers will learn the different options available in the Backstage view in Excel 2013.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now