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

Closing forms

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

  • Closing forms

    Can any one tell my why this doesnt work, and suggest what
    will ?

    I have a menu which loads and hides/shows a number of forms.
    I am looking for a way to automatically close any open forms
    when exiting.

    ----------------------------------------------------
    ' CLOSE ANY/ALL OPEN FORMS
    dim ptr as p
    dim fil_name as c


    fil_name = :A5.form_enum("")

    while fil_name ""
    ptr=obj(fil_name)

    if is_object(ptr)
    trace.writeln(fil_name)
    ptr.close()
    end if

    fil_name = :A5.form_enum(fil_name)
    end while
    end
    ---------------------------------------------
    Lowell

  • #2
    RE: Closing forms

    I think your script may have several mistakes. Try this:
    ----------------------------------------------------
    ' CLOSE ANY/ALL OPEN FORMS
    dim ptr as p
    dim fil_name(20) as c

    fil_name = :A5.form_enum("")

    i=1

    while fil_name ""
    ptr=obj(fil_name(i))

    if is_object(ptr)
    trace.writeln(fil_name)
    end if

    i=i+1
    fil_name = :A5.form_enum(fil_name(i))
    end while
    ptr.close()
    end
    ---------------------------------------------
    Look at the example on Page 356 of the xbasic manual.
    Peter
    AlphaBase Solutions, LLC

    Peter@AlphaBaseSolutions.com
    https://www.alphabasesolutions.com


    Comment


    • #3
      RE: Closing forms

      ...probably should be:

      while fil_name(i) ""
      ptr=obj(fil_name(i))

      if is_object(ptr)
      trace.writeln(fil_name(i))
      end if





      ....but untested...
      Peter
      AlphaBase Solutions, LLC

      Peter@AlphaBaseSolutions.com
      https://www.alphabasesolutions.com


      Comment


      • #4
        RE: Closing forms

        ptr.close() is incorrect. Ptr is a variable - you can't "close" it.
        Peter
        AlphaBase Solutions, LLC

        Peter@AlphaBaseSolutions.com
        https://www.alphabasesolutions.com


        Comment


        • #5
          RE: Closing forms

          I once wrote the following script to open forms in the background, the reason I did that then was because alpha did not have yet the shadow option and it took a long time open a form each time the user wanted to use it.
          You can use the same to close any open forms

          dim shared frm_invoice_entry as p
          dim shared frm_customer_entry as p
          dim shared frm_invoicing_reports as p
          dim shared frm_payments_entry as p

          if .not.is_object("INVOICE ENTRY")
          frm_invoice_entry = form.load("INVOICE ENTRY")
          frm_invoice_entry.index_set("invno")
          frm_invoice_entry.show()
          end if

          if .not.is_object("CUSTOMER ENTRY")
          frm_customer_entry = form.load("CUSTOMER ENTRY")
          frm_customer_entry.index_set("custid")
          frm_customer_entry.show()
          end if

          if .not.is_object("INVOICING REPORTS")
          frm_invoicing_reports = form.load("INVOICING REPORTS")
          frm_invoicing_reports.index_set("invno")
          frm_invoicing_reports.show()
          end if

          if .not.is_object("PAYMENT ENTRY")
          frm_payments_entry = form.load("PAYMENT ENTRY")
          frm_payments_entry.index_set("open_inv")
          frm_payments_entry.show()
          end if


          END
          enjoy
          Dan
          Daniel Weiss
          EZ Link Software

          Comment


          • #6
            RE: Closing forms

            Dan -
            Thanks for your response. I know this will work, but it
            requires explicit coding for each form that you have opened.

            What I am actualy looking for is a generec routine using an indirect addressing scheme, which will allways find ALL open forms/tables, and close them. Have tried using the enum() function, also .close(), where is derived from tbl = table.current(count). Cant get either to work.

            Lowell

            Comment


            • #7
              RE: Closing forms

              Lowell, I must have been punch drunk. *My* script had too many mistakes. My apologies. the following has been tested and works:

              ''XBasic
              'CLOSE ANY/ALL OPEN FORMS

              dim fil_name as c
              dim ptr as C

              fil_name = :A5.form_enum("")

              while fil_name ""


              ptr=left(fil_name,at("@",fil_name)-1)

              if is_object(ptr)
              trace.writeln(ptr)
              eval(ptr + ".close()")
              end if

              fil_name = :A5.form_enum(fil_name)
              end while
              end
              Peter
              AlphaBase Solutions, LLC

              Peter@AlphaBaseSolutions.com
              https://www.alphabasesolutions.com


              Comment


              • #8
                RE: Closing forms

                Hi Lowell,

                The reason you are having trouble is that fil_name contains the full name and path of the saved form in the data dictionary, such as 'form_name@c:program files......table_name.ddd'

                The obj(fil_name) function isn't able to handle the full path direction and so will never give you a pointer.

                The following syntax should work as the word() function sees a colon as a word seperator:

                fil_name = :A5.form_enum("")

                while fil_name ""
                vword = word(fil_name,1)
                vobj = left(vword, len(vword)-2)
                ptr=obj(vobj)

                ' etc etc.

                This is kind of clumsy, but this should get you just a character string containing the name of the form only and allow your syntax to work. HOWEVER
                you are just enumerating through the form names in the data dictionary and that doesn't necessarily give you the names of the open form ie: if you have a form named 'aForm' and you open a second instance of the form A5 will name the second instance 'aForm0'. Enumerating through the data dictionary will not pickup the second instance of the form. I don't know any way of finding all open forms. This shouldn't be a trick as A5 knows what is open, but I don't know of any tools where we can get this info.

                Anyone out there know of a way?

                Good luck,
                Jim




                Comment


                • #9
                  RE: Closing forms

                  Never could get any of the above to work the way I envisioned.

                  However, :A5.close() does seem to close EVERYTHING - at least, I have had no errors when shutting down my server if
                  I closed the application (database) using it.

                  Thanks -

                  Lowell

                  Comment


                  • #10
                    RE: Closing forms

                    Spoke too soon - A5.close() produces an error, have to reboot each time.

                    Lowell

                    Comment


                    • #11
                      RE: Closing forms

                      I have problems with a5.close() too.
                      Peter
                      AlphaBase Solutions, LLC

                      Peter@AlphaBaseSolutions.com
                      https://www.alphabasesolutions.com


                      Comment


                      • #12
                        RE: Closing forms

                        Peter:

                        Are you running Windows 2000 or ME or Win 98SE?

                        I never had a problem with A5.Close() under NT but have had a number of annoying issues under Win 2K. In th case of A5.Close() I found that when run at the end of certain scripts A5 crashed hard.

                        I ended up having to separate the A5.Close out into the oninit of a form that was called just for that purpose.

                        Finian
                        Finian

                        Comment


                        • #13
                          RE: Closing forms

                          Finian - running WIN98 - I have stopped using this. Finaly got a routine to find/close all forms.

                          Thanks
                          Lowell

                          Comment


                          • #14
                            RE: Closing forms

                            Finian:

                            Win95/98. A5.close() crashes hard aboout half the time in an automatic network shutdown script. Your idea is worth a try.



                            PS I have the fantasy (maybe not?) that ver. 5 will cure many of these little glitches.
                            Peter
                            AlphaBase Solutions, LLC

                            Peter@AlphaBaseSolutions.com
                            https://www.alphabasesolutions.com


                            Comment

                            Working...
                            X