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

xdialog Enter key vs. Mouse click

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

    xdialog Enter key vs. Mouse click

    I've had ongoing issues with xdialogs where I can click a button to do something and a check routine in the %code% section shows an error message. If I then click the OK on that error message it closes just fine. However, if I use the Enter key to activate the OK button it will show the message again. After the second time it will go away. This can happen with any message/prompt that displays from the %code% section. I've also had the same thing happen when code in the xdialog enters a record and the result was duplicate records!

    This has been an issue since at least version 11 (maybe earlier) BUT every time I've tried to create a simple example to demonstrate it, it works perfectly. So I haven't reported it.

    Again, when it happens, it works perfectly if you only use the mouse to click buttons. (At least it does most of the time. I won't swear to "always".) The problem only seems to occur when you use the Enter key - which a lot of my faster data entry customers do. So this issue is very frustrating for them.

    Has anyone else seen this and come up with a reasonable solution.

    #2
    Re: xdialog Enter key vs. Mouse click

    I have a login xd that was causing a similar issue, the fix was to land the cursor on a button before the Ok was activated. I suspect it is a timing issue of some sort.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: xdialog Enter key vs. Mouse click

      Are you saying the mouse cursor - probably not but had to ask.

      My users are either tabbing to the button or pressing Enter through the fields to get to the button then pressing the Enter key. So it's not because there is an * on the button - the button is actually "active" before they push Enter to run it.

      Fwiw, many of my issues actually involve a lot more complex xdialog that is getting data entry, checking/validating their input, pulling lookup lists for 'future' fields, etc. It's rare that I see the issue on a simple xdialog - which is part of the problem because that makes it very hard to figure out exactly what's causing Alpha to run through the Code section a second time.

      Comment


        #4
        Re: xdialog Enter key vs. Mouse click

        In my script this is from the section to show what I did using Ok & Cancel buttons:

        Code:
        if okflag = .t. then			
        	step = 3			
        	ui_dlg_refresh_targeted(dlgtitle,controls)
        	xbasic_wait_for_idle(.5)
        	ui_dlg_ctl_goto(dlgtitle,"OK")	
        	sys_send_keys("{SHIFT-TAB}")
        Once the log in password is approved by the okflag test the user actually lands on the Cancel button and then when pressing enter again, hits the ok button and that script then runs. This was not my idea, but it works.

        The pwd_killfocus event sets the okflag - and that is where the timing issue popped up in trying to navigate to the next button using ENTER. So I send the cursor back to the cancel button while the Ok button is enabled then pressing enter again lands on the Ok properly.
        Last edited by MoGrace; 04-26-2018, 10:01 AM.
        Robin

        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

        Comment


          #5
          Re: xdialog Enter key vs. Mouse click

          I'm not sure exactly what your code is doing or how it would apply to my problem. I'm not sure how big of a file I can upload so I put a video on my website to show the problem: http://www.aimsdc.net/double_entry_w_keyboard.wmv

          Edit:
          I tried stopping it by checking the time. Here's the code
          Code:
          ELSEIF a_dlg_button = "Select_from_Customer"
          	'Active customers:
          trace.WriteLn( "" + last_from_choice_time )
          	IF now() - last_from_choice_time > .5
          		ptr = Choose_customer( movefrom_cust_numb, "SOURCE CUSTOMER", "Select Source Customer:" )
          		last_from_choice_time = now()
          		IF ptr.name <> "Cancel"
          			movefrom_cust_numb = ptr.number	'For display.
          			'movefrom_cust_name = ptr.name
          			movefrom_name_city = ptr.name_city	'For display.
          			cur_cust = ptr.number
          			cur_name = ptr.name
          			ptr = cust_data_get( cur_cust )
          			c2clist = ptr.c2clist
          			clist = ptr.clist
          			plist_p = ptr.plist_p
          			plist_c = ptr.plist_c
          			plist_m = ptr.plist_m
          			olist_pd = ptr.olist_pd
          			olist_pp = ptr.olist_pp
          			olist_pt = ptr.olist_pt
          			llist = ptr.llist
          			slist_p = ptr.slist_p
          			slist_d = ptr.slist_d
          			orig_remark = ptr.orig_remark
          			'Use these initially...
          			plist = plist_m
          			olist = olist_pd
          			slist = slist_p
          		END IF
          	END IF
          	a_dlg_button = ""
          And here are the times that were recorded.
          trace_times.png
          Note that both times are EXACTLY the same. So, theoretically, if the times were the same it should NOT have run a second time because "now() - last_from_choice_time" would have been 0 and 0 is usually less than 0.5. Of course, you wouldn't expect the times to be exactly the same in the first place but...

          I even added an xbasic_wait_for_idle(1) after the "last_from_choice_time = now()" just to see what would happen and the times were still identical. And there was a pause so there actually was a wait time. If there was a noticeable wait time, how can both times be the same???

          I'd send it in as a bug report but they won't accept a full application that zips to about 40 Mb and has a script of 1750 lines that needs to be analyzed to find out what the issue is. Any attempt I've made to purposely demonstrate the problem with a small script has failed to duplicate the problem.

          Edit #2:
          It gets worse. As I was thinking about this, the times didn't seem right and I finally realized why. The initial "last_from_choice_time" is set when the script first starts. It should be reset the first time it runs through the IF section but it's never reset. That's even weirder. So I re-ran it with a separate trace.writeln( "* " + now() ) on the line immediately after the other trace.writeln(). Here's the result:
          04/26/2018 11:14:15 44 am
          * 04/26/2018 11:14:19 23 am
          04/26/2018 11:14:15 44 am
          * 04/26/2018 11:14:19 24 am
          So explain to me why the variable isn't changing even though the actual time (with the asterisk) is??? This has GOT to be a bug in Alpha.
          Last edited by CALocklin; 04-26-2018, 11:18 AM.

          Comment


            #6
            Re: xdialog Enter key vs. Mouse click

            Questions:
            How are you trapping the ENTER key?
            Are you employing the killfocus event after the selection is made?
            Do you want to disable the select button after the selection is made?
            Do you want to move to another control after the selection is made?

            I think you want the ENTER key to navigate between controls unless the mouse is used to make a reselection - is that right? If it is then the cursor should move off the button to the next control when using TAB or ENTER.
            Last edited by MoGrace; 04-26-2018, 01:00 PM.
            Robin

            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

            Comment


              #7
              Re: xdialog Enter key vs. Mouse click

              Solution found (???)

              Ideally I want it to work the way it should - just perform the actions for the button then stay there and wait for the user's next action.

              - I can trap the enter key but then I can't use it anywhere else either. (This was also suggested by the customer but I really don't like it because I don't think their data input people would be happy with it.)
              - I'm not using/trapping a KillFocus on the button.
              - I don't want to disable the button because the user might make a mistake and need to try again.

              I did find a semi-solution that works here. I hope it will work in other places I've run into the problem. (This is at least the 7th or 8th time I've run into this.) This solution solves the double prompt but means the user needs to click/push the button twice if they need to run it again. This shouldn't be very common and most people will assume they didn't quite click it correctly if it doesn't work the first time - so it shouldn't be a problem. Since it always runs twice and never a third time, I set a "has_run" variable for each ELSEIF section that has the issue (at least 2 buttons so far) and set the variable to False (.F.) at the start of the function. Then test it in the ELSEIF and either (A) run the code and set the variable to .T. so it won't run again or (B) just set the variable to .F. so a second click will run the code.

              Code:
              FUNCTION Customer_move as C ()
              select_to_has_run = .F.
              ......
              dlg_result = ui_dlg_box( "MOVE CUSTOMER", dlg_text, <<%code%
              ......
              ELSEIF a_dlg_button = "Select_TO_Customer"
              	'Active customers:
              	IF select_to_has_run = .F.
              		select_to_has_run = .T.
              		ptr = Choose_customer( moveto_cust_numb, "DESTINATION CUSTOMER", "Select Destination Customer:" )
              		IF ptr.name <> "Cancel"
              			moveto_cust_numb = ptr.number
              			moveto_cust_name = ptr.name
              			moveto_name_city = ptr.name_city
              			moveto_remark = ptr.remark
              			IF move_append_chc = "No Change"
              				replacement_remark = moveto_remark
              			ELSEIF move_append_chc = "Move"
              				replacement_remark = orig_remark
              			ELSEIF move_append_chc = "Append"
              				replacement_remark = moveto_remark + crlf() + orig_remark + crlf()
              			END IF
              		END IF
              	ELSE
              		select_to_has_run = .F.
              	END IF
              	a_dlg_button = ""
              ELSEIF .....
                      ......
              END IF
              %code%
              For what it's worth, my impression is that the button is somehow getting triggered twice in almost instantaneous succession then the code runs, it detects that the button was triggered a second time and runs the code again. I.e., I don't think it's totally sequential. Although it looks to the user like the button is pushed, the code runs, and the button is "pushed" again. I think the two button pushes (one somehow "created" by Alpha) are almost simultaneous but the code runs before the second "push" is recognized. (edit: I wonder if they are trapping both an UP and DOWN button action and the code is running on both of them???)

              Note that even though it wants to run twice initially, it doesn't reset the variable the second time even though the logic says it should. The second time around it sees the "IF select_to_has_run = .F." and recognizes that it's now .T. and shouldn't run BUT it doesn't run the ELSE section which would reset the variable back to .F..

              Reminder for others reading this - this is a difference between how buttons react on an *xdialog* when clicked with a mouse vs. pushed with the Enter key. The buttons should react the same way whichever method is used but they often don't if there is some type of message/prompt included in the button action.

              Comment


                #8
                Re: xdialog Enter key vs. Mouse click

                I noticed in the video that this 2nd button push occurred when the user used enter to make his selection in the lookup. Since this is not a field rule lookup like you would have on a regular form, your xd is picking up the enter key in the lookup while the select button is still active and passing it back to the button. Which is why I thought it might be a good idea to navigate off the button before the lookup loads.
                Last edited by MoGrace; 04-26-2018, 06:17 PM.
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                  #9
                  Re: xdialog Enter key vs. Mouse click

                  I ran into this again today and was able to create a relatively short example that should work anywhere since it (now) doesn't require any tables to run. It's the result of cutting down a MUCH longer function. And I think I've removed anything that requires any of my personal routines.

                  To test it, copy the code to your Code Editor and run two different tests:
                  1. Click the Save button using your mouse without entering any data (we want the 2 error messages to run) - then press the ENTER key to close the error messages.
                  2. Press the ENTER key until it gets to the Save button then use the ENTER key to press the button - then press the ENTER key to close the error messages.

                  - For test #1 you should only have to press the ENTER key twice to close the 2 error messages.
                  - For test #2 you will have to press the ENTER key 4 times to close the 2 error messages. The first error message will show up, then the second error message, then the first error message will repeat, and the second error message will repeat. (If only one error message needs to be displayed, it will appear twice.)

                  NOTE: It doesn't matter whether you use the mouse or the ENTER key to close the messages. The only thing that matters is which one is used to click/press the Save button on the main dialog.

                  This can't be one button "feeding through" to another button because the buttons are all different - "OK" on the error messages and "Save" or "Cancel" on the main dialog buttons.

                  If nobody can find a problem with this - or a truly simple solution, I'll try sending it in as a bug report. (Note the comment in the dlg_text section about using an asterisk on the button.)

                  Here's the code:
                  Code:
                  'Date Created: 18-May-2018 02:20:53 PM
                  'Last Updated: 18-May-2018 09:00:36 PM
                  'Created By  : Cal Locklin
                  'Updated By  : Cal Locklin
                  
                  FUNCTION Test_new_for_prin_cust as C ( mfg_part="" as C, cust_part="" as C )
                  
                  	DIM Entry_date as D
                  
                  	'---- Create lookup lists.
                  	sls_prsn_list = <<%list%
                  A00
                  A01
                  A02
                  EM
                  HS
                  %list%
                  
                  	dlg_text = <<%dlg%
                  {units=F}{font=Arial,9,n}{ysize=.3}{wrap=0}{background=#220,235,240}
                  {sp};
                  {font=Arial,11,bu}SAMPLE INFO:{font=Arial,9,n};;
                  {font=Arial,9,b}Salesperson: {font=Arial,9,n}[.18,1Sls_Person^+sls_prsn_list];;
                  {font=Arial,9,b}Entry Date: {font=Arial,9,n}[%DATE;P=popup.calendar(dtoc(Entry_date));I=popup.calendar%.18Entry_date!d1_*];;
                  {comment Adding and asterisk to the 'Save' button fixes the "double Enter req'd" problem but is not an acceptable solution.}
                  {justify=center}<15Save Record!Save> <15Cancel>
                  %dlg%
                  	'Check fields for: value exists, length of field for Application.
                  	dlg_text = stritran( dlg_text, "[[record_date]]", dtoc( date() ) )
                  	DIM dlg_result as C
                  	dlg_result = ui_dlg_box( "ENTER NEW SAMPLE INFO", dlg_text, <<%code%
                  IF left( a_dlg_button, 3 ) = "d1_"
                  	IF a_dlg_button = "d1_killfocus"
                  		Entry_date = ctod( dtoc( Entry_date ) )
                  	END IF
                  	day_of_week = cdow( Entry_date )
                  	a_dlg_button = ""
                  ELSEIF a_dlg_button = "Save"
                  	'Check for valid data before exiting xdialog to save record.
                  	IF Entry_date > date()
                  		msg = "The Entry Date cannot be a future date." + crlf(2)
                  		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                  		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                  		a_dlg_button = ""
                  	END IF
                  	IF Entry_date = {}
                  		msg = "The Entry Date cannot be blank." + crlf(2)
                  		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                  		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                  		a_dlg_button = ""
                  	END IF
                  	IF .not. word_exists( Sls_Prsn_list, Sls_Person )
                  		msg = "The Sales Person code cannot be blank and must exist in the drop-down list." + crlf(2)
                  		msg = msg + "Please select a Sales Person code from the list."
                  		ui_msg_box( "SALES PERSON ERROR", msg, ui_attention_symbol )
                  		a_dlg_button = ""
                  	END IF
                  	IF Entry_date < date() - 365 .and. Entry_date <> {}
                  		'This is the only one that can be overridden - MAKE SURE THIS IS THE LAST CHECK!
                  		msg = "The Entry Date cannot be more than a year old." + crlf(2)
                  		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                  		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                  	END IF
                  END IF
                  %code% )
                  
                  	'All code for saving the results was removed for testing purposes.
                  
                  END FUNCTION	'Sample_new_for_prin_cust
                  
                  Test_new_for_prin_cust( "MV32 1C350-368", "STX104 200MX R W6" )

                  Comment


                    #10
                    Re: xdialog Enter key vs. Mouse click

                    That is truly annoying. I tried adding flag variables that get set to false in the code section after the error messages and test for them in deciding whether to execute the sections. The set to false tests ok but one of them is reset to true and I can't see where that could happen.

                    Code:
                    'Date Created: 18-May-2018 02:20:53 PM
                    'Last Updated: 18-May-2018 09:00:36 PM
                    'Created By  : Cal Locklin
                    'Updated By  : Cal Locklin
                    
                    FUNCTION Test_new_for_prin_cust as C ( mfg_part="" as C, cust_part="" as C )
                    
                    	DIM Entry_date as D
                    	dim run_once_date_blank as L = .T.
                    	dim run_once_salesp_blank as L = .T.
                    
                    	'---- Create lookup lists.
                    	sls_prsn_list = <<%list%
                    A00
                    A01
                    A02
                    EM
                    HS
                    %list%
                    
                    	dlg_text = <<%dlg%
                    {units=F}{font=Arial,9,n}{ysize=.3}{wrap=0}{background=#220,235,240}
                    {sp};
                    {font=Arial,11,bu}SAMPLE INFO:{font=Arial,9,n};;
                    {font=Arial,9,b}Salesperson: {font=Arial,9,n}[.18,1Sls_Person^+sls_prsn_list];;
                    {font=Arial,9,b}Entry Date: {font=Arial,9,n}[%DATE;P=popup.calendar(dtoc(Entry_date));I=popup.calendar%.18Entry_date!d1_*];;
                    {comment Adding and asterisk to the 'Save' button fixes the "double Enter req'd" problem but is not an acceptable solution.}
                    {justify=center}<15Save Record!Save> <15Cancel>
                    %dlg%
                    	'Check fields for: value exists, length of field for Application.
                    	dlg_text = stritran( dlg_text, "[[record_date]]", dtoc( date() ) )
                    	DIM dlg_result as C
                    	dlg_result = ui_dlg_box( "ENTER NEW SAMPLE INFO", dlg_text, <<%code%
                    IF left( a_dlg_button, 3 ) = "d1_"
                    	IF a_dlg_button = "d1_killfocus"
                    		Entry_date = ctod( dtoc( Entry_date ) )
                    	END IF
                    	day_of_week = cdow( Entry_date )
                    	a_dlg_button = ""
                    ELSEIF a_dlg_button = "Save"
                    	msgbox("run_once_date_blank is " +convert_type(run_once_date_blank,"C"))
                    	msgbox("run_once_salesp_blank is " +convert_type(run_once_salesp_blank,"C"))
                    'Check for valid data before exiting xdialog to save record.
                    	IF Entry_date > date()
                    		msg = "The Entry Date cannot be a future date." + crlf(2)
                    		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                    		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                    		a_dlg_button = ""
                    	END IF
                    	IF Entry_date = {} .and. run_once_date_blank
                    		msg = "The Entry Date cannot be blank." + crlf(2)
                    		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                    		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                    		run_once_date_blank = .F.
                    		msgbox("run_once_date_blank is " +convert_type(run_once_date_blank,"C"))
                    		a_dlg_button = ""
                    	END IF
                    	IF .not. word_exists( Sls_Prsn_list, Sls_Person ) .and. run_once_salesp_blank
                    		msg = "The Sales Person code cannot be blank and must exist in the drop-down list." + crlf(2)
                    		msg = msg + "Please select a Sales Person code from the list."
                    		ui_msg_box( "SALES PERSON ERROR", msg, ui_attention_symbol )
                    		run_once_salesp_blank = .F.
                    		msgbox("run_once_salesp_blank is " +convert_type(run_once_salesp_blank,"C"))
                    		a_dlg_button = ""
                    	END IF
                    	IF Entry_date < date() - 365 .and. Entry_date <> {}
                    		'This is the only one that can be overridden - MAKE SURE THIS IS THE LAST CHECK!
                    		msg = "The Entry Date cannot be more than a year old." + crlf(2)
                    		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                    		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                    	END IF
                    END IF
                    %code% )
                    
                    	'All code for saving the results was removed for testing purposes.
                    
                    END FUNCTION	'Sample_new_for_prin_cust
                    
                    Test_new_for_prin_cust( "MV32 1C350-368", "STX104 200MX R W6" )
                    Tried something else which is revealing. As the first line of the code section of the xdialog I added

                    trace.writeln(a_dlg_button)

                    using the enter key to move and save

                    d1_setfocus
                    d1_cursor
                    d1_killfocus
                    d1_changing
                    Save
                    Save
                    d1_changing
                    Cancel

                    Using the mouse

                    d1_setfocus
                    d1_cursor
                    d1_killfocus
                    d1_changing
                    Save
                    d1_changing
                    Cancel
                    Last edited by Stan Mathews; 05-21-2018, 03:03 PM.
                    There can be only one.

                    Comment


                      #11
                      Re: xdialog Enter key vs. Mouse click

                      Looks like a bug!! Using the enter key to press a button presses it twice. You could add a hot key to the button & use that or use the space bar to press the button once it is highlighted.

                      Comment


                        #12
                        Re: xdialog Enter key vs. Mouse click

                        Originally posted by Allen Klimeck View Post
                        Looks like a bug!! Using the enter key to press a button presses it twice. You could add a hot key to the button & use that or use the space bar to press the button once it is highlighted.
                        I could. But that probably wouldn't go over very well with user would it! "Yeah, I know it doesn't work the way it should but if you just do it this weird way it will do what you expect it to do!"

                        I'm just shocked that I haven't heard anyone else complaining about it. Does nobody else use Xdialogs like this? I find them really useful for getting input from users because I can have better control over what happens. It does take longer to write them but after doing a few it gets much easier. And I use shortcut keys to create the skeleton of my xdialogs and eliminate a lot of typing.

                        Comment


                          #13
                          Re: xdialog Enter key vs. Mouse click

                          Apologies for my ramblings about flag variables. Rereading the entire thread I see you had already attempted something similar.

                          This seems to work.

                          Code:
                          'Date Created: 18-May-2018 02:20:53 PM
                          'Last Updated: 18-May-2018 09:00:36 PM
                          'Created By  : Cal Locklin
                          'Updated By  : Cal Locklin
                          
                          FUNCTION Test_new_for_prin_cust as C ( mfg_part="" as C, cust_part="" as C )
                          
                          	DIM Entry_date as D
                          
                          	'---- Create lookup lists.
                          	sls_prsn_list = <<%list%
                          A00
                          A01
                          A02
                          EM
                          HS
                          %list%
                          
                          	dlg_text = <<%dlg%
                          {units=F}{font=Arial,9,n}{ysize=.3}{wrap=0}{background=#220,235,240}
                          {sp};
                          {font=Arial,11,bu}SAMPLE INFO:{font=Arial,9,n};;
                          {font=Arial,9,b}Salesperson: {font=Arial,9,n}[.18,1Sls_Person^+sls_prsn_list];;
                          {font=Arial,9,b}Entry Date: {font=Arial,9,n}[%DATE;P=popup.calendar(dtoc(Entry_date));I=popup.calendar%.18Entry_date!d1_*];;
                          {comment Adding and asterisk to the 'Save' button fixes the "double Enter req'd" problem but is not an acceptable solution.}
                          {justify=center}<15Save Record!Save> <15Cancel>
                          {on_key=ENTER}
                          %dlg%
                          	'Check fields for: value exists, length of field for Application.
                          	dlg_text = stritran( dlg_text, "[[record_date]]", dtoc( date() ) )
                          	DIM dlg_result as C
                          	dlg_result = ui_dlg_box( "ENTER NEW SAMPLE INFO", dlg_text, <<%code%
                          if a_dlg_button = "ENTER" then
                              if atc("!Save", ui_dlg_ctl_current("ENTER NEW SAMPLE INFO")) > 0 then
                                  'user is on the Save button
                          	a_dlg_button = "Save"
                          else
                                  'user is not on the Save button, so is cancelling
                                  'just close
                              end if
                          end if
                          IF left( a_dlg_button, 3 ) = "d1_"
                          	IF a_dlg_button = "d1_killfocus"
                          		Entry_date = ctod( dtoc( Entry_date ) )
                          	END IF
                          	day_of_week = cdow( Entry_date )
                          	a_dlg_button = ""
                          ELSEIF a_dlg_button = "Save"
                          	'Check for valid data before exiting xdialog to save record.
                          	IF Entry_date > date()
                          		msg = "The Entry Date cannot be a future date." + crlf(2)
                          		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                          		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                          		a_dlg_button = ""
                          	END IF
                          	IF Entry_date = {}
                          		msg = "The Entry Date cannot be blank." + crlf(2)
                          		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                          		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                          		a_dlg_button = ""
                          	END IF
                          	IF .not. word_exists( Sls_Prsn_list, Sls_Person )
                          		msg = "The Sales Person code cannot be blank and must exist in the drop-down list." + crlf(2)
                          		msg = msg + "Please select a Sales Person code from the list."
                          		ui_msg_box( "SALES PERSON ERROR", msg, ui_attention_symbol )
                          		a_dlg_button = ""
                          	END IF
                          	IF Entry_date < date() - 365 .and. Entry_date <> {}
                          		'This is the only one that can be overridden - MAKE SURE THIS IS THE LAST CHECK!
                          		msg = "The Entry Date cannot be more than a year old." + crlf(2)
                          		msg = msg + "Please correct the Entry Date or cancel this Sample entry."
                          		ui_msg_box( "ENTRY DATE ERROR", msg, ui_attention_symbol )
                          	END IF
                          END IF
                          %code% )
                          
                          	'All code for saving the results was removed for testing purposes.
                          
                          END FUNCTION	'Sample_new_for_prin_cust
                          
                          Test_new_for_prin_cust( "MV32 1C350-368", "STX104 200MX R W6" )
                          Last edited by Stan Mathews; 05-22-2018, 09:55 AM.
                          There can be only one.

                          Comment


                            #14
                            Re: xdialog Enter key vs. Mouse click

                            Originally posted by CALocklin View Post
                            I could. But that probably wouldn't go over very well with user would it! "Yeah, I know it doesn't work the way it should but if you just do it this weird way it will do what you expect it to do!"

                            I'm just shocked that I haven't heard anyone else complaining about it. Does nobody else use Xdialogs like this? I find them really useful for getting input from users because I can have better control over what happens. It does take longer to write them but after doing a few it gets much easier. And I use shortcut keys to create the skeleton of my xdialogs and eliminate a lot of typing.
                            Cal I couldn't agree more I only found this a few months ago. I'm on V11 so there is no hope of a fix for me! I did fix one of them but so far I can't find it & I don't remember what I did to fix it I'll keep looking for it.

                            Allen

                            Comment


                              #15
                              Re: xdialog Enter key vs. Mouse click

                              Nice fix Stan!!

                              Allen

                              Comment

                              Working...
                              X