Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Bug or quirk? OnArrive field event fires with toolbar save button.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug or quirk? OnArrive field event fires with toolbar save button.

    I looked the the myriad of "OnArrive" search threads and couldn't see this.

    I have an Order Entry form tied to a single table that has the last field in the form before a save button having an Onarrive event. The field OnArrive event runs a UDF that shows a dialog message. After the dialog is closed, the cursor remains in the last field containig the Onarrive event. There are two ways to save the record, with the yellow "Save Order" button and the toolbar Save record button. Both buttons call the same Save-UDF. When the form button is used it directly runs the save UDF as desired, but when the toolbar button is used it refires the OnArrive field event. What the heck!!

    Bug or quirk?
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  • #2
    Re: Bug or quirk? OnArrive field event fires with toolbar save button.

    Mike

    I can confirm what you are seeing in using the save record in the customized toolbar.

    I used debug to see if I could see where it was going but to no avail, as soon as the toolbar button is pushed it triggers the Onarrive event
    I tried it with the regular system toolbar - same thing.

    I tried it in version 9 - same thing happens.

    I tried it in Version 8 -works the way it should.

    Since it works in Version 8 and not 9 (forget about it) and not V10 - I would suggest that it is a bug - but you might hear from others yet.

    Tom Baker
    Last edited by Tbaker; 08-16-2010, 03:38 PM. Reason: Changed OnActivate to OnArrive

    Comment


    • #3
      Re: Bug or quirk? OnArrive field event fires with toolbar save button.

      Mike

      I have been playing around with the sample off and on since I downloaded.

      I think the problem is that exam field is the last field and the one with the on arrive event.

      If you place another field after it in tab order and then go to that field, and then save using the customized tool bar, the app works the way it should.

      Evidently, going to the toolbar is taking focus away from the form, so when the save command is completed, the form now is actiavated and the last field that had focus still has focue it triggers the onArrive event - just a guess.

      Pushing the button on the form does not take focus away from the form (again a guess) so the on arrive event would not fire.

      I would submit this as a bug.

      Tom Baker

      Comment


      • #4
        Re: Bug or quirk? OnArrive field event fires with toolbar save button.

        Thanks Tom,
        I figured the same and thought the same about it being the last field. My problem is, as you might expect, a FAR simpler version of a significantly complex entry. The UDF called on the onarrive event is much more complex than the example, and sending the cursors to other fields is not a solution. This is a step in the process where the user might save the record, and this event of firing the OnArrive AGAIN is both "shocking" and very confusing to the user (was to me!). I submitted it as a bug report.


        Later: Selwyns response:
        thanks. i realize it is always tempting to blame issues on bugs in the software.
        However, I looked at your sample app. There is no bug in a5. the problem is in your code.
        Alpha Five is behaving completely appropriately.

        MORE:
        I have looked this over carefully, over and over, and I am not enlightened to what "code problem" he is referring to. I see this as the same code being called from the toolbar button as from the form button, EXCEPT the call from the toolbar results in the OnArrive event of the field to refire, while the call from the form button does not. AND...if I remove the if parentform.mode_get() statement from the field OnArrive event, the call using the toolbar causes the OnArrive event to fire 3 times.

        What am I missing?
        Last edited by Mike Wilson; 08-16-2010, 05:31 PM.
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


        • #5
          Re: Bug or quirk? OnArrive field event fires with toolbar save button.

          I concur with Tom's thoughts in post 3. I would say Selwyn's comment about it being a problem in your code is referring to the fact you don't account for this.

          Using your simple example I was able to make it behave by
          1/creating a logical session variable (OA_Block) for the form defaulting to false.
          2/Adding code to the onArrive event like so...
          Code:
          dim shared OA_Block as L
          
          if parentform.Mode_Get()<>"view" .and. .not. OA_Block
              order_entry_examco_get()
          end if
          3/ Adding code to the orderContinue() function.
          Code:
          Function OrderContinue as C()
              dim shared OA_Block as L
              OA_Block = .t.
              
              etc...
              etc...
          
          
              OA_Block = .f.
          End Function
          Of course exactly where and how often you change the value of this control variable will depend on the complexity of your process.
          Tim Kiebert
          Eagle Creek Citrus
          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

          Comment


          • #6
            Re: Bug or quirk? OnArrive field event fires with toolbar save button.

            Mike

            That is not like Selwyn to just say, "it's not Alpha, it is your code".

            I have looked at your entire sample including the table events - nothing in there would cause what we are seeing except for landing on that last field.

            I have attached a down and dirty sample that has very little code. In fact it only has an on arrive event and one button with code to save the record.

            No other code- no udf's - no field rule events and even uses the system toolbar and it still reacts the same.

            I wonder what Selwyn would say about this one.

            Again, the only thing that I can see could be the culprit is the fact that the save is taking place with the last field (the on arrive field event field) still having focus so when focus returns to the form the on arrive event fires sometime three times.

            Just thought I would throw this together (very plain vanilla sample) to show that it would happen with not a lot of code just simple things.

            Tom Baker

            Comment


            • #7
              Re: Bug or quirk? OnArrive field event fires with toolbar save button.

              OK, Tim,
              You can put as many fields as you wish following the OnArrive field, it changes nothing.
              I see that what you developed does remit the problem, but what is the issue that is solved and how the hell does what you delivered solve it!!! And what mindset drew you to comprehend that as a solution? Why QA_block? What does that mean? What is the secrete here? Why is this needed for a toolbar button and not a form button? Would someone please let me into the club? And apparently Tom too!!

              Thank you.
              Last edited by Mike Wilson; 08-16-2010, 10:52 PM.
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


              • #8
                Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                Mike,

                I just thought I would offer up a solution for you. I just added a line of code in your toolbar to get you the result you want.

                Scott

                Comment


                • #9
                  Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                  Good one Scott. Now why didn't I think of that. Obvious once you see it. Hopefully it works in Mike's production app. I don't see why it wouldn't.

                  Mike,
                  Scott's idea is much simpler than mine. He just puts focus straight back to the form and somewhere other than the object that has the OnArrive code

                  I agree that putting more fields after does not help at all. I believe the problem is that the field that is active when you click the toolbar is the one with the OnArrive event. Clicking the toolbar causes the form to loose focus and then when the form gets back focus the entry point is the field with the OnArrive event, so it fires. The OnArrive event does not know from whence you come, just that you do. Scotts solution forces the returning focus to a different(safe) object.

                  What I tried to do was disable the Onarrive code by interjecting a logical variable as a further test. OA_block (not QA_block) is just a a name I made up. short for OnArrive_block. My idea was to temporily disable the event a bit like you would do in a buton OnPush event to guard against multiple clicks by disabling the button at the start of code with and re-enabling at the end. I was trying to give Alpha time to put focus back to the form before the OA_block variable would again allow the event to fire. Also since you have a commit instruction in your code then the form would again be in view mode.

                  Again I think Scott's solution is the one you should go for since the main problem I think is the returning focus and he deals with that in a direct manner.

                  PS Mike - 11 more sleeps.
                  Tim Kiebert
                  Eagle Creek Citrus
                  A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                  Comment


                  • #10
                    Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                    Scott, Tim,
                    Thank you. While I understand the concept, I guess I don't understand the order of processes.

                    >> If parentform.button1.activate() is placed before the script call...it works.
                    >> If parentform.button1.activate() is placed as first line in called script it works.
                    >> If parentform.commit() is placed as first line in called script and the OnActivate script is conditional on <> View mode, it does not work.

                    I guess it's all about the timing, and the timing is all a guess!
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                    • #11
                      Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                      Tim

                      Thanks for clearing the reason behind the coding - I, along with Mike, did not understand the reasoning as Mike has pointed out.

                      Scott- good work.

                      The results of this post is going into my personal A5 archive for the future.


                      BUT......

                      The fact that focus leaves the form when using the toolbar and then when it returns it activates in Version 9 and Version 10 and this does not happen in Version 8 using Mike's sample - what has changed since version 8. That is the million dollar question. So I think that either it is a bug or an explanation is in order from Alpha ;)

                      Again thanks for the education.

                      Tom Baker

                      Comment


                      • #12
                        Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                        Tom,
                        A similar issue was reported as a bug in v9 regarding the OnArrive event firing on a button when a form first receives focus...Alpha was going to look into it was all I heard back then.....apparently the issue was just mine at that time....2 versions of Alpha now using it---wonder if anything will break if made to act differently now.
                        Mike
                        __________________________________________
                        It is only when we forget all our learning that we begin to know.
                        It's not what you look at that matters, it's what you see.
                        Henry David Thoreau
                        __________________________________________



                        Comment


                        • #13
                          Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                          Mike

                          I guess what is perplexing is that in the future should you have an OnArrive event for the last field in the form and you use the system toolbar save record button, the on arrive event will fire twice - so that means if you have a scenario as in Mike W case, you would always have to know to use a customized form view toolbar with the removal of focus from the last field to another field so that the OnArrive event does not fire. (Just as information - in my apps I have a custom tool bar on most of my forms but with a save record - since I want the user to press a button which has error checking on it)

                          I don't think that coding was the problem, but an unfixed bug was - as based on your reply.

                          I have made a note in my own a5 archive based on this post.

                          Tom Baker

                          Comment


                          • #14
                            Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                            I got a note from Selwyn.

                            when you press the button, focus goes from the field to the button.
                            so, when the save is executing, the field no longer has focus.

                            when you click the toolbar, focus does not leave the field. but behind the scenes, a5 is closing the field editor on the field and then reopening it after the save. this causes the onarrive event to fire again.

                            you could have set focus to some other field in your function before the save executed.

                            in any event, we have now changed the behavior so that when the field editor is closed and reopened on a record commit, the onarrive no longer fires.
                            Mike W
                            __________________________
                            "I rebel in at least small things to express to the world that I have not completely surrendered"

                            Comment


                            • #15
                              Re: Bug or quirk? OnArrive field event fires with toolbar save button.

                              Way to go Selwyn

                              Thanks Mike

                              Tom Baker

                              Comment

                              Working...
                              X