Alpha DevCon 2018
Results 1 to 11 of 11

Thread: Control PageUP PageDown keys

  1. #1
    Member
    Real Name
    Dave Mac Callum
    Join Date
    Jan 2006
    Location
    Johannesburg. South Africa
    Posts
    380

    Default Control PageUP PageDown keys

    Can anyone advise how I can control PageUp PageDown keys ?

    The purpose it to avoid having to use the mouse while Updating Accounts

    I have attached a database to illustrate my problem

    1. Open Mess Board Database
    2. Select Debtors Ledger – 1
    3. Update Accounts
    4. Esc on Find by Acc Name Dialog. Coca-Cola is selected
    5. F3 Amend.
    6. Tab to Account suspended as an example and alter field (Change icon appears bottom left)
    7. Cursor is now on Credit rating
    8. Click on First Rec Button )Right Top of screen)
    9. Update Supervisor Dialog appears giving options to Save – Select No
    10. Repeat steps 8 & 9 above for Next; Prev; Last; Exit – Select No in all cases
    11. Now leave the mouse and Ctrl-Home
    12. Update Supervisor Dialog appears giving options to Save – Select No
    13. Now Ctrl-End – Select No
    14. When we key Page Up however and select No to Update Supervisor; it saves anyway.

    If one has a look at Form / Events / On Key and investigates {PGUP} it does Push Button 5, but afterwards
    it goes on its way to wherever ??

    Is there a way to clear the Type-ahead Buffer or Current-Key Buffer to stop PGUP doing what seems to be “hard wired”
    into Alpha5 ?

    Same thing for Page-Down; Ctrl-d; and maybe others.

    Looking forward.

    Dave Mac

  2. #2
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,867

    Default Re: Control PageUP PageDown keys


    Is there a way to clear the Type-ahead Buffer or Current-Key Buffer to stop PGUP doing what seems to be “hard wired”
    into Alpha5
    Not sure about buffers, but in design mode of your form, you can choose form properties - restrictions - check navigate record. It will no longer change records with the pgup or pgdown keys. However, if you are in a browse on the form, you can still use the up/dn and pgup/pgdn keys or you can set permissions on the browse also.

    Not sure if this will help, but my 2 cents.

    Dave

  3. #3
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,867

    Default Re: Control PageUP PageDown keys

    Dave,

    The way I understand it, if you leave a record without saving a change, it gets saved. If you cancel changes before saving, it goes back to what it was before. I may get corrected on this. Is that the not the issue??

    I did search settings and did not see anything to change the behaviour. I bet there is some code to override it though.

    Dave Mason

  4. #4
    Member
    Real Name
    Dave Mac Callum
    Join Date
    Jan 2006
    Location
    Johannesburg. South Africa
    Posts
    380

    Default Re: Control PageUP PageDown keys

    Thanks for your prompt replies Guys.

    Thanks for pointing out the Navigate restriction which I was not aware of. I however, need to retain the navigation capability on the form.

    The issue is that if one clicks on Next (rec) button and operator selects "No" to Save ? prompt, it does what is req and does not save. If Operator Keys Page Down and operator slects No to Save ? prompt, the record is saved anyway.

    I agree with you that there must be some code to override it.

    Incidentally what is a "search settings" that you refer to ?

    Dave Mac

  5. #5
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,299

    Default Re: Control PageUP PageDown keys

    Dave Mac,

    I am not able to follow the sequence you specify in the initial post with the material you've uploaded. Step 3 is not available after Step 2. When I click the Select Debtors Ledger - 1 button the Debtors Selection form opens, but there is no option there to Update Accounts. What am I missing?

    Later on:

    If you're talking about the form "Debtors Update", I found the OnKey event script which you use to redirect various keystrokes so that predefined buttons on your form are pushed. I think the trouble you're having with PgUp and PgDn is that your onKey event script is not removing the keystroke from the events queue. It's detecting the keystroke, pushing a button on your form, but not telling Alpha Five that the keystroke has been handled. If you'll review the help file topic "Onkey Events on Forms" you'll see that what I'm talking about the help file describes as "eating the key". So, the fix is easy. Tell Alpha Five the keystroke has been handled. This prevents Alpha Five from navigating off the current record automatically.

    Here's how I'd change your script:

    [ code snippet follows ]
    Code:
    select 
        case a_user.key.value = "`"			'below Esc Key			
           parentform:button7.push() 		'.treat as Exit (Button 7)
        case a_user.key.value = "{F3}"		'F3 key	
    	goto labF3						'----->>>>>
        case a_user.key.value = "{ESC}"		'<ESC> key
    	goto labF4						'----->>>>>
        case a_user.key.value = "{^d}"		'Ctrl-d key
    	goto labF2						'----->>>>>
        case a_user.key.value = "{^HOME}"	'Ctrl-Home key
            parentform:button3.push() 		'.treat as First Rec
        case a_user.key.value = "{PGDN}"	'PageDown key
    	A_USER.KEY.handled = .T.   'eat the keystroke
            parentform:button5.push() 		'.treat as Next Rec
        case a_user.key.value = "{PGUP}"	'PageUp key
    	A_USER.KEY.handled = .T.    'eat the keystroke
            parentform:button4.push() 		'.treat as Prev Rec
        case a_user.key.value = "{^END}"	'Ctrl-End key
            parentform:button6.push() 		'.treat as Last Rec
        case a_user.key.value = "Z"			'Z key	
    	goto Zoom						'----->>>>>
    end select
    In sum, your OnKey event script is correctly DETECTING the keystrokes. But it's not DISCARDING them (eating them) so Alpha Five continues to see them in the keyboard buffer and processes them after the desired button is pushed. If I'm on the right track you should review each keystroke your script is trapping and decide whether you want to remove that keystroke from the keyboard buffer or not.
    Last edited by Tom Cone Jr; 04-28-2007 at 07:03 AM.

  6. #6
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,867

    Default Re: Control PageUP PageDown keys

    Tom,

    Step 3 is at the top left in the toolbar area. I missed it the first few times too. Maybe that should be an indicator for the programmer?

    Dave

  7. #7
    Member
    Real Name
    Dave Mac Callum
    Join Date
    Jan 2006
    Location
    Johannesburg. South Africa
    Posts
    380

    Default Re: Control PageUP PageDown keys

    Thanks Tom. "A_USER.KEY.handled = .T. 'eat the keystroke" is exactly the instruction I am looking for.

    Dave, the fact that both Tom and yourself missed

    "Step 3 is at the top left in the toolbar area. I missed it the first few times too. Maybe that should be an indicator for the programmer?"

    ..indicates that my form design is a bit flaky. Any suggestions how i can improve it ?

    Dave Mac

  8. #8
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,784

    Default Re: Control PageUP PageDown keys

    Dave I have your app sample at work where i am now not. From memory the app starts with a number of large buttons to make choices for an action. I think from a user point of view from then on one expects that actions will be available in such a form. Changing to a small button on a toolbar is not what the user will expect. I would say consistency is the key what ever format you choose.

    An other forum user, Amanita, has been commissioned/requested to put together a tutorial on form design which I am looking forward to. Here is some samples of her work.
    Tim Kiebert
    Geelong Citrus Packers
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  9. #9
    Member
    Real Name
    Dave Mac Callum
    Join Date
    Jan 2006
    Location
    Johannesburg. South Africa
    Posts
    380

    Default Re: Control PageUP PageDown keys

    Thanks for your input Tim.

    When you say "consistency is the key..." you are probable right in both form design and in cricket !

    Congrats for you guys taking the World Cup. The rest of us will have to get our heads together (in more than ways than one) and make a plan

    Dave Mac

    PS. Amanita's design has one thinking "maybe I should start again". This girl's good.

  10. #10
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,784

    Default Re: Control PageUP PageDown keys

    Yep, the boys have done us proud once again.:D
    Tim Kiebert
    Geelong Citrus Packers
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  11. #11
    Member
    Real Name
    Gene FitzPatrick
    Join Date
    Mar 2011
    Posts
    204

    Default Re: Control PageUP PageDown keys

    Thanks to Dave Mason's post of 4/27/07. Works just fine.

    Good day to all!

    Gene

Similar Threads

  1. How do I disable the Pageup/down keys on a form
    By Graham Wickens in forum Alpha Five Version 7
    Replies: 1
    Last Post: 12-07-2006, 03:37 PM
  2. Disappearing dropdown box control with use of Nav control on a5w page
    By Hansolo in forum Web Application Server v7
    Replies: 2
    Last Post: 01-24-2006, 04:35 PM
  3. F keys
    By Chuck Mitchell in forum Alpha Five Version 5
    Replies: 8
    Last Post: 12-15-2003, 08:18 PM
  4. Pagedown in embedded browse
    By drgarytraub in forum Alpha Five Version 5
    Replies: 3
    Last Post: 03-07-2003, 04:19 PM
  5. Control keys (hot keys)
    By Lowell Wardlow in forum Alpha Five Version 4
    Replies: 0
    Last Post: 09-25-2000, 08:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •