Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Subform - On Element Change (Read 2176 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Subform - On Element Change
Jan 19th, 2006 at 7:42pm
Print Post Print Post  
Hi -

When you click in a sub-form should the click alone automatically trigger on-event programming?

For example: 

In my CD Database, the tracks are listed in sub-forms.  In my main form, I want to know the total number of tracks.  I have a sub-routine to loop through the sub-forms and count the number, but I only want it to execute if I make a change to the data.

What is happening is that the sub-routine runs every time I click on the layout element, whether I have made a change or not.  The main problem I have with that is that if I want to change something in the layout element of an existing sub-form, the sub-routine starts running as soon as I click on the layout element and I am prevented from making the change.  In other words, it is running as I would expect had I entered it in "on element entry."

Am I overlooking something or is that the way "on element change" programming is intended to work in a sub-form?

Thanks!
  

- 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: Subform - On Element Change
Reply #1 - Jan 19th, 2006 at 8:14pm
Print Post Print Post  
Hello Spencer,

Quote:
I have a sub-routine to loop through the sub-forms and count the number


Why loop through the subform to count the number of records when there is an SBasic Command @FormResultSetTotal() that returns the number of records in the subform.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Subform - On Element Change
Reply #2 - Jan 19th, 2006 at 8:18pm
Print Post Print Post  
Hi Ray -

Actually what I was trying to do is a little more complex than I described.  I just thought that the additional information would be superfluous to the question.  Was hoping it could be answered - in general - without having to go into more detail (especially since I'm in a time crunch right now).

If the question can be answered with the limited information I provided, I would very much appreciate it.

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: Subform - On Element Change
Reply #3 - Jan 19th, 2006 at 10:54pm
Print Post Print Post  
Ray -

The @FormResultSetTotal() command may come in handy for something else I want to do (or perhaps I don't need it).

Suppose I want to enter in the main record "The last track of this CD will play for 4:55 minutes."

I know that I could use the @FormResultSetTotal() command to find that there are, for example, 12 tracks.  Could I (with or without the use of this command) determine the "time" from the last record in my set?

In other words, how can I pick up the "Time" entry from track
12 and not from track 9 (or any other track)?

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: Subform - On Element Change
Reply #4 - Jan 20th, 2006 at 12:22am
Print Post Print Post  
Hi -

I have yet two more questions regarding sub-forms on layout element exit.

I have some programming in the on-element-exit event.  If I tab or press enter to leave the layout element (or even use the down arrow key to go to another sub-form), the programming executes just fine.

If, however, I exit the LE by clicking on another layout element, the programming is not triggered.  

It seems to me that no matter how I  exit a Layout Element the On-Element-Exit programming should execute.

Once again, is this intended or something I should be addressing through programming?

The next question is how can I tell that I've deleted a record?  In this case, I would still need the same programming triggered to recalculate information from all my sub-forms.

As an example, let's say I was adding the time of all the tracks in the sub-forms and keeping a total in the main form.  Changing TIME in any record causes the total time in the main record to be recalculated (unless as described above I exit by clicking on another LE).  I also need it recaluclated when I delete a record.

One last comment about this.  Im giving the example as it relates to my question but I want to apply this in more complex matters and for a variety of applications.

Thanks!

« Last Edit: Jan 20th, 2006 at 4:20pm 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: Subform - On Element Change
Reply #5 - Jan 20th, 2006 at 4:41pm
Print Post Print Post  
Quote:
Ray -

The @FormResultSetTotal() command may come in handy for something else I want to do (or perhaps I don't need it).

Suppose I want to enter in the main record "The last track of this CD will play for 4:55 minutes."

I know that I could use the @FormResultSetTotal() command to find that there are, for example, 12 tracks.  Could I (with or without the use of this command) determine the "time" from the last record in my set?

In other words, how can I pick up the "Time" entry from track
12 and not from track 9 (or any other track)?

Thanks!


Hello Spencer,

Something like
Code
Select All
Var vTrackCnt as Int
Var vLastTrackTime as Double

vTrackCnt = @FormResultSetTotal("MySubformName")
vLastTrackTime = @FormFieldValue("MySubformName", "TrackLengthElement", vTrackCnt) 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
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: Subform - On Element Change
Reply #6 - Jan 20th, 2006 at 4:43pm
Print Post Print Post  
Hello Spencer,

Quote:
Hi -

I have yet two more questions regarding sub-forms on layout element exit.

I have some programming in the on-element-exit event.  If I tab or press enter to leave the layout element (or even use the down arrow key to go to another sub-form), the programming executes just fine.

If, however, I exit the LE by clicking on another layout element, the programming is not triggered. 


Are you clicking on another Layout Element on the Parent form or on the subform?

If leaving one element of a Table view subform to go to another layout element on the same Subform, the On Element Exit event for the First element will fire regardless if you are in Edit Mode or Navigate Mode.

If leaving one element of a Table view subform to go to another layout element on a different form, the On Element Exit event for the First element will fire only if you are in Edit Mode. If you are in Navigate Mode, The on element exit event will not fire as that element in the subform still has focus for that form even though that form as a whole does not have focus.

Quote:
The next question is how can I tell that I've deleted a record?  In this case, I would still need the same programming triggered to recalculate information from all my sub-forms.

As an example, let's say I was adding the time of all the tracks in the sub-forms and keeping a total in the main form.  Changing TIME in any record causes the total time in the main record to be recalculated (unless as described above I exit by clicking on another LE).  I also need it recaluclated when I delete a record.


Put a command button on your parent form that re-calculates everything that needs to be calculated from the subform. You could also run the code on Form Entry or Exit of the Parent form so when you arrive at a record it has the correct values in it.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Subform - On Element Change
Reply #7 - Jan 22nd, 2006 at 10:17pm
Print Post Print Post  
I have just spent many hours to get some code to work, and it is still not working.  Coming back to the forum for some hints/help, I find I am not alone working in this same area.  Code works with Enter, but not with mouse,
(or vice versa, I have already forgotten I have done it so many ways).

This has got to be the most confusing part of Sesame that I have encountered.  I don't think I am alone in thinking that the expectation is that Element Exit programming should run when you exit the element.  It should not matter if done with the mouse, with ENTER/Tab/Arrow.

If we must live with this, and it depends on the Mode, then I could use some explanation about which "Mode" is used.  There is a lot of inconsistency about the term Mode.

Quote:
If leaving one element of a Table view subform to go to another layout element on a different form, the On Element Exit event for the First element will fire only if you are in Edit Mode. If you are in Navigate Mode, The on element exit event will not fire as that element in the subform still has focus for that form even though that form as a whole does not have focus.
Could you please explain Navigate Mode vs. Edit Mode vs. Preview Mode, vs. Add Mode, Update Mode, etc.  Page of Users Manual only list 4 modes -Search/Update/Add/Working.

Where is Navigate Mode?

I have spent many hours trying to get TableView SubForm code to execute to no avail.  Spencer has been having the same problem, Carl has been having the same problem.  I still have "basic" instructions that will not execute consistently.  We need to have easy to use tools that do not require extensive code just to do a simple ThrowFocus for example.

If this was for myself, maybe I could live with it.
If I am working for someone else and billing per hour, then my end user could not afford the programs.  Since I want to keep their cost down, then I must do this work at no charge so they can afford the product, but now I pay the cost in lost productivity.
If I am working on fixed cost vs. hourly, then I am losing many hours that could be billed for other tasks.

The quote above is probably a good start, but could someone please provide a decision tree that Sesame follows when exiting an element, using the same terminology that is in the Users Guide and Programming Guide?

Like this simplified model, but with all decision branches and the logical order that is followed:
What is the Mode?
If Mode = n then ........
If sub form then ......
If trigger to exit was Enter then ......
If trigger to exit was Mouse then......

We can continue to submit code examples and ask Ray to solve the problem, but it is more important that we have the information so we understand what is going to happen when an element loses focus. 
What about when Ray is not available like this weekend, or any other time?
We need to be able to write simple "click" routines that do complete tasks, and not have to add Calculate buttons to parent forms and rely on someones memory to click on a button.

Please understand, this should not be read as a complaint, but as a PLEA for easy to understand logic flow.  I don't think that Carl or Spencer or myself are beginners, but it is obvious that we are struggling with some stuf that should be really basic to do. 

Looking forward to see the logic flow......thanks for listening.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform - On Element Change
Reply #8 - Jan 23rd, 2006 at 12:03am
Print Post Print Post  
The "edit mode" versus "navigate mode" that Ray was referring to, refers to modes specific to the table. If you double click, or begin typing in a table cell, that cell goes into edit mode - signified by the down box and the appearance of a cursor. Otherwise the table is in navigate mode, signified by the entire cell being highlighted in reverse.
  

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


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Subform - On Element Change
Reply #9 - Jan 23rd, 2006 at 1:06am
Print Post Print Post  
Thanks for reply Mark, but still not clear to me.

Quote:
If leaving one element of a Table view subform to go to another layout element on a different form, the On Element Exit event for the First element will fire only if you are in Edit Mode.
RE "different form" in the quote above, is moving to a new record in the same subform the same as going to a different form?  I would be thinking NO.  If I moved to the parent form then I would think that is a different form.
When the mouse cursor is on an element, not opened to edit, and then clicks on an element in another record in the same subform will the Element Exit program execute?
Does using the mouse = "leaving the element"?
Does pressing ENTER = "leaving the element"?
Does using the UP/DOWN arrow = "leaving the element"?

Does this logic also apply to Forms as well as Elements?

If I use NotifyForm(1) in FormExit, why is it that I can keep pressing the Down Arrow and keep adding blank records into the subform?  Why is NotifyForm(1) allowing me to save a record and continue to add another one?  Are you saying the Down Arrow is Navigate Mode, and because I never opened the record that Edit Mode is never active?

Does this also mean the Form Entry does not fire either with the Up/Down arrows?  How about the Navigation buttons at the top of the form?

Quote:
Otherwise the table is in navigate mode, signified by the entire cell being highlighted in reverse.
Does color have anything to do with this.  If I just click once on a record LE I see no change.  I think I am in "Navigate Mode" based on these earlier explanations.  Now I click in the same LE in another record, I see no change.  Is this what you are calling "reverse"?  This seems normal to me, not reverse.  But when I make a second click, then I get black on white, "active" appearance for editing.  I would now guess that I am in "Edit Mode" ?

I am not trying to drag this out, I am just still confused.

If I go to a blank LE in a subform and Click the mouse for focus, nothing happens.  If I make a second click I get "Edit Mode" but programming in ImmediateChange is firing even though I have not entered anything into the element.  I would have expected ElementEntry programs to fire, but no Immediate Change.....nothing has been changed.  I can still exit this record and click in another record without making any change.

After all this time, I thought I had a handle on this but one I started proctecting against deleted records, I have found out that many of my understandings were probably not complete.  It is like I am releaning all over again.

Any chance for the Decision Tree that I requested for us?

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform - On Element Change
Reply #10 - Jan 23rd, 2006 at 2:38am
Print Post Print Post  
Quote:
Does color have anything to do with this?


No. I just meant that the entire cell is highlighted while in navigate mode in the table.
  

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


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Subform - On Element Change
Reply #11 - Jan 23rd, 2006 at 3:12am
Print Post Print Post  
I am really not trying to be picky here Mark.  It's not just words.  Words mean something.  "It depends what 'is' is".
Quote:
the entire cell is highlighted


For years I have understood that "highlighted" meant that a group of characters had a distinct background color associated with the group.  Like when I "highlight" a group of characters to Copy/Paste.  I select the characters for the operation and they are highlighted.

On a subform I never see any "highlighted cell" in "Navigation" or "Edit" mode unless I am editing in a LE and select those characters as noted above.

Do you really mean highlighted, or are you meaning a reference to a LE that may have the LE block "outlined"?

Part of the explanation problem is the indiscriminate use of words that seem to have multiple meanings depending on one's past experiences.  I know that I make a conscious effort to use LE or element vs. field and application vs. database on Sesame forum.

So, if you mean that if an LE box is outlined in a Table View subform, that means we are in Navigate Mode, and ElementExit programming will not execute?  Do I have that correct now?

If NO, please try to explain again.
If YES, then what can be done to force Element Exit programming to execute in the outlined LE as one Navigates between the records in the SubForm?
Can we add StandAlone =0 to force execution in Navigation mode?

If this cannot be done, then does that mean we should not put programming in Element Exit LEs that are on SubForms?  Obviously NO, because we do want code executed when in Edit Mode.

If we are in Edit Mode, and use an arrow or mouse to exit from the LE, does that immediately put us into Navigation Mode and prevent the Exit code from executing?

Still listening?  Still willing to Help?  Thanks again.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform - On Element Change
Reply #12 - Jan 23rd, 2006 at 1:34pm
Print Post Print Post  
A table while navigating:


A table while editing:
  

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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subform - On Element Change
Reply #13 - Jan 23rd, 2006 at 2:31pm
Print Post Print Post  
Quote:
I have spent many hours trying to get TableView SubForm code to execute to no avail.  Spencer has been having the same problem, Carl has been having the same problem.

The problem I had, was that the On Element Entry event doesn't execute when ThrowFocus is responsible for navigating to the element. Navigating there manually with the mouse, it executes as expected, even though it is still not in 'edit' mode, just in 'navigate' mode.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
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: Subform - On Element Change
Reply #14 - Jan 23rd, 2006 at 5:13pm
Print Post Print Post  
Quote:
RE "different form" in the quote above, is moving to a new record in the same subform the same as going to a different form?


No. Forms are different than records. That quote refers to clicking on a completely different form, such as the parent form.

Quote:
If I moved to the parent form then I would think that is a different form.


Yes the Parent form is a different form then the subform.

Quote:
When the mouse cursor is on an element, not opened to edit, and then clicks on an element in another record in the same subform will the Element Exit program execute?


Yes. That Table Cell is in Navigate Mode. If you refer to my quote Quote:
If leaving one element of a Table view subform to go to another layout element on the same Subform, the On Element Exit event for the First element will fire regardless if you are in Edit Mode or Navigate Mode.
you will see that I have already covered this.

Quote:
Does using the mouse = "leaving the element"?


Yes.

Quote:
Does pressing ENTER = "leaving the element"?


Yes.

Quote:
Does using the UP/DOWN arrow = "leaving the element"?


Yes. Tab does as well.

Quote:
Does this logic also apply to Forms as well as Elements?


No this logic does not apply to forms as well as elements as they are two separate things. Leaving a form, and going to a subform, by hitting Tab, Enter, or the arrow keys or by using the mouse does not fire the Form Exit or Form Entry events.

Quote:
If I use NotifyForm(1) in FormExit, why is it that I can keep pressing the Down Arrow and keep adding blank records into the subform?  Why is NotifyForm(1) allowing me to save a record and continue to add another one? 


As far as I am aware the only NotifyForm() that works in Table View subforms in 1.0 is '4' which prevents the deletion of records. But pressing the Down arrow will only add one blank record. Unless your programming is filling in values on that record, or you are, you cannot hit the Down arrow to add another record.

Quote:
Are you saying the Down Arrow is Navigate Mode, and because I never opened the record that Edit Mode is never active?


Down Arrow and Navigate Mode are not the same thing. Navigate Mode is a mode of cells in a Table View Subform. Down arrow is a key on the keyboard. When you are arrowing, tabbing, or entering, around a form you are in Navigate Mode. As soon as you type a character into a cell you are in Edit Mode. If you Double Click on a cell you are in Edit mode.

Once again if you are in a table view subform and tabbing through cells, and not leaving that form, the on element exit events of those elements will fire. Form refers to the subform itself not to individual records.

Quote:
Does this also mean the Form Entry does not fire either with the Up/Down arrows?


No. The On Form Entry and On Form Exit Events will fire with the Up and Down Arrows.

Quote:
How about the Navigation buttons at the top of the form?

Those will also fire the On Form Entry and On Form Exit Events.

[quote]If I go to a blank LE in a subform and Click the mouse for focus, nothing happens.  If I make a second click I get "Edit Mode" but programming in ImmediateChange is firing even though I have not entered anything into the element.


I am not seeing this behavior here in any of my tests. Are you sure that none of your other programming is changing values for that element? On Element Immediate Change is working fine for me.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print