Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) Unbound Field & On Form Change (Read 3135 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Unbound Field & On Form Change
Reply #15 - Dec 31st, 2005 at 5:33am
Print Post Print Post  
Carl -

I appreciate the "suggestion"; however, I have never used the @message function because it is barely visible and somehow, no matter how important it may be, I never think to look there.  Now, if a certain designer would like to give us the option of placing a "message" OVER an LE - limiting the size of the message to the size of the LE - THAT would be a WONDERFUL enhancement for version 2.0.   lol

My date of birth and date of anniversary are on a separate (called Special Events) tab, along with the age and years.  The age/years is only important to me if the Special Events tab is in view.  Perhaps there is a way for me to program something that will work for me based on that condition.

For me, the main issue is still (as you said) that I don't want the on form change programming to be triggered based simply on the recalculation of my age and/or years LE's.

Erika -

I understand the examples you gave about wanting to execute programming based on a change in an unbound element; however, in each of the specific examples you gave, I believe that I would find it easy enough to simply have the programming execute based on element exit.  Even if the statement had to go in more than one field, that is not like having to insert programming for 77 fields.

As for your stat gflag suggestion, assuming it works for what I need, and it looks like it will, I would still have to deal with it in my age/years LE's but more importantly, in every single command button on the form (and perhaps other instances that just don't come to mind right now) and for every command button I add to the form.  Once again, that seems like a lot of extra work to me.  Nevertheless, it may not be as bad as I think and I'll certainly give it a shot.

I cannot help but feel that there has to be a better solution.  Just as the distinction has been made whether or not to give the "warning" notice when the only change is in an unbound LE, so too do I think there's a way to provide for what I want and still be allowing the individual user to make individual choices based on their individual needs - but to make doing so easier.

I mentioned earlier a "switch."  Suppose for example I could use an @LE function (not a switch but this would work too ... in switch form - I would simply follow my programming with someting like /LEB or /LEU):

@LE(Bound,Last Updated = @date )
@LE(Unbound,Last Updated = @date)

giving me a choice of whether the on-form-change programming executes only when a bound le is changed or only when an unbound le is changed.  If neither is specified - meaning I just dont use the @LE portion of the programming, then the default would be the current state of considering both bound and unbound LE's as triggering a form change.

and perhaps another option of
@LEIGNORE(Birthdate;Anniversary)

where I can chose all but the specified fields to trigger the programming.

These suggestions would not take anything away from people  who are happy now with the way things are; They would not have to learn anything new nor would they have to do anything different than what they are currently doing.  For them, everything would be just as good as it now is.

But for the customer (me and maybe even one other person - lol) who is not happy, I (or we) would have an easy-to-use, viable, means of "grabbing control."

Once again, I am looking to have the best of both worlds; flexibility (as we both agree) for the user to have control when wanted BUT coupled with ease of use in implementing that control.

25 MORE DAYS!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Unbound Field & On Form Change
Reply #16 - Dec 31st, 2005 at 2:29pm
Print Post Print Post  
You also have another option. Instead of using a text box for Age and setting its value, use a static text element instead and set its label. The behavior will look identical to you, but I don't think that this will trigger On Form Change.


Quote:
As for your stat gflag suggestion, assuming it works for what I need, and it looks like it will, I would still have to deal with it in my age/years LE's but more importantly, in every single command button on the form (and perhaps other instances that just don't come to mind right now) and for every command button I add to the form.  Once again, that seems like a lot of extra work to me.  Nevertheless, it may not be as bad as I think and I'll certainly give it a shot.


Only if every command button on your Form changes an unbound element that you do not want to count as an update. Clicking a command button does not change a value unless there is programming that does so in its On Element Entry event.

I think you may be confusing the event itself with the programming it triggers.

In your case, you have On Form Entry programming that sets an unbound element called Age. You also have On Form Change programming that sets LastUpdate whenever any value changes (because that's what On Form Change does). Here's the sequence:

1. You arrive on a record. This triggers the On Form Entry event.
2. You have programming in this event that changes the value in Age.
3. Because a value changed, the On Form Change event is triggered.
4. The programming in your On Form Change event runs, setting LastUpdate.

Now, let's look at an example of clicking a command button that uses @SelectTreeItem to print a Report.

1. You click the command button. This triggers the On Element Entry event.
2. You have programming in this event that prints out a report. The report prints.

That's it. Nothing else happens. LastUpdate does not get updated because no value, unbound or otherwise, has changed.

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Unbound Field & On Form Change
Reply #17 - Dec 31st, 2005 at 4:57pm
Print Post Print Post  
Erika -

I appreciate your efforts to help me understand this and to come up with a viable solution.  Unfortunately, I am still at a loss (except that I have not yet tried the gflag approach and hope to.  Even if that doesn't make me happy in this particular case I can see that it has inherent value that I might want to use for another purpose).

With regard to command buttons, they do seem to trigger a "form change" unless - again - I am missing something and, unfortunately, I don't have a clue what that might be.

I just went to a record that does not contain a date of birth and therefore the age calucation programming did not occur.

But the instant I clicked on the command button, the Last Update field changed.  (Please remember that if I don't click on a button - and there is no date of birth, the last update field is not updated). 

Here is the code on the particular command button I pressed.  I do not see that it is affecting any bound (or unbound for that matter) field.

Code
Select All
ar Z as int

if not @update then
{
z = @asynchshell("C:\Sesame\Data\Sounds\Cannot Use Here.wav")
STOP
}
else
if status = "deceased"
{
z = @asynchshell("C:\Sesame\Data\Sounds\Deceased.wav")
STOP
}
else
if record type = "companion"
and @isblank(Mail Name)
then
{
z = @asynchshell("C:\Sesame\Data\Sounds\Companion.wav")
throwfocus(Alt Record)
STOP
}
else
if @isblank(Mail Name)
and not record type = "companion"
then
{
z = @asynchshell("C:\Sesame\Data\Sounds\Mail Name.wav")
throwfocus(Mail Name)
STOP
}
else
if
@isblank (Address1)
or @isblank (city)
or @isblank (state)
or @isblank (zip)
then
{
z = @asynchshell("C:\Sesame\Data\Sounds\Address Incomplete.wav")
STOP
}
else
AlternateDefaultPrinter("Auto HP LaserJet 5 - Envelopes")
Newpage(950,412)
PrintString("Spencer Wulwick (MVR)", 30, 25, 0, "Arial", 14, 0)
PrintString("210 South Hale Avenue", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Tampa, FL 33609-3933", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Address1 + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)
FinishPage()
RestoreDefaultPrinter()
 



Your suggestion to try a static text box and change the label sounds like it mght be the perfect solution, assuming that, indeed, it does not trigger an on form change event.  I searched through he program guide and do not have a clue what function I would use to accomplish the programming.  Could you point me in the right direction, please.

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Unbound Field & On Form Change
Reply #18 - Dec 31st, 2005 at 6:53pm
Print Post Print Post  
Spencer,

With all the ThrowFocus calls, I can't see all the code that is actually running, so I would have to have your app to say for sure if and why a change is running.

Oh, and STOP USING STOP!!!!!!!!  Smiley

As to the Static Text, I think the call you want is @Label. I don't have a Programming Guide here.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Unbound Field & On Form Change
Reply #19 - Dec 31st, 2005 at 7:06pm
Print Post Print Post  
Erika -

I forgot about the "throw focus."  Most of the "conditions" simply play a sound file (instead of providing a message box with the accompanying obnoxious sound).

I have been told many times to STOP using STOP; however, it works perfectly in this instance and I simply haven't had the time to figure out the alternative way to do this.  (Perhaps on January 26th, I'll get some fresh ideas).   Grin

@label returns the label text of the layout element, so I don't think that's the one I want.  That led me; however, to
Label(element,m) which allows me to "Assigns label m to layout element. Adds a label if none exists." and that sounds like precisely what I need.

I am very eager to try it but first I MUST work on my new Palm Pilot which I received as a gift, after having kinda wanted one for over 20 years or so.  Soon as I get it working with my address book uploaded, I am going to try this.

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Unbound Field & On Form Change
Reply #20 - Jan 2nd, 2006 at 4:35pm
Print Post Print Post  
Erika -

BRAVO!!!!

You finally figured out a way to "shut me up" on this issue.   lol

The  Label(element,m)  function, does the trick and works like a charm.  (And you were probably right about the command buttons not triggering an on-form-change event, because I just tested it with my new code and it did not affect the last updated field. There must have been something else going on that I was unaware of).

And, I'm excited about a "bonus option" I've just been provided.  I see no reason now, why I can't set up my OWN "Message Box" and use it (when the line at the bottom doesn't do the trick) also without triggering an on-form-change event to occur.  So now I can have a message appear wherever I want without it being "lost" on the bottom of the form ... and without using the msgbox which makes that "gosh-awful" sound and which requires a click to get rid of it.

In case anyone is interested, here's the on-form-entry code (which does NOT affect my on-form-change event to be triggered) that I came up with to accomplish precisely what I wanted.  

Remember that "STage" is nothing more than a static label (actually a static text box with nothing in it, initially).

Code
Select All
var success as string
If not @isblank(Birthdate) then
success = @YEAR(@DATE)-@YEAR(BirthDate) - ((@MONTH(@DATE) < @MONTH(BirthDate))
   or (@MONTH(@DATE) = @MONTH(BirthDate) AND @DOM(@DATE) < @DOM(BirthDate)))
Label(STage,success)
ForceRedraw()
 



Once again, thanks so much for "hanging in there" with me.
« Last Edit: Jan 3rd, 2006 at 8:03pm by SpencerWulwick »  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Unbound Field & On Form Change
Reply #21 - Jan 3rd, 2006 at 3:04pm
Print Post Print Post  
Quote:
I have been told many times to STOP using STOP; however, it works perfectly in this instance and I simply haven't had the time to figure out the alternative way to do this.  (Perhaps on January 26th, I'll get some fresh ideas).   Grin


Stop only appears to work perfectly in this instance but I can guarantee you that it is not working perfectly. Calling Stop is like driving your car into a wall doing 100 mph. You will stop and it will not be pretty. The alternative in this case is a pair of braces {} on your last else statement. The reason you were using STOP is because your code was written incorrectly and the last Else statement was only controlling the call to AlternateDefaultPrinter().

Code
Select All
Var Z as int

if not @update then
{
	z = @asynchshell("C:\Sesame\Data\Sounds\Cannot Use Here.wav")
}
else if status = "deceased"
{
	z = @asynchshell("C:\Sesame\Data\Sounds\Deceased.wav")
}
else if record type = "companion" and @isblank(Mail Name) then
{
	z = @asynchshell("C:\Sesame\Data\Sounds\Companion.wav")
	throwfocus(Alt Record)
}
else if @isblank(Mail Name) and not record type = "companion" then
{
	z = @asynchshell("C:\Sesame\Data\Sounds\Mail Name.wav")
	throwfocus(Mail Name)
}
else if @isblank (Address1) or @isblank (city) or @isblank (state) or @isblank (zip) then
{
	z = @asynchshell("C:\Sesame\Data\Sounds\Address Incomplete.wav")
}
else
{
	AlternateDefaultPrinter("Auto HP LaserJet 5 - Envelopes")
	Newpage(950,412)
	PrintString("Spencer Wulwick (MVR)", 30, 25, 0, "Arial", 14, 0)
	PrintString("210 South Hale Avenue", 30, @PageExtentY(), 0, "Arial", 14, 0)
	PrintString("Tampa, FL 33609-3933", 30, @PageExtentY(), 0, "Arial", 14, 0)

	PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
	PrintString(Address1 + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
	PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)
	FinishPage()
	RestoreDefaultPrinter()
} 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Unbound Field & On Form Change
Reply #22 - Jan 3rd, 2006 at 3:20pm
Print Post Print Post  
Quote:
Stop only appears to work perfectly in this instance but I can guarantee you that it is not working perfectly. Calling Stop is like driving your car into a wall doing 100 mph. You will stop and it will not be pretty.
-Ray


I think that this may be something of an overstatement. Stop generally does work, but puts a needless strain on the programming environment and creates hard to read, hard to follow, hard to compile, and hard to fix code. There are no circumstances where stop cannot be replaced by a conditional. As such, it is always recommended that you do not use stop. Using a conditional will cause the code to run faster and better.

Stop is not so much "running headlong into a wall" as it is stopping the car by suddenly removing the running engine.

In general, try to write code that has one and only one entry point and one and only one exit point.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Unbound Field & On Form Change
Reply #23 - Jan 3rd, 2006 at 7:57pm
Print Post Print Post  
Hi -

Ray, thanks so much for taking time to provide the "correct" code for my command button.  

Mark, thanks for the explanation and, especially now that Ray has given me the code - and now that I have a better and realistic reason for not using "stop," I will get it "fixed" and avoid its use.

I would strongly urge you to put stronger language in the Programmer's Guide cautioning against the use.  I would even go so far as to state that this is only available if it MUST be used in converting Q&A applications and that it should NOT be used in newly developed Sesame applications.  If the programming guide gives me the instructions for using a specific "function" (I'm referring to "stop" in this instance) then I ought to be comfortable with using it.  It is disconcerting to follow the published guide and then be told - "this is bad."

I would hope that at some point, the references to Q&A could be eliminated completely. After all, Q&A has been "dead" (even though I realize that some people are still using it) for over 10 years now.  Sesame has been out for two. At some point, Q&A users, who will convert to Sesame will be non-existent and the manuals will be cleaner and clearer if they are limited to Sesame.

Thanks.

  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Foster
Ex Member


Re: Unbound Field & On Form Change
Reply #24 - Jan 5th, 2006 at 3:43pm
Print Post Print Post  
I will have to disagree with Spencer.  Even Microsoft provides helps for converts to their programes.  I like such helps as I use both Q&A and Sesame. Smiley
  
Back to top
 
IP Logged
 
walt
Member
*
Offline



Posts: 48
Joined: Nov 30th, 2002
Re: Unbound Field & On Form Change
Reply #25 - Jan 6th, 2006 at 6:45pm
Print Post Print Post  
Quote:
I will have to disagree with Spencer.  Even Microsoft provides helps for converts to their programes.  I like such helps as I use both Q&A and Sesame. Smiley

Ditto!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print