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

onkey event for form

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

    onkey event for form

    Not sure if I forgot my sugar medicine but this is beating me crazy. Thanks in advance!
    on a form:
    catch the onkey for ctrl and v combination and halt it.

    I have tried every variant I can find for on_key and none even came close.
    Searched the forum as well with no joy.

    Just need it to stop the ctrl+v from happening and a ui_message box.
    Dave Mason
    [email protected]
    Skype is dave.mason46

    #2
    Re: onkey event for form

    IF (a_user.key.value = ui_keycode_normalize("{Ctrl-V}") ) THEN
    'set a_user.key.handled = .t. to prevent the key stroke being passed on to the Form
    a_user.key.handled = .t.
    IF a_user.key.event = "down" THEN
    ui_msg_box("","User pressed CTRL")
    END IF
    END IF
    There can be only one.

    Comment


      #3
      Re: onkey event for form

      Thanks Stan

      Gets error:

      Script:OnInit line:9
      IF (a_user.key.value = ui_keycode_normalize("{Ctrl-V}") ) THEN

      Not found
      a_user not found.

      Same problem I was having

      Where does the "a_user.key.vakue" come from?
      Dave Mason
      [email protected]
      Skype is dave.mason46

      Comment


        #4
        Re: onkey event for form

        Why not create an event for the Crt+V like close the window, that will stop people, lol.
        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

        Comment


          #5
          Re: onkey event for form

          Hi Charles,

          It is for a client and I can't do that.

          I just wish it to stop the pasting and pop up a message box.
          Dave Mason
          [email protected]
          Skype is dave.mason46

          Comment


            #6
            Re: onkey event for form

            well, it's an idea. Perhaps the event can trigger a msg box - and perhaps reset the form? that would stop users from doing that...I get that you need to be professional but you need to stop them too!
            NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

            Comment


              #7
              Re: onkey event for form

              Code:
              'Date Created: 22-Jul-2015 07:02:22 AM
              'Last Updated: 22-Jul-2015 07:02:22 AM
              'Created By  : GGandhi344
              'Updated By  : GGandhi344
              IF a_user.key.value = "{^v}" THEN
                  a_user.key.handled = .t.
                  IF a_user.key.event = "down" THEN
                      ui_msg_box("","user pressed control v")
                  END IF
              END IF
              I just tested this and the message box pops up every time, you can of course modify to be nothing.
              try and take a look.
              as far as a_user.key that is what windows gets before passing on to the form, as per documentation.
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment


                #8
                Re: onkey event for form

                Worked when I tested it last night in V11, may be different in V12.

                Originally posted by DaveM View Post
                Thanks Stan

                Gets error:

                Script:OnInit line:9
                IF (a_user.key.value = ui_keycode_normalize("{Ctrl-V}") ) THEN

                Not found
                a_user not found.

                Same problem I was having

                Where does the "a_user.key.vakue" come from?
                A_USER P
                Provides information about the current window and keyboard. See Object Events.
                http://wiki.alphasoftware.com/System+Variables
                Last edited by Stan Mathews; July 22, 2015, 09:28 AM.
                There can be only one.

                Comment


                  #9
                  Re: onkey event for form

                  This just one of a bunch of variations tried.

                  Code:
                  dim a_user as P
                  a_user = "" ' a_user.key.value = "^v"  and others
                  
                  IF a_user.key.value = "{^v}" THEN
                      a_user.key.handled = .t.
                      IF a_user.key.event = "down" THEN
                          ui_msg_box("","user pressed control v")
                      END IF
                  END IF
                  with every press of ctrl+v the paste is done in the form
                  Nothing seems to stop it.
                  Yes, I am on the latest version of windows 8.1 and alpha v12. - Maybe that is the problem?
                  Dave Mason
                  [email protected]
                  Skype is dave.mason46

                  Comment


                    #10
                    Re: onkey event for form

                    dim a_user as P
                    a_user = "" ' a_user.key.value = "^v" and others
                    No, probably causing the problem. A_user is an Alpha system variable. You don't/shouldn't dim it in your script.
                    There can be only one.

                    Comment


                      #11
                      Re: onkey event for form

                      On a fresh restart?

                      ?a_user
                      ERROR: Variable "a_user" not found.

                      ?a_user.key
                      ERROR: Not found
                      a_user not found.
                      Dave Mason
                      [email protected]
                      Skype is dave.mason46

                      Comment


                        #12
                        Re: onkey event for form

                        Are you trying the code in an onkey event? It will not work in the interactive. It is meaningless in the interactive.
                        There can be only one.

                        Comment


                          #13
                          Re: onkey event for form

                          Originally posted by DaveM View Post
                          On a fresh restart?

                          ?a_user
                          ERROR: Variable "a_user" not found.

                          ?a_user.key
                          ERROR: Not found
                          a_user not found.
                          OnKey


                          Whenever a key is pressed while the form has focus. Variables set:

                          A_USER.KEY.VALUE contains the key (key is same format that is used by SYS_SEND_KEYS() i.e. A is the character A, {F1} is the F1 key.

                          A_USER.KEY.EVENT is either up or down or repeat depending whether the key is being pushed, held down or released.

                          A_USER.KEY.HANDLED is set to .T. if the key was handled by the OnKey event. If you set this variable to .T., then the keystroke is not passed through to Alpha Five (i.e. it is eaten by the OnKey script).

                          For example, the following OnKey script will close Alpha Five when the user presses Alt-X:

                          If (A_USER.KEY.VALUE = "{%X}") then

                          If (A_USER.KEY.EVENT = "down") then

                          :a5.close()

                          End if

                          End if

                          TIP : To see how Alpha Five represents different key combinations, define the following OnKey script for a form, then open the trace window and try out different key combinations:

                          trace.writeln("key: " + A_USER.KEY.VALUE + " event: " + A_USER.KEY.EVENT)
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment


                            #14
                            Re: onkey event for form

                            Onkey event code.

                            debug(1)
                            IF a_user.key.value = "{^v}" THEN
                            a_user.key.handled = .t.
                            IF a_user.key.event = "down" THEN
                            ui_msg_box("","user pressed control v")
                            END IF
                            END IF

                            Then examine a_user.key.value in the expression....value area at the bottom of the debugger window.
                            Last edited by Stan Mathews; July 22, 2015, 04:48 PM.
                            There can be only one.

                            Comment


                              #15
                              Re: onkey event for form

                              Originally posted by Stan Mathews View Post
                              Are you trying the code in an onkey event? It will not work in the interactive. It is meaningless in the interactive.
                              I did not know that.
                              Dave Mason
                              [email protected]
                              Skype is dave.mason46

                              Comment

                              Working...
                              X