Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fox Pro 9   Forms Order of Operations

Posted on 2009-06-29
8
Medium Priority
?
460 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 264 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 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1240 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 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1240 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Assisted Solution

by:pcelba
pcelba earned 496 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
 
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1240 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 43

Assisted Solution

by:pcelba
pcelba earned 496 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 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1240 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 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1240 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

782 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