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

Attach a script to the Esc key

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

    Attach a script to the Esc key

    Can someone show me how to attach a script to the Esc key. I have done this and it isn't acting the way I had intended it to. So if someone could write a sample script I would appreciate it. Also, is there anyway to disable the Esc key.

    Thanks
    Chuck

    #2
    RE: Attach a script to the Esc key

    Submitted By: Cal Locklin
    Date Submitted: 09/03/2001
    Email: [email protected]
    Category: Layouts

    Description: Close forms with the ESC key by using a simple OnKey function.

    Details:
    If you would like to allow the user to close a form using the ESC key, simply put the following script in the form's OnKey event:
    IF a_user.key.value = "{ESC}"
    IF parentform.mode_get() = "View"
    a_user.key.handled = .T.
    IF a_user.key.event = "down"
    parentform.close()
    END IF
    END IF
    END IF

    By adding parentform.mode_get()="VIEW", we make sure that the user maintains normal cancel functions when pressing ESC in ENTER, CHANGE, FIND, or QUERY modes. (Yes, it does have to be in a separate IF statement or it will cause an error in certain situations. Sorry, I don't recall what the error was.)
    There can be only one.

    Comment


      #3
      RE: Attach a script to the Esc key

      I have done that and I can close the form. Now I want to attach a script to the Esc key. I have also done this, but the script isn't acting the way it should. Im asking someone to give me some sample code for attaching a script to the Esc key. For example a cancel record script, or save record script. I would like to compare my script with your script to determine if I have a programming conflict somewhere else in my program.

      Thanks
      Chuck

      Comment


        #4
        RE: Attach a script to the Esc key

        Chuck,

        I don't think there is a way to write a "cancel record" script, per se.

        The method used to prevent a record from being saved is to code to the cansave event for the form in use. The script would check for some value/variable/etc and if all is not as it should be, the line

        cancel()

        is executed. If the script "sees" the proper situation, the save proceeds.
        There can be only one.

        Comment


          #5
          RE: Attach a script to the Esc key

          Is it possible to disable the Esc key. If so how?

          Comment


            #6
            RE: Attach a script to the Esc key

            simply put the following script in the form's OnKey event:

            IF a_user.key.value = "{ESC}"
            a_user.key.handled = .T.
            IF a_user.key.event = "down"
            END IF
            END IF


            would seem to me......
            There can be only one.

            Comment


              #7
              RE: Attach a script to the Esc key

              How can I get rid of the Alpha5 cancel records routine and substitute mine. I have litterally tried evrything and when I hit the ESC key while in data entry that Alpha 5 cancel comes up. Is there special code that you are using to overide it. Please advise.

              Thanks,
              Chuck

              Comment


                #8
                RE: Attach a script to the Esc key

                When I put the script above as the code for the onkey event for a form, begin typing in a field, stop and hit the escape key, nothing happens and the data entry continues.

                Thus I believe the code above is aborting the normal Alpha behavior for the escape key.

                Now what do you want to do?
                There can be only one.

                Comment


                  #9
                  RE: Attach a script to the Esc key

                  I want to attach my own cancel record script to the escape key so my customers can't see the enviroment i'm writing in. That way I can be sure no one can reverse engineer my code.

                  Comment


                    #10
                    RE: Attach a script to the Esc key

                    Are you seeing different results with the onkey escape trapping as described?

                    There is no "cancel record script" in Alpha. You can trap the escape key as described. You can put the code "cancel()" as the cansave event code and force the user to press a button to save a record, having your own code for the button which would write to the table(s) in question.

                    I came from a Foxpro dos background where one coded a "read" to wait for input and acted upon the result. If you are accustomed to something similar you really need to shift your approach and investigate event programming. You will make more and faster progress if you try to work with Alpha's methods than if you continually try to circumvent them and force Alpha to behave as if it were something else.
                    There can be only one.

                    Comment


                      #11
                      RE: Attach a script to the Esc key

                      Here is the answer to my problem. Attach this script to the Esc key to cancel a record change, and to supress any refrence to Alpha 5.

                      'Execute inline Xbasic code.
                      if a_user.key.value = "{Esc}"
                      'Cancel changes to record in Form 'Bet' .
                      DIM object_name as C
                      object_name = ":"+"Bet"
                      DIM varP_Object as p
                      'Get a pointer to the specified object
                      varP_Object = obj(object_name)
                      'Check if the specified object exists
                      if .not. is_object(varP_Object) then
                      ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
                      else
                      varP_Object.cancel()
                      end if
                      end if

                      Comment

                      Working...
                      X