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

possible error with multiple instances of a form

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

    possible error with multiple instances of a form

    i have a form which is the main switchboard for my app.

    users leave and come back to this form many times during their use of the app.

    each time they return to the switchboard an incremental number is added to the forms name tab at the bottom (hope you know what i mean).

    so first time open, the forms name is switchboard, then the next visit its switchboard1 and so on.

    the switchboard is closed each time they leave and then reopened. when reopened i have opened the previous instance.

    there are no obvious errors at present with this, but i feel that maybe the form is not being removed from the memory when closed and could be the cause of some poor performance i am experiencing or i may encounter index issues.

    any thoughts, fixes etc...

    #2
    Re: possible error with multiple instances of a form

    Richard, this would worry me, too. Here are a couple of ideas for you to check or try:

    a) is the main switchboard form opened as dialog? Change it to a normal form instead. Does the problem go away? If so, review the help file discussioin of the form open as dialog sequence. Closing forms opened in this way requires special handling.

    b) consider leaving the main switchboard form open continuously. It's based on a dummy table, right? You can hide it instead of close it if you need to remove it from screen. I often leave it on screen and arrange for it to be covered when other forms open.

    The numerical suffix that's being appended to the form name suggests that Alpha thinks the form is still open.

    Comment


      #3
      Re: possible error with multiple instances of a form

      tom,

      the form is in normal mode. its based upon set as it acts as the users home page and houses their new cases, tasks and diary appointments. the form has a filter applied based upon the current logged on user.

      i did look through the help files and msg board to try to find some info on clearing a form from memory but couldn't find anything.

      ill probably take your idea on leaving the form open at all times if i cant find a fix.

      thanks

      richard

      Comment


        #4
        Re: possible error with multiple instances of a form

        the switchboard is closed each time they leave and then reopened. when reopened i have opened the previous instance.
        This should not happen if the form is actually closed.
        How do you close the form? and
        How do you open it?

        Comment


          #5
          Re: possible error with multiple instances of a form

          im using action scripting, using the close form script.

          and the same when opening.

          Comment


            #6
            Re: possible error with multiple instances of a form

            I can't overstate my disdain (although unjustified) for Action Scripting and beg everyone forgiveness.

            How about a simple xbasic script that says:
            Code:
            if is_object("form_name")
            form.show()
            form.activate()
            else
            form_name.view()
            end if
            That way you will never have more than one open instance of that form.

            Comment


              #7
              Re: possible error with multiple instances of a form

              Al,

              ill give that a try now.

              thanks

              Comment


                #8
                Re: possible error with multiple instances of a form

                tried this, but get error 'frmswitchboard doesnt exist'

                Code:
                if is_object("frmswitchboard")
                form.show()
                form.activate()
                else
                frmswitchboard.view()
                end if

                Comment


                  #9
                  Re: possible error with multiple instances of a form

                  That's because I am dyslexic:
                  if is_object("frmswitchboard")
                  frmswitchboard.show()
                  frmswitchboard.activate()
                  else
                  form.view("frmswitchboard")
                  end if

                  Comment


                    #10
                    Re: possible error with multiple instances of a form

                    One step further than Gabe's script would be to create a user function that you can use when opening any form so that it tests if the form is already open.

                    Here's one I use - which has several variations for different scenarios:

                    Code:
                     
                    function vw_frm as L(frm_name as C)
                    dim frm as p
                    frm = obj(frm_name)
                    if is_object(frm) then
                      frm.fetch_last()
                      [COLOR="Navy"]'frm.fetch_first() is the other option for an embedded browse[/COLOR]
                      frm.show()
                      frm.activate()
                    else
                      frm = :form.view(frm_name)
                      frm.fetch_last()
                      [COLOR="navy"]'frm.fetch_first() [/COLOR]
                    end if
                    end function
                    This will open the form or switch to the form if it is already open and go to the last record in the current sort order specified in the form or the query in place. If you want to use it for a form with an embedded browse, I have a variation vw_frm_1st() which goes to the first record so the browse appears full when open. To use either one just type in:

                    vw_frm("myformnamehere")
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                      #11
                      Re: possible error with multiple instances of a form

                      i tried Al's revised code and i also changed the action scripting on closing the form to xbasic. the final line was parentform.close(.f.). i changed this to parentform.close(.t.) and this seems to be taking the form out of memory.

                      this still hasnt fixed the issue, if i open the app the frmswitchboard opens based upon the code i have in my autoexec. if i switch between the control panel and frmswitchboard using the name tabs at the bottom, each time i go back to the frmswitchboard, the form name increments by 1.

                      the frmswitchboard isnt being closed, i am simply switching views.

                      here is my autoexec code
                      Code:
                      if is_one_of("Adviser", user_groups()) then
                      form.load("frmswitchboard")
                      frmswitchboard:tables:casefile.filter_expression = "isnotblank(\"leaddate\") .AND. isblank(\"iddissuedate\")"
                      frmswitchboard:tables:casefile.query()
                      frmswitchboard.show()
                      
                      else if is_one_of("New Business", user_groups()) then
                      form.load("frmswitchboard")
                      frmswitchboard:tables:casefile.filter_expression = "isnotblank(\"submit_nb\") .AND. isblank(\"submit_cm\")"
                      frmswitchboard:tables:casefile.query()
                      frmswitchboard.show()
                      
                      else if is_one_of("Case Manager", user_groups()) then
                      form.load("frmswitchboard")
                      frmswitchboard:tables:casefile.filter_expression = "isnotblank(\"submit_cm\") .AND. isblank(\"cm_start\")"
                      frmswitchboard:tables:casefile.query()
                      frmswitchboard.show()
                      end if
                      here is a filter on the forms 'oninit' event
                      Code:
                      parentform:tables:Tstaff.filter_expression = "employeename = "+s_quote(user_name())
                      parentform:tables:Tstaff.order_expression = ""
                      parentform:tables:TStaff.query()
                      and i think i may have just found the culprit -

                      im the onactivate event i have an action to run the autoexec script. i did this to ensure that the filters set in the autoexec were applied when the form opens.

                      if this is the culprit, how would i ensure that these filters are applied each time the form is opened without opening another instance of the form.

                      also, if a user is active in more than one of the user groups in the auto exec, will this open more than 1 instance of the form or will the code stop once a condition has been met.

                      thanks for all the help so far.

                      Comment


                        #12
                        Re: possible error with multiple instances of a form

                        If you run the autoexec each time you activate the form, you will load a new instance of the form. Instead of that, why not put the filtering on the activate event?

                        Tom

                        Comment


                          #13
                          Re: possible error with multiple instances of a form

                          I agree with Tom. The Autoexec is where the first instance of the form should be loaded with the program and that query determines the filter for the casefile table based on the user group of the logged in user. Then as the form opens an additional filter is applied to the tstaff table for the user's name. In this session do other users share this pc? If not then the filters you have applied should remain valid as long as the program is open. And when the form loads, it sounds as though it ought to stay open throughout the session. The Deactivate and Onactivate events for the form can also be used to minimize or restore the form and refresh it if needed without having to close it or reopen it. You could also set the form as wallpaper and give it a zorder of "bottom". However you mention accessing the control panel - are you giving access to the control panel to your users too?
                          Robin

                          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                          Comment


                            #14
                            Re: possible error with multiple instances of a form

                            thanks tom,

                            ill do this.

                            robin, users dont get to see the control panel, only me. users dont share pc's either. i dont mind having the form open at all times, i just thouht it
                            would be better to close it when not in use.

                            thanks to everyone again.

                            Comment


                              #15
                              Re: possible error with multiple instances of a form

                              i tired Tom's suggestion and also took out the lines of code to load and then show the form and it has fixed my problem.

                              thanks again for everyones help.

                              Comment

                              Working...
                              X