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

Close form / table stays open

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

    Close form / table stays open

    Whenever I open a form and then close it, using the x at the top right hand of the window or even using a script "close Form", the form closes but I can't backup the database, compact it or pack a table. The file is still "in use".

    Is this supposed to work like this??? Is there a unviersal "close everything that is open" command i can use?

    Dave
    David A. Volgas, MD

    #2
    Re: Close form / table stays open

    Hi David,

    I haven't dabbled yet in V9, but in V8 you can use the following:

    a5_forceclosetables() will close all open tables

    A5_CLOSE_ALL_WINDOWS() will close all open windows

    There is no way to close all open dialog boxes that I know of. Hope this helps.

    Bob Arbuthnot

    Comment


      #3
      Re: Close form / table stays open

      Hi David,

      Curious...are you opening the forms in question as a dialog forms? If so then makes sense as to why they are still open after "closing" them as you are.
      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


        #4
        Re: Close form / table stays open

        It doesn't make sense to me that opening a form based on a table and then closing the form "normally" regardless of Frame Stype would leave a table open. A5 should be closing the table. Do you have code opening the table as well?

        I just created a form - Dialog - based on a table, opened it, closed it using the X and then packed the table the form was based on. I also tried opening the form and then packing the table and I got the table open message - which makes sense.

        I don't think you should be looking for a "close all" solution - but rather why the table is left open. There have been a few updates released this week - are they all in?

        David

        Comment


          #5
          Re: Close form / table stays open

          David,

          If you open a form in non dialog mode then yes the tables close on exit. If you open a form as a dialog the closing the form only hides the form and allows you to still access objects from that dialog form before you close the form yourself. Below is from the help file on form.load.

          Jeff



          Using the Dialog Style to Prepare a Form with Default Values
          This technique allows you to prepare the form with default values before showing it to the user.

          Note : You must end with the <FORM>.CLOSE() method or you will eventually run out of sessions.

          dim frm as P
          frm = form.load("DialogForm1","dialog")
          ' create a new record and set default values
          frm.New_Record()
          frm:Lastname.text = "Rabins"
          frm:Firstname.text = "Selwyn"
          ' now show the form
          frm.show()
          ' the user inputs values into the fields
          ' the user closes the form, but actually just hides it
          'now, really close the form
          frm.close()
          Jeff Ryder

          Comment


            #6
            Re: Close form / table stays open

            Hey Jeff,

            That doesn't seem to be what's happening though.

            I copied the code from your post into a button on a form, but I commented out the frm.close(). The button push opens the form, the data I "pre-loaded" is displayed and I click the red x to close the form - I get a confirmation message asking if I want to save the record and I reply yes. The form closes (hides?).

            Now I can go to my tables, select the table used in the "dialog" form and pack that table. It packs.

            Does that make sense?

            Comment


              #7
              Re: Close form / table stays open

              David,

              Check out my zipped sample. Load form 1 and follow the directions on the screen. It shows the expected behavior for a form loaded as a dialog.

              Jeff
              Jeff Ryder

              Comment


                #8
                Re: Close form / table stays open

                Thank you so much for taking the time to put this together.

                I didn't have my Window Toolbar on, so I turned that on... now I can see the window tabs.

                Now I start form1, then click to open form2. I enter data and close the window. form2 does stay on the tab... opened.

                But, here's the odd stuff. The original problem was that he couldn't pack a table after closing the dialog form. Well I'm starting this process from the Control Panel.

                I close form2, go to the Control Panel, right click on table2 and pack it - it packs. Without the Window tab I couldn't see what was happening.

                As you say, form2 does stay open when you close it. But, clicking on the Control Panel closes all open dialog forms. That's why I can go to my table and pack it. I added a 3rd form and opened it from form2 as a dialog. So, now I have 2 dialog forms open in the window tab, closed on screen, but when I click on the control panel, both forms close.

                It gets a bit stranger still. The Close Form button you put on form1 works, once. Click it a second time and an error will result. Close a dialog form, then click the control panel - the dialog form will close. Now, form1 is still open... click the close form button... no error.

                Overall, in an app, you would not be going to the control panel, so closing the form specifically is still necessary. You'd be packing the table in code or from another form - and the table would be locked. I'm just happy I can see the behaviour now.

                Does all this sound like it works the way it should? If going to the control panel closes the form, should it close the form's table?

                Comment


                  #9
                  Re: Close form / table stays open

                  David,

                  I took the test and added a third button called show form 2. The on push event was frm.show(). What this proves is that when you click on the control panel tab, it is not closing the forms, but just updating the tabs to not show forms that are hidden. This is because if I click on the new show button, form 2 re-displays and this could not happen if the form was actually closed.

                  The reason the button only works once is that "frm" is a pointer to the open form and once the form is closed the pointer is no longer valid because the form does not exist when closing a second time. You could test for that condition and not do the close a second time but that is not was I was trying to test.

                  As far as the packing of a table goes I I do not have an answer as I am still learning and developing my first application. I do have a dialog form that I pop up in my order entry and struggled through the form staying open as I originally missed the part of help that said I needed to close the form.

                  Jeff
                  Jeff Ryder

                  Comment


                    #10
                    Re: Close form / table stays open

                    Makes sense Jeff... all very interesting working through A5 and it's behaviours. Concepts not new, but how to get things done takes a while to find.

                    David

                    Comment


                      #11
                      Re: Close form / table stays open

                      Originally posted by davidv43 View Post
                      Whenever I open a form and then close it, using the x at the top right hand of the window or even using a script "close Form", the form closes but I can't backup the database, compact it or pack a table. The file is still "in use".

                      Is this supposed to work like this??? Is there a unviersal "close everything that is open" command i can use?

                      Dave

                      if the form is a regular, modeless form, then and clicking the x is not actually closing the table, then we would be very interested in getting a copy of you application so that we can see this behavior for ourselved.

                      it is clearly not what's supposed to be happening, and it is not happening when I test any of the forms in (say) alphasports.

                      if you test forms in alphasorts, do you have the same problem.
                      (you can see if a table has been left open after you close all forms by selecting File, Database Information when the control panel has focus. if a table is still open, it will have a red icon next to it).

                      Comment


                        #12
                        Re: Close form / table stays open

                        Selwyn,

                        The forms are being loaded differently in AlphaSports.

                        In the test.zip attached, the forms are being loaded as dialog using frm.load... maybe that's the difference.

                        The the form is loaded as...

                        frm = form.load("Form2","dialog")
                        frm.show()

                        and the the form is closed using the red x... Database Properties shows the Form2 table - test2 - as being open.

                        Is this correct?

                        Thanks Selwyn,

                        David

                        Comment


                          #13
                          Re: Close form / table stays open

                          Originally posted by Davidk View Post
                          Selwyn,

                          The forms are being loaded differently in AlphaSports.

                          In the test.zip attached, the forms are being loaded as dialog using frm.load... maybe that's the difference.

                          The the form is loaded as...

                          frm = form.load("Form2","dialog")
                          frm.show()

                          and the the form is closed using the red x... Database Properties shows the Form2 table - test2 - as being open.

                          Is this correct?

                          Thanks Selwyn,

                          David
                          thanks.

                          you have identified the problem. you are using the 'dialog' option. you should refer to the documentation on form.load().

                          here is what happens (see comments in code)

                          Code:
                          'form is loaded into memory but is not visible - xbasic script is NOT paused
                          frm = form.load("Form2","dialog")
                          
                          'form is made visible and since is it a modal window, the xbasic script pauses until the user 'closes' the form
                          frm.show()
                          
                          'any code after this point will only execute after the user 'closes' the form by clicking the X or doing an xbasic command, such as topparent.close().
                          
                          'the form is no longer visible, but it is still open (i.e. the user action of closing the form has really only hidden it)
                          'here we will read a value from a control on the form as a demonstration that the form is still in memory.
                          txt = frm:lastname.text
                          
                          
                          'now we no longer need the form so lets really close it
                          frm.close()
                          
                          'at this point, any tables that the form was based on will be closed

                          Comment


                            #14
                            Re: Close form / table stays open

                            Thanks Selwyn... that's what Jeff pointed out above as well. I was just a bit confused because the form is removed from the Window tab when I click on the Control Panel.

                            Cheers,

                            David

                            Comment

                            Working...
                            X