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

Button Saves when Canceling

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

    Button Saves when Canceling

    I have an embedded browse on a form that is controlled by buttons for save,edit,enter,cancel. The button for cancelling changes (new record or edit)saves the changes change while executing the script. The Xbasic function is: parent:BrwsName.cancel()

    When I press the Cancel button on the A5 menu bar, it works, but when the same function is put into a script it behaves like a save. I have even tried using send_keys {ESC} and the program still saves the changes or the new record. I'm stumped.

    Any suggesstions?

    Thanks

    Alex
    Alex Levy
    Tampa, FL

    #2
    RE: Button Saves when Canceling

    Try... sys_send_keys("{esc}")
    efs

    Comment


      #3
      RE: Button Saves when Canceling

      Yes, that is what I mean. Actually, the action scripting editor has a Send Key option.
      Alex Levy
      Tampa, FL

      Comment


        #4
        RE: Button Saves when Canceling

        Alex

        What is probably happening is that the changes are saved automatically when you move focus off the browse to push the button. If you use the toolbar, focus will stay on the browse. Actually, if you have cancel options on the toolbar, why bother with a button at all?

        Jerry

        Comment


          #5
          RE: Button Saves when Canceling

          I think that is what is happening. The Cancel button performs other functions and sets properties on the form.

          Having a cancel button is consistent with the design of the application which has enter, edit, delete, & save buttons.

          Hopefully there is a workaround to this.
          Alex Levy
          Tampa, FL

          Comment


            #6
            RE: Button Saves when Canceling

            Alex,

            This may be another instance where doing the data entry in a browse is not the best choice. Why not popup a separate form and gain better control ?

            -- tom

            Comment


              #7
              RE: Button Saves when Canceling

              Alex

              Ther is a workaround that does work, but it is a little convoluted and takes adding code in a couple different places. The idea is to prevent the save whn focus is moved off the browse. The first point is that the CanArrive event fires before the browse loses focus. The second point is that you can trap the save by using the CanSaveRecord event in field rules for the table in the browse.

              First, I create a global logical variable by opening the table structure and creating it there. For example, I have a logical variable called "save" and its default value is .T.

              On the CanSaveRecord event for the tqable I have the following

              if save = .F.
              save =.T.
              cancel()
              end
              end if

              This will cancel any save if the global is set to false. On the CanArrive button for the Cancel button, I have the following

              tbl = table.current()

              if tbl.mode_get()>0
              save=.F.
              parentform.commit()
              save=.T.
              cancel()
              end if

              This cancels the save before the button is actually pushed.

              Jerry

              Comment


                #8
                RE: Button Saves when Canceling

                Jerry, Thanks for the bit of code. I've been having this problem also and figured it was me. This workaround will be useful but it seems like this would be something for Selwyn to fix in the next release.

                Thanks
                Russ

                Comment


                  #9
                  RE: Button Saves when Canceling

                  Russ

                  I actually don't see that this is something that needs "fixed". If you consider that anytime you move focus off a record, either as a single record on a form during a fetch or from a record on a browse, something has to happen. The record cannot just be left in enter or change mode. Placing focus on a button from a browse requires something to happen to the record in edit mode, since you could just place focus onto another record. You are, in a sense, fetching another record.

                  Tom has the right idea. If you are determined to use your own buttons, perhaps a browse should be for viewing only and all data entry should be from a form for an individual record. Then focus can't leave that record.

                  My preference is to use the tools Windows provides in the form of menus and toolbars. Most users are very familiar with using menus and toolbars and they work well in most cases and don't have the loss of focus issue. Some younger users never saw a DOS program and find some buttons redundant carryovers from old technology. Actually, a toolbar is just a series of stylish buttons in a common row. I find it just as easy to build a custom toolbar as it is to design a bunch of buttons.

                  Sometimes I do use the occasional button for a specific purpose (or on an a dialog that doesn't have menus or toolbars) but I try to avoid them as much as possible. The code I posted was from a series of buttons on a form opened as a dialog that simulate and look like a toolbar.

                  Jerry

                  Comment


                    #10
                    RE: Button Saves when Canceling

                    One of the by products of Alpha Five is that such control allows as many programming styles as there are users. Most of the time I would agree with that a new pop-up window instead of editing in a browse ( is a better design with more control, especially being a student of Tom Cone. :) But this is an application where the user needs to be able to look at all the entries simultaneously and edit them on the fly and a window would be distracting.

                    I was looking for a way to make Alpha Five behave like Alpha Four, Ver 6 does. The workaround suggested by Jerry does work. I appreciate the help.

                    Alex Levy
                    Alex Levy
                    Tampa, FL

                    Comment


                      #11
                      RE: Button Saves when Canceling

                      I might have spoken too soon. It worked once then went back to saving the record.

                      Alex
                      Alex Levy
                      Tampa, FL

                      Comment


                        #12
                        RE: Button Saves when Canceling

                        Most of the time if using a browse I use the on doubleclick to edit a record or a button for new ones. I think it is simpler to have the primary buttons on the form and less used stuff on the toolbar, and more general stuff on the menu bar. Just my preferences though.

                        I do occasionally use a browse for data entry where it makes sense as it can be a lot quicker. For instance in Accts reveivable where an amount and check number is all that is necessary for an entry it seems a lot of wasted motion to go to a form just for 2 bits of data. This I keep in a browse. It really isn't too much of a problem as cancel seems to work the way I have it set up. I send an {esc} then cancel then set to modal. I guess I spoke too soon when I said this was a problem. My memory, being rather suspect at this point only recalled the problem with it, not the solution.

                        Russ

                        Comment


                          #13
                          RE: Button Saves when Canceling

                          Alex

                          I was a little hasty in posting the code. The application I took it from has other things going on. A much simpler method is to eliminate the code on the CanSaveRecord, forget the global variable, and just use this on the cancel button CanArrive event

                          if topparent.mode_get() "VIEW"
                          topparent.cancel()
                          end if

                          This will cancel the save before the button is pushed and allow the button to operate normally. The only oddity occurs if the user tabs to the button, but doesn't "push" it. The save is still cancelled, but then almost any method you use will do the same.

                          Jerry

                          Comment


                            #14
                            RE: Button Saves when Canceling

                            This time it works like I want it to and have tested it a few different ways. I did modify it for my application. I had to add a line of code "this.push()" or else the button would halt and had to be pushed again.

                            I also forgot to mention that this is a tabbed form with several browse tables. You have to specify the browse in which to .cancel() or very unpredictable rsults will occur.

                            With those adjustments it works well. Thanks again for your help.

                            Alex
                            Alex Levy
                            Tampa, FL

                            Comment

                            Working...
                            X