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

Buttons on a form

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

    Buttons on a form

    I have a form with buttons that have attached hot keys. Example: Save Changes would have the letter v underlined and the button would execute using the keys Control-v.

    What's happening is that if the user holds the key combination pressed for more than 1 millisecond, the button will execute more than once.

    I've inclued the this.disable(), this.enable().

    I guess what I need is a way of disabling the button if the user holds the key combination pressed, resetting itself after the keys are released.

    TIA

    Ron
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    RE: Buttons on a form

    Ronald,

    In my own Save button scripts I usually include code at the beginning of the script to check the mode of the form or table. I cancel() if form is not in enter or change mode. Otherwise I commit() the changes. Once committed the mode of the form will change. Usually I display a message that there's nothing to save. Perhaps something of the sort would help here.

    -- tom

    Comment


      #3
      RE: Buttons on a form

      Tom,

      Thanks for your response, but your missing my point. The save button was just for an example of what I am trying to do.

      I have another button that scrolls through a series of records. If the user holds the hot key for more than 1 millisecond, records are jumped over instead of scrolling through them one at a time. The user should not have to have such an extremely light/short touch.

      I'm doing this exact same proceedure in Alpha 4 and it works just fine.

      Ron
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #4
        RE: Buttons on a form

        try this:
        declare for your application a global variable:
        busy - logical
        then on the onpush event for the button put this
        if busy
        end
        end if
        busy=.t. 'set it so the script will only fire once
        'your code goes here
        then at the ondepart event for the button put:
        busy=.f. 'releasing the "freeze"

        you may find this very useful in other areas, too.
        Cole Custom Programming - Terrell, Texas
        972 524 8714
        [email protected]

        ____________________
        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

        Comment


          #5
          RE: Buttons on a form

          on rereading the question, let me amend my approach
          at the onkey event for the form
          experiment with this: (I say experiment, as I've never had this particular problem before.)
          if parentform.active()="button1"
          if a_user.key.value="{^V}"
          a_user.key.handled=.t. 'this will disable any other automated uses of the combination, as by Alpha
          if a_user.key.event="up"
          'your code goes here
          end if
          end if
          end if
          'the idea here is that the script will only fire on the "up" event
          Cole Custom Programming - Terrell, Texas
          972 524 8714
          [email protected]

          ____________________
          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

          Comment


            #6
            RE: Buttons on a form

            Martin,

            Both of your solutions are good ones. The first is outlined in the "What's New in Alpha Five V4.5.pdf" under ""maximum stack depth exceeded" error message. This was developed by forum users and picked up by Alpha. This works very well in scripts.

            The second has a variation that was suggested by Selwyn in response to a similar problem with the OnKey event. To trap the problem there, try

            select
            case a_user.key.value = "{F1}".and.a_user.key.event = "down"
            a_user.key.handled = .T.
            ' your code here
            end select

            For some reason, putting the value and event tests on the same line fixes a number of odd behaviors. This is particularly true with trapping "F1". Other methods will fire another help file, but the Alpha help file will also sometimes fire.

            Depending on how the button is operated, either method should eliminate the multiple firing.

            Jerry

            Comment


              #7
              RE: Buttons on a form

              Jerry - thanks - maybe that explains why I can't trap F1 - will try it
              Cole Custom Programming - Terrell, Texas
              972 524 8714
              [email protected]

              ____________________
              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

              Comment


                #8
                RE: Buttons on a form

                Hi Guy,

                I've been trying your examples and I'm not able to get anything to work.

                I'm an Alpha 4 user trying to learn Alpha 5. I believe I understand what you're doing.

                One problem is that I don't know the proper syntax for the keys, CTRL+h.

                Is it "{CTRLH}", "{CTRL+H}", "{^H}".
                I can't find this in the manuals.
                Alpha 4 had all the key combinations listed.

                TIA

                Ron
                Alpha 5 Version 11
                AA Build 2999, Build 4269, Current Build
                DBF's and MySql
                Desktop, Web on the Desktop and WEB

                Ron Anusiewicz

                Comment


                  #9
                  RE: Buttons on a form

                  All of the key combinations are listed in the xbasic manual under sys_send_keys() along with examples. One thing you are already finding is that A5 is not at all like A4. I made the transition some time ago and basically had to relearn and rethink just about everything. It's about like trying to fly an airplane by using what you learned about riding a bicycle. Both are transportaion, but that is about the only similarity. Just like an airplane, V5 is very fast and powerful, but it is more complex. Hang in there, "flying" is more fun.

                  Jerry

                  Comment


                    #10
                    RE: Buttons on a form

                    Hi Martin,

                    I can't seem to get this code to work.

                    The debugger says the variables don't exist. If I understand it correctly, these variables (a_user.) are suppose to be generated automatically. Or do they have to be declared?

                    Ron
                    Alpha 5 Version 11
                    AA Build 2999, Build 4269, Current Build
                    DBF's and MySql
                    Desktop, Web on the Desktop and WEB

                    Ron Anusiewicz

                    Comment


                      #11
                      RE: Buttons on a form

                      A_user.key.value() only works in the OnKey event. If you use it in a script on a button for instance, you will get an error message. The syntaxt is explained in the xbasic manual under events for forms (page 79 in my copy)

                      Jerry

                      Comment


                        #12
                        RE: Buttons on a form

                        Ronald
                        I think the problem you are experiencing has to some what with the Repeat delay in the windows Keyboard properties settings,
                        Here is an example of the OnKey event which I always use and never had any problems with it

                        select
                        case left(a_user.key.value,1)"{"
                        goto finish
                        case a_user.key.value = "{F2}"
                        a_user.key.handled = .T.
                        goto addinv
                        case a_user.key.value = "{F3}"
                        a_user.key.handled = .T.
                        goto tabchange
                        case a_user.key.value = "{F5}"
                        a_user.key.handled = .T.
                        goto lookup
                        case a_user.key.value = "{F7}"
                        a_user.key.handled = .T.
                        goto Find
                        case a_user.key.value = "{F10}"
                        a_user.key.handled = .T.
                        goto save
                        case a_user.key.value = "{F8}"
                        a_user.key.handled = .T.
                        goto cancel
                        case a_user.key.value = "{F9}"
                        a_user.key.handled = .T.
                        goto close
                        case a_user.key.value = "{F12}"
                        a_user.key.handled = .T.
                        goto print
                        case else
                        goto finish
                        end select

                        lookup:
                        if a_user.key.event = "down"
                        if Itemsbrowse.Active() = "model_no"
                        .and. browse_inuse = .t.
                        f=form.view("prod_lu_e","dialog")
                        Last_button = f.last_pressed()
                        if Last_button = "ENTER"
                        n_item = f:model_no.value
                        f.close()
                        parentform:itemsbrowse:model_no.value=n_item
                        end if
                        else
                        sys_send_keys("{Alt-Down}")
                        end if
                        end if
                        goto finish

                        Find:

                        if a_user.key.event = "down"
                        sys_send_keys("{Alt-E}")
                        end if
                        goto finish

                        tabchange:

                        if a_user.key.event = "down"
                        tno = Tabbed1.Tab_Get()
                        if tno = 1
                        Tabbed1.Tab_Set(2)
                        else
                        Tabbed1.Tab_Set(1)
                        end if
                        end if
                        goto finish


                        cancel:

                        if a_user.key.event = "down"
                        code=UI_YES_NO+UI_QUESTION_SYMBOL+
                        UI_FIRST_BUTTON_DEFAULT
                        note = "Are you sure you lose your changes?"
                        mode = parentform.mode_get()
                        if mode = "ENTER" .or. mode = "CHANGE"
                        response = ui_msg_box("EZ Link",note, code)
                        if response = UI_YES_SELECTED
                        parentform.cancel()
                        end if
                        end if
                        end if
                        goto finish

                        close:

                        if a_user.key.event = "down"
                        code=UI_YES_NO_CANCEL+UI_QUESTION_SYMBOL+
                        UI_FIRST_BUTTON_DEFAULT
                        note = "SAVE CHANGES BEFORE LEAVING?"
                        mode = parentform.mode_get()
                        if mode = "ENTER" .or. mode = "CHANGE"
                        response = ui_msg_box("EZ Link",note, code)
                        if response = UI_YES_SELECTED
                        parentform.commit()
                        parentform.close()
                        elseif response = UI_NO_SELECTED
                        parentform.cancel()
                        parentform.close()
                        elseif response = UI_CANCEL_SELECTED
                        cancel()
                        end
                        end if
                        else
                        parentform.close()
                        end if
                        end if
                        goto finish

                        save:

                        if a_user.key.event = "down"
                        parentform.commit()
                        end if
                        goto finish
                        .....................


                        You could find the key codes in the Xbasic.pdf page 335 (sys_send_keys())

                        Daniel Weiss

                        Daniel Weiss
                        EZ Link Software

                        Comment


                          #13
                          RE: Buttons on a form

                          Ronald,

                          From the very long to the very short this

                          board has it all...

                          Did you include an "end" at the end of your script?

                          Comment


                            #14
                            RE: Buttons on a form

                            First, I want to thank everyone for their help. Thank You.

                            I'm not doing too well. I have spent hours messing with this dam thing.

                            Well, I believe the problem is a bug in Alpha 5.

                            a_user.key.value = does not work with: "{ctrl-H}" or "{^H}".

                            It does work with "{f12}".

                            Ron
                            Alpha 5 Version 11
                            AA Build 2999, Build 4269, Current Build
                            DBF's and MySql
                            Desktop, Web on the Desktop and WEB

                            Ron Anusiewicz

                            Comment


                              #15
                              RE: Buttons on a form

                              if a_user.key.value="{^H}" .and. a_user.key.event="down"
                              a_user_key.handled = .t.
                              ui_msg_box("","Ctrl-H TEST")
                              end
                              end if
                              'a_user.key.handled=.t. stops any other action that would be picked up by Alpha if it uses this key combination
                              'a_user.key.event="down" is used because as soon as the user releases the key it renders the if false - for example, if you say on a form:

                              if a_user.key.value="{ESC}"
                              parentform.cancel(); parentform.close()
                              end
                              end if
                              and this takes you back to another form that has the same onkey script it will fire again closing that form also!

                              'end is put in there as you may have a number of other onkey scripts or other code that you don't want to fire


                              I just tried the script and it defenitely works.
                              Cole Custom Programming - Terrell, Texas
                              972 524 8714
                              [email protected]

                              ____________________
                              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                              Comment

                              Working...
                              X