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

Disable F1-F12 Keys?

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

    Disable F1-F12 Keys?

    Hi All,
    Is their a way to turn off all the F keys? I dont want a user to hit one of these keys and have alpha do something I dont want.
    Kind Regards,
    Ray Roosa
    Raylin Micro, LLC.

    #2
    Trap them with OnKey:

    If a_user.key.value="{F1}"
    a_user.key.handled=.T.
    if a_user.key.event="down" then
    end if
    end if

    If a_user.key.value="{F2}"
    a_user.key.handled=.T.
    if a_user.key.event="down" then
    end if
    end if

    Etc.

    Store the code in the code library to make it easier to apply to all forms.

    BUT there may be an easier way - i'm always prepared to bow to superior knowledge.

    Colin

    Comment


      #3
      Code:
      if left(a_user.key.value,2)="{F" 
           a_user.key.handled=.t.
           end
      end if
      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


        #4
        Martin - so simple I never thought of it.

        However, Ray might want to consider something else instead - especially if he has users who do a lot of data entry. (In other words, if your users are good typists.)

        Instead of disabling them completely:
        - leave the F1 key as the help key as defined by Windows. (with the exception noted below)
        - the F2 key is defined by Windows as the "edit this" key which moves the cursor to the end of the text. This can be handy when a user wants to add something to the end of the existing text. (Actually, it toggles between the end of the text and highlighting all text.)
        - F3 toggles the "allow edits" flag. A few of my users like to use this even if the form is not modal. They sometimes "disallow" edits when the screen will be open for awhile just to protect against accidental key presses when moving papers around, etc.
        - F4 seems to be undefined in Alpha.
        - F5 refreshes the current form. (Not used very often but it shouldn't hurt anything.)
        - F6 moves you to the next 'region' if you have any embedded browses on the form. Very handy for some users.
        - F7 seems to be undefined. (In other words, it can't hurt either.)
        - F8 toggles between browse mode and form view. This is the one I usually want to disable. See below for an explanation of what I use it for instead.
        - F9 is just a Save key. Again, this should not be a problem.
        - F10, 11, and 12 are not defined in Alpha.

        Based on the above, my solution is an OnKey script that sets up the following standards throughout my application:

        - Change the F8 key to an "Alt - DownArrow" shortcut. "Alt - DownArrow" is the Windows "shortcut" command for opening drop-downs. (Most users I know of don't think of "Alt - DownArrow" as a viable shortcut. First, they can't seem to remember it and second, they find it very awkward. Pressing the F8 key is a bit awkward at first but definitely easier because it's only one keystroke. Those who prefer can still use "Alt - DownArrow".)
        - Set the F10 key to press the "Enter_btn" button if I have one. (I.e., the "new record" button or just Ctrl-E if you don't have an Enter button. I use an Enter button when I want to do more than just a simple "New Record" command such as getting data from the current form first and/or entering data in the new record.)
        - Set the F11 key to press the "Find_btn" button if the form has one. This way they can just press F11 rather than grabbing the mouse every time. Users entering lots of data are usually very fast at keyboarding and prefer "type, type, type, type, type, type, type" - to - "type, type, type, grab the mouse, locate the Find button, click the Find button, relocate your hands on the keyboard, type, type, type"
        - Set the F12 key to activate the "Close_Form_btn". See the wierd explanation above for the reason why.
        - Set the F1 key to press the Help_btn button if there is one. Otherwise it defaults to the standard F1 action defined by Windows.

        Of course, this only talks about the "F" keys. What about the various Control keys. There are actually more of them that I consider "possibly troublesome". Here's my solution so you don't have to figure out which control keys are used:
        Code:
        IF a_user.key.value = "{^O}" 'Open form
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^E}" 'Enter Record
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^B}" 'Query by Form
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^P}" 'Print
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^Q}" 'Query Genie
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^M}" 'Mark record
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^U}" 'Unmark record
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^D}" 'Delete record
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^F}" 'Find by Form
         a_user.key.handled = .T.
         END'
        END IF
        IF a_user.key.value = "{^T}" 'Dial phone
         a_user.key.handled = .T.
         END'
        END IF
        Of course, the definition of the specific Control keys can be changed rather than simply disabled or the section for a specific key can be deleted or REMed if you prefer to leave one active.
        Last edited by CALocklin; 06-25-2006, 11:45 AM.

        Comment


          #5
          Cal, I use a similar system, too, to protect data. Do use a function or put the code in all the forms.

          Since most of my forms fall into maybe 3 types, I put the code in a function and call the one appropriate to the type of form I'm wirking with - eg:

          Code:
          FUNCTION onkey1 AS L ( )
          	on error goto errors
          	lastuse=toseconds(time()) 'timer disables app after 15 minutes non-use, forces re-logon from main menu
          	if a_user.key.value = "{esc}" then
          		a_user.key.handled=.t.
          		if a_user.key.event="down"
          			if this.mode_get() <> "view"
          				this.cancel() 
          				end
          			else
          				this.close()
          				end
          			end if
          		end if
          	end if
          	if a_user.key.value="{prnt scrn}" 'uses keyboard to print any screen from anywhere
          		a_user.key.handled=.t.
          		ui_bitmap_create_from_screen("test", 0, 0, 8, 6) 
          		vblob = ui_bitmap_save("test") 
          		t=table.open("cscreen")
          		t.change_begin()
          			t.cscreen=vblob
          		t.change_end(.t.)
          		report.preview("cscreen")
          		t.close()
          		ui_bitmap_drop("test") 
          		delete vblob
          		end
          	end if 
          	if a_user.key.value="{^d}"
          		if left(parentform.active(),6)="browse"
          			end 
          		else
          			a_user.key.handled=.t.
          			end
          		end if 
          	end if 
          	if left(a_user.key.value,2)="{^"
          		select 
          			case a_user.key.value="{^a}"
          			case a_user.key.value="{^z}"	
          			case a_user.key.value="{^c}"	
          			case a_user.key.value="{^v}"
          			case a_user.key.value="{^end}"
          			case a_user.key.value="{^home}"				
          			case else 
          				a_user.key.handled=.t.
          				end
          		end select
          	end if
          	if left(a_user.key.value,2)="{%"
          		a_user.key.handled=.t.
          		end
          	end if 
          	end
          	errors:
          	err_msg = error_text_get(error_code_get())
          	line = error_line_number_get()
          	script = error_script_get()
          	ui_msg_box("Error", err_msg+" Error occurred at line "+alltrim(str(line,4,0))+ " in script: "+script)
          	end
          END FUNCTION
          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
            Thank you all, I will try your recommendation.
            Kind Regards,
            Ray Roosa
            Raylin Micro, LLC.

            Comment


              #7
              Originally posted by martinwcole
              Cal, I use a similar system, too, to protect data. Do use a function or put the code in all the forms.

              Since most of my forms fall into maybe 3 types, I put the code in a function and call the one appropriate to the type of form I'm wirking with - eg:
              So far I've just used one "Std_OnKey" script. (Never changed it to a function - no specific reason.) I have my basic version stored in the Code Library but it sometimes gets slight modifications for specific apps. It's pretty similar to your function except that I left the individual keys as separate IF statements so they are easy to modify when necessary. Sometimes my OnKey event will actually "modify" the script action by running specific checks before the Std_OnKey call and ENDing at that point if used. For example:

              Code:
              IF a_user.key.value = "{^O}"
                      a_user.key.handled = .T.
                      IF a_user.key.event = "down"
                          <Do something "non-standard" here>
                          END'
                      END IF
              END IF
              
              script_play("Std_OnKey")

              Comment


                #8
                I also have a function that I use for the OnKey.

                Code:
                '*******************************************************************************
                ' PRIMARY PURPOSE of the OnKey() function is to run a custom script
                ' when a specific key is pressed.
                '
                ' Parameters:
                '
                ' OnKey("KeyPressed", "ScriptName")
                '    KeyPressed    -    specific key pressed by the user on the keyboard
                '   ScriptName  -   name of custom script to play when key is pressed
                '*******************************************************************************
                
                FUNCTION OnKey AS C (KeyPressed as c, ScriptName as c )
                
                if a_user.key.value = KeyPressed
                
                '    if parentform.mode_get() = "View"
                
                        a_user.key.handled = .T.
                
                        if a_user.key.event = "down"
                
                            'run custom script
                            script_play(ScriptName)
                
                        end if
                
                '    end if
                    
                end if    
                
                END FUNCTION
                If I want a specific key to do something, say exit the application, from anywhere in the application, I would call my function in the autoexec. On the other hand, if I want to use a specific key to perform a different action depending on where the user is within the app, I call my function in the OnKey event of the form.

                All in personal preference :)

                Edited: Sample calls of function:

                Code:
                'Program F10 key to close all windows and exit Alpha
                OnKey("{f10}","exit_db")
                
                'Program F2 key to begin new shipping process
                OnKey("{F2}","change_ship_num_tech")
                
                'Program F2 key to begin new at vendor process
                OnKey("{F2}","change_ven_ship")
                Last edited by Cheryl Lemire; 06-27-2006, 08:27 AM.
                Cheryl
                #1 Designs By Pagecrazy
                http://pagecrazy.com/

                Comment

                Working...
                X