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

Calling form won't close with called form script

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

    Calling form won't close with called form script

    Good evening,

    I've searched without success on this although I am certain it has been asked before. Although I am not aware that I have ever seen a resolved discussion on this matter.

    Table1-Form1 with button with OnPush Event that opens Form2, based on table2, normal mode. Form2 OnInit event scripting is:

    1: Close Form1
    2. Script that effects Table1, (including table.zap()) then closes itself and reopens Form1.

    There is only one script events on the button of form1= Open form2. When form2 opens the OnInit event is close Form1.

    Why does it not happen that Form1-Table 1 closes so the script directed to the table can execute?

    The exact reasons that I wish this is very longwinded and complex. The question much shorter so I'm starting here. Thanks.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    #2
    Re: Calling form won't close with called form script

    Sounds like a timing issue.

    I would try closing Form1 in the OnPush event of the button on Form1. Put the form close before opening form2
    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


      #3
      Re: Calling form won't close with called form script

      Following up on Tim's idea, have you tried putting an xbasic_wait_for_idle() after the form1.close()?

      The xbasic_wait_for_idle() should halt script execution until the form is actually closed. Without it, the rest of the script will try to proceed (and fail) before the form is completely closed.

      This may take some trial and error work. The xbasic_wait_for_idle() should wait for ALL "ui" object changes to finish and that would include the startup of Form2 but Form2 is still in the OnInit stage so it isn't really open yet. This might be another reason to add the action to the button.

      Comment


        #4
        Re: Calling form won't close with called form script

        Tim, Cal,

        I tried all that. Didn't work. I solved it this way:

        1. Form1 Button: Open Form2, Close Form1.
        2. Form2 OnInit event:
        Dim shared vTimer as L=.t. (form timer set to 0.5 sec)
        3. OnTimer event:
        Execute table1 change action conditional on vTimer = .t.
        vTimer = .f.
        Close Form2
        Open Form1

        Cal,
        I'm going to try the way that was not working in v7 in v8, and might have been relieved with 'a5_wait...." and see what happens. 'cause the 'wait for idle' is out in v8, because the system is supposed to handle.
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: Calling form won't close with called form script

          Mike, since it's not necessary to open a form in order to change values in a table, I'm curious why you're going through all this trouble to open a form, run an automated procedure processing records in the table and then closing the form? -- tom

          Comment


            #6
            Re: Calling form won't close with called form script

            Tom/Mike:
            I had the same question when I read the first post but hesitated to ask as Mike had already qualified the reasons as a "longwinded".

            If I were to guess:
            1-Mike wants to zap the table on which Form1 is based
            2-He figured, he won't be able to do so as long as the form is open, so
            3-He used form2 as an intermediary to run the script that zaps table1, then
            4-Re-open form1

            I must tell you, there are a lot of short cuts to this script if that was the intended behavior, but hate to pile speculations on top of speculations.

            Comment


              #7
              Re: Calling form won't close with called form script

              Originally posted by Mike Wilson View Post
              cause the 'wait for idle' is out in v8, because the system is supposed to handle.
              Careful. I don't recall it being said that it was "out" only something to the effect that it was not needed in most cases. Some people have even reported that it needs to be removed from certain places but I don't recall anyone saying it should never be used.

              Comment


                #8
                Re: Calling form won't close with called form script

                I must have missed several replies ahead of Tom's.
                One other thing you could try is:
                TABLE.IN_USE()
                xbasic_wait_for_idle does not serve any purpose in v8 other than wasting a miniscule of execution time. It is moot. Take it out of your vocabulary.

                Comment


                  #9
                  Re: Calling form won't close with called form script

                  Be careful about saying "never" -- from the this thread: http://msgboard.alphasoftware.com/al..._wait_for_idle

                  Originally posted by Ronald Anusiewicz View Post
                  I'm not sure about this.
                  I tried REMing out a couple of xbasic_wait_for_idle and my scripts stopped working properly.
                  I think we need more specific information on this one.
                  Ron

                  Originally posted by Daniel Weiss View Post
                  I just ran into an issue where I can�t get an xdialog (in v8) to work as I want without using "XBASIC_WAIT_FOR_IDLE()" or "UI_YIELD()".
                  In most cases I use "WAIT_UNTIL()" which works fine, but in this case "WAIT_UNTIL()" won�t do the job.
                  Both "XBASIC_WAIT_FOR_IDLE()" and "UI_YIELD()" work fine. Which of the two is recommended? And dose it make any difference which one is used?
                  Thank you,

                  Comment


                    #10
                    Re: Calling form won't close with called form script

                    Gabriel's conjecture was a bullseye. So, here is the long winded part.

                    I'm coming into this database secondhand and faced with mitigating some poor design. The table is a lookup support table, 22 fields 4 sets of paired fields, holding values for lookups (list items). Overall, the table holds about 250 records, with the smallest field holding 5 values and the largest 60. The administrator has the privilege to add 'list' items through a form that 'adds a new record' for each addition. Since inception, the field with 60 list items has been added to the most, and other fields less. The outcome is that the table has some fields having a few initial consecutive records with values, and then large numbers of blanks prior to the newest entries. I'm requested to create a utility function that maintains the values in each field within consecutive records (removing the blanks). The administrator desires to keep the entry form for 'list' entries and not address the table directly (which would make life a lot easier).

                    My initial approach was to generate an array of the fields in the lookup table (named LookUps), using table.external_field_name_get() and for each field an array of the values for each field absent the blanks using table.external_content_get() filtered to isnotblank(). With these, then building a temporary table with the field values being consecutive, and the last step being to copy the temp table back to the original. I wrote the script, it worked great generating the temp table, but the trick was then to get the temp table back to the original when the execution of the function was initiated from the Form based on the originating LookUps table.

                    I worked it out by using using an intermediary form as Gabriel outlined and placing the initiation of the second table transfer component on that form. It worked out fine with this approach. The function rebuilt the LookUps table, cleaned out of many blanks, and reduced the table record count from 256 to 61. But after executing it several times, and running through my mind the process, I thought it silly to continue producing a "messy table" (owners words) and then cleaning it up. So I wrote a function that instead of adding a new record to the table for each new entry, a new record is only added for additions to fields that have record values at the end of the table (eof), and for the others, acquire the record number that holds the field's last entry, and change the next record that holds a blank to hold the added value. This keeps the field values in consecutive records and the table "clean" at the time of adding new values. It voids the need for the first function that cleaned the table, but some of it's scripting I used in producing the new function.

                    Wind over...
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Calling form won't close with called form script

                      Just to round out this thread, I found an interesting function named:

                      a5runXbasicAfterClosingWindows()

                      that the docs say is usefull when needing to have exclusive rights to a table, (ex: <tbl.pack() ). I'm thinking then table.zap() would also work, here, and this is just the place for this function.
                      Mike W
                      __________________________
                      "I rebel in at least small things to express to the world that I have not completely surrendered"

                      Comment

                      Working...
                      X