Alpha Video Training
Results 1 to 6 of 6

Thread: xdialogs and entry

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

    Default xdialogs and entry

    I love the xdialog, but...

    One of the big factors in choosing alpha was the ability to "enter" through the tab order.

    Is there a way to get an xdialog to accept enters without closing?

    I put an xdialog in my app as a start up for username + password + a checkbox if a print was needed. 3 months later the users hate it because they have to use the tab key. They put in their user name hit enter to go to password and get tossed out of the program(which it should).
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: xdialogs and entry

    Dave

    In your xdialog code take the "*" from in front of the OK button

    Code:
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED Cust_id as C
    DIM SHARED cust_name as C
    DIM SHARED cust_contact as C
    DIM SHARED varC_result as C
    ok_button_label = "OK"
    cancel_button_label = "Cancel"
    varC_result = ui_dlg_box("Alpha Five",<<%dlg%
    {region}
    Enter Cust Id:| [.40Cust_id];
    Enter Customer Name:| [.40cust_name];
    Enter Customer Contact:| [.40cust_contact];
    {endregion};
    {line=1,0};
    {region}
    <15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)

    You can then use the enter key for movement through the xdialog

    Tom Baker

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

    Default Re: xdialogs and entry

    Tom,

    Thanks! I will try it tomorrow
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

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

    Default Re: xdialogs and entry

    Dave, I hope Tom's right cause it sure sounds easier than what I recall having to do long ago. It's been a year since I worked with this but I recall having to trap the enter key with the {on_key} statement, and then shift focus dynamically using code in the xdialog. -- tom

    Later on...

    Here's an example I worked up for Martin 2 years ago. Time flies.

    Code:
    'Date Created: 07-Jan-2006 08:00:59 AM
    'Last Updated: 03-Feb-2008 01:43:56 PM
    'Created By  : Test1
    'Updated By  : Tom Cone Jr
    
    '----------------------------------------------------------------------
    'Illustration:  Use of ENTER key to tab through objects in an xdialog
    '----------------------------------------------------------------------
    
    
    'Martin, the basic strategy is to use the {On_Key} event to trap each Enter keystroke
    '        then have the script check to see which object has focus.  If it's a button
    '        do nothing.  If it's an input field, shift focus to the next field or
    '        object you want.  Sort of like manually building your own tab order in a form.
    
    DIM SHARED beginning as N
    DIM SHARED ending as N
    DIM SHARED varC_result as C
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Changing Page Numbers",<<%dlg%
    {on_key=enter}	 {Comment=enter key treated like tab key, except for buttons}
    {region}
    Enter Beginning Page Number:| [%z%.4beginning];
    Ending Page Number:| [%z%.4ending];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    Reprocess_Keystroke:
    Select
    	Case "OK"$ui_dlg_ctl_current("Changing Page Numbers")   'OK button has focus
    	    if a_dlg_button = "enter" then	'ENTER was pressed, pass the OK on through
    	    	a_dlg_button = "&OK"
    	    end if
    	    
    	case "Cancel"$ui_dlg_ctl_current("Changing Page Numbers")  'Cancel button has focus
    	    if a_dlg_button = "enter" then	'ENTER was pressed, pass the Cancel on through
    	    	a_dlg_button = "&Cancel"
    	    end if
    	    
    	case "beginning"$ui_dlg_ctl_current("Changing Page Numbers")  'beginning control has focus
    	    if a_dlg_button = "enter" then	'ENTER was pressed, shift focus to ending control
    	    	a_dlg_button = ""  'prevent dialog from closing
    	    	ui_dlg_ctl_goto("Changing Page Numbers","[%z%.4ending]")
    	    end if	    
    
    	case "ending"$ui_dlg_ctl_current("Changing Page Numbers")  'ending control has focus
    	    if a_dlg_button = "enter" then	'ENTER was pressed, shift focus to OK button control
    	    	a_dlg_button = ""  'prevent dialog from closing
    		ui_dlg_ctl_goto("Changing Page Numbers","<*15=ok_button_label!OK>")
    		sys_send_keys("{TAB}")  'special handling required when moving focus to button
    	    end if	   
    End Select
    
    
    %code%)
    if varC_result = "OK"
    	ui_msg_box("","user clicked OK to close the dialog.  Begin pg no is: "+ltrim(str(beginning)))
    	end
    elseif varC_Result = "Cancel" then
    	ui_msg_box("","User clicked CANCEL to close the dialg")
    	end 
    end if
    Last edited by Tom Cone Jr; 02-03-2008 at 02:47 PM. Reason: include sample code

  5. #5
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: xdialogs and entry

    Here is the testing code

    It an exported script.

    I have tried it and it works.


    Tom Baker

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

    Default Re: xdialogs and entry

    Tom and Tom.

    It worked great! Just removed the "*".
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

Similar Threads

  1. Xdialogs are not objects? And you can't point to them?
    By Mike Wilson in forum Alpha Five Version 7
    Replies: 1
    Last Post: 03-23-2007, 12:33 PM
  2. Menu's/Toolbars in XDialogs?
    By dvenus in forum Alpha Five Version 7
    Replies: 4
    Last Post: 12-24-2006, 11:29 PM
  3. Sound and Xdialogs - Where/what is the sound for Warning symbol (!)?
    By Mike Wilson in forum Alpha Five Version 7
    Replies: 5
    Last Post: 11-29-2006, 04:01 AM
  4. Modal vs. Modeless Xdialogs
    By Tom Cone Jr in forum Alpha Five Version 7
    Replies: 2
    Last Post: 08-14-2006, 12:00 AM
  5. Style Sheets on xdialogs
    By BRIAN GRAY in forum Alpha Five Version 5
    Replies: 1
    Last Post: 07-31-2004, 07:10 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
  •