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

topparent.close not closing form

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

    topparent.close not closing form

    Greetings all

    I have a simple table that is displayed in an embedded browse to the user. If the user wishes to edit one of the records - they highlight it and press a "Change Record" button. This opens an edit form (modal). After making the needed corrections the user presses a "Save and Close" button. My problem is that the record gets saved properly and the user is returned to the calling form (as they should be). However, the screen they used to edit the record stays open in the Alpha bar showing the open windows in the app. Below is relevant part of the "Save and Close" button.

    Anyone have any ideas?

    Thanks,

    Jeff

    topparent.command("RECORD_COMMIT")
    '**********************************************
    'Close current form or browse window.
    DIM mode as c
    mode = parentform.mode_get()
    'If the form is in Enter or Change mode, first save the changes before closing the form
    if mode = "ENTER" .or. mode = "CHANGE" then
    parentform.commit()
    'Check to see if the record was successfully saved
    if parentform.mode_get()<>"VIEW" then
    ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
    end
    end if
    end if
    'Close the form
    topparent.close(.f.)

    #2
    Re: topparent.close not closing form

    Originally posted by jkletrovets View Post
    Greetings all

    I have a simple table that is displayed in an embedded browse to the user. If the user wishes to edit one of the records - they highlight it and press a "Change Record" button. This opens an edit form (modal). After making the needed corrections the user presses a "Save and Close" button. My problem is that the record gets saved properly and the user is returned to the calling form (as they should be). However, the screen they used to edit the record stays open in the Alpha bar showing the open windows in the app. Below is relevant part of the "Save and Close" button.

    Anyone have any ideas?

    Thanks,

    Jeff

    topparent.command("RECORD_COMMIT")
    '**********************************************
    'Close current form or browse window.
    DIM mode as c
    mode = parentform.mode_get()
    'If the form is in Enter or Change mode, first save the changes before closing the form
    if mode = "ENTER" .or. mode = "CHANGE" then
    parentform.commit()
    'Check to see if the record was successfully saved
    if parentform.mode_get()<>"VIEW" then
    ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
    end
    end if
    end if
    'Close the form
    topparent.close(.f.)
    I think the issue must be that at the time the save and close button is pressed

    topparent.close(.f.)

    is referencing the calling form, not the visible form. Try changing this to

    parentform.close(.f.)
    There can be only one.

    Comment


      #3
      Re: topparent.close not closing form

      Thanks Stan

      I just tried that and got the same problem. In the mean time I had played with some action scripting to close a window and not a form. With the following code it works but I don't really understand what is going on. Does this make any sense to you?

      Thanks Jeff

      ******************
      topparent.command("RECORD_COMMIT")
      '**********************************************
      'Close current form or browse window.
      DIM mode as c
      mode = parentform.mode_get()
      'If the form is in Enter or Change mode, first save the changes before closing the form
      if mode = "ENTER" .or. mode = "CHANGE" then
      parentform.commit()
      'Check to see if the record was successfully saved
      if parentform.mode_get()<>"VIEW" then
      ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
      end
      end if
      end if
      'Close the form
      topparent.close(.f.)
      '*************************************************

      'Close the current window.
      'check that you are in a window
      if is_object(topparent.this) then
      topparent.close(.f.)
      end if

      Comment


        #4
        Re: topparent.close not closing form

        Hi, I don't mean to butt in but as Jeff is opening a modal form(dialog) doesn't this mean he Also has to close that form as the last piece of code in his script...usually placed right after the script that first opens the form? Otherwise the form is simply hidden from view (still in memory) when closing it from the form itself?


        dim window_to_close as c
        window_to_close = "Your_Form_Name"
        dim tempObj as p
        tempObj = obj(window_to_close)
        if is_object(tempObj) then
        tempObj.close()
        end if

        Or even - pointer will vary--have to know the correct one

        if is_object(varP_Your_Form_Name) = .t. then varP_Your_Form_Name.close()
        end if

        Mike
        Last edited by MikeC; 12-08-2006, 01:08 AM.
        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


          #5
          Re: topparent.close not closing form

          Hi Mike

          Thanks for the reply. I tried the code you posted and it works to close me out of the form and return to the main calling form with the embedded browse(same as my original code). I am calling the form as a hidden dialog since the user presses a change button on the main form - this allows me to bring up the AddEdit form and puts it into change mode for the user. The code below is the xbasic from action scripting that closes a form when you choose a specific name for the form and this also accomplishes what I need. So I have 2 solutions that work but I am trying to understand why the simple topparent.close or parentform.close won't work in this instance? Any ideas?

          Thanks again,

          Jeff


          ***************
          'Close current form or browse window.
          DIM window_to_close as C
          window_to_close = "PhotoType_AddEdit_frm"
          DIM varP_Window as p

          'If the window name was specified without a leading ":", then add it.
          if left(alltrim(window_to_close),1) <> ":" then
          window_to_close = ":"+alltrim(window_to_close)
          end if

          'Get a pointer to the specified window
          varP_Window = obj(window_to_close)
          'Check if the specified window really exists
          if .not. is_object(varP_Window) then
          ui_msg_box("Error","Can not close the window 'PhotoType_AddEdit_frm' because it is not open.",UI_STOP_SYMBOL)
          end
          else
          'Check to see that the object supports the "close()" method
          if .not. varP_Window.has_method("close") then
          ui_msg_box("Error","Can not close 'PhotoType_AddEdit_frm' because it is not a window.",UI_STOP_SYMBOL)
          else
          'The window does exits, so close it
          'Check to see that the object supports the "mode_get()" method
          if varP_Window.has_method("mode_get") then
          'Save any unsaved data before closing the window
          DIM mode as c
          mode = varP_Window.mode_get()
          if (mode = "ENTER" .or. mode = "CHANGE") then
          varP_Window.commit()
          'Check to see if the record was successfully saved
          if varP_Window.mode_get()<>"VIEW" then
          ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
          end
          end if
          end if
          end if
          'Close the window
          varP_window.close(.f.)
          end if
          end if

          Comment


            #6
            Re: topparent.close not closing form

            Jeff,
            If I understand correctly you are using the parentform.close() and topparent.close from the hidden dialog form itself...this only serves to close the form from view but it is still in memory which allows your calling button (Change Record) script from the original form to perform additional actions once the dialog is closed in this way---any script that comes after the dialog's windows opening that is on your original calling button (change record) is not performed until it is closed. So as the dialog form is still in memory it has to be closed completely and hence my code which could be placed on the Change Record button's script after the window is shown---and therefore will not be performed until after the initial closing from the dialog form. It should be after any script that you need performed that uses the modal form's info.

            Mike
            Last edited by MikeC; 12-08-2006, 11:17 AM.
            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


              #7
              Re: topparent.close not closing form

              Hi Mike,

              You, in fact, did understand exactly what I was doing! That works just as you said! Thank you! I now see what was going on.

              Thanks again....

              Jeff

              Comment


                #8
                Re: topparent.close not closing form

                Glad I could help Jeff.

                Obviously Stan must have missed it when you said "modal" in your original question as his explanation of what is happening would have been much more elegant than mine! :-) ....and as a novice it is not very often I am able to add to a solution when one of the experts has responded so made my day as well!! LOL

                Mike
                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

                Working...
                X