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 Box - Set Focus

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

    XDialog Box - Set Focus

    hI

    i created a Dialog Form with 3 Fields.

    Product ID:| [.10ProductID]
    Product Code:| {initial_focus} [.10ProductCode]
    Product Description: | [.10ProductDescription]

    <20Submit> <20Cancel>

    1. When the fields are empty and user click Submit, I want to set focus back to Product Code.
    2. When the user enter something on the product code but nothing on product description, when the user click submit, I want to set focus back to Product Description.

    Problem: How to set focus back to the particular field as required.

    If a_dlg_button = "Submit" then
    If Product_code = null_value() then
    product_code.activate() 'Error Not Working At All
    a_dlg_button = ""
    end if
    end if

    the above code gave me error.

    please advice further... many thanks.
    Many Thanks.

    Jack Lim

    #2
    Re: XDialog Box - Set Focus

    OK.. I found the code to solve it... many thanks.
    Many Thanks.

    Jack Lim

    Comment


      #3
      Re: XDialog Box - Set Focus

      Jack,
      What I think works better than sending the user back to the unfilled field is preventing the user from pressing the "Submit" button in the first place if the required fields are blank.
      You can do that by disabling the Submit button if either the product_code and product_description is blank:

      <20Submit?(productCode\>"" .and. productDescription\>"")>

      Just a suggestion!

      - Peter

      Comment


        #4
        Re: XDialog Box - Set Focus

        LOVE THIS!
        Thank you so much for that Peter. Directly into my code library that went! Full example (cut and paste into IW)
        Code:
        dim productCode as C=""
        dim productDescription as C=""
        dim dbxR as C
        
        dbxR=ui_dlg_box("Test",<<%dlg%
        {region}
        Product Code: | [.20productCode];
        Product Description: | [.20productdescription];
        {endregion};
        {line=1,0}
        {lf};
        {region}
        <20Submit?(productCode\>"" .and. productDescription\>"")> <20Cancel>
        {endregion};
        %dlg%)
        Last edited by Mike Wilson; 09-20-2009, 11:09 PM.
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: XDialog Box - Set Focus

          Originally posted by Peter.Wayne View Post
          Jack,
          What I think works better than sending the user back to the unfilled field is preventing the user from pressing the "Submit" button in the first place if the required fields are blank.
          You can do that by disabling the Submit button if either the product_code and product_description is blank:

          <20Submit?(productCode\>"" .and. productDescription\>"")>

          Just a suggestion!

          - Peter
          Warning - dissenting personal viewpoint.

          I like the concept but I'd be concerned about using this method on anything but the simplest of dialogs. Although the code would get more complex with a more complex dialog, that's not the main reason I'd avoid it. The main reason I would not do this on complex dialogs is that users (especially temporary help or new users) might wonder why the button was grayed out and get frustrated because "I can't get it to work." It might also end up in a phone call to me thus wasting my time answering a dumb question.

          I usually prefer to have a message pop up to tell the user what's missing. (However, I don't usually bother taking the time to write the code to take them back to the missing field. They can find that for themselves. Maybe the extra work will help them remember.)

          Can you tell I've had some rather negative experiences with users?:(

          Do whatever you prefer. Neither method is "correct"; each has its advantages. The best method probably depends more on your specific circumstances.

          Comment


            #6
            Re: XDialog Box - Set Focus

            Cal,
            might wonder why the button was grayed out
            In this case, why not use bubblehelp to explain it?? That would be identical to how I do it in a form when fields are grayed out. That way complete control and user friendly IMO.
            Mike
            __________________________________________
            It is only when we forget all our learning that we begin to know.
            It's not what you look at that matters, it's what you see.
            Henry David Thoreau
            __________________________________________



            Comment


              #7
              Re: XDialog Box - Set Focus

              Originally posted by MikeC View Post
              Cal,
              In this case, why not use bubblehelp to explain it?? That would be identical to how I do it in a form when fields are grayed out. That way complete control and user friendly IMO.
              Another excellent idea!

              Comment


                #8
                Re: XDialog Box - Set Focus

                Hello... thanks for the discussion here.

                I also prefer Message Box prompt to the user which are the fields are required before submit.

                I wrote the following code:

                Code:
                DIM dlg_titl as C
                dlg_title = "Product Information"
                
                	If PRODUCTCODE = null_value() the
                            Msg("Message","Product Code is Required"
                	    ui_dlg_ctl_goto(dlg_title,"PRODUCTCODE")
                   		a_dlg_button = ""
                   		end 
                	end if
                	If PRODUCTDESCRIPTION = null_value() then
                            Msg("Message","Product Code is Required"
                            ui_dlg_ctl_goto(dlg_title,"PRODUCTDESCRIPION"ON)
                 	   	a_dlg_button = ""
                		end 
                	end if
                It worked fine that focus back to the fields when user click submit and the fields are empty.
                Many Thanks.

                Jack Lim

                Comment


                  #9
                  Re: XDialog Box - Set Focus

                  Jack,
                  You have a few things mistyped/missing. Also, the cancel button should always end the sequence. Try this:

                  Code:
                  dim productCode as C=""
                  dim productDescription as C=""
                  dim dbxR as C
                  DIM dlg_tit[COLOR="Red"]le [/COLOR]as C
                  dlg_title = "Product Information"
                  
                  dbxR=ui_dlg_box(dlg_title,<<%dlg%
                  {region}
                  Product Code: | [.20productCode];
                  Product Description: | [.20productdescription];
                  {endregion};
                  {line=1,0}
                  {lf};
                  {region}
                  <20Submit> <20Cancel>
                  {endregion};
                  %dlg%,<<%code%
                  
                  	[COLOR="red"]if a_dlg_button = "cancel"
                  		end 
                  	end if[/COLOR]
                  
                  	if PRODUCTCODE = null_value() [COLOR="Red"]then[/COLOR]
                              [COLOR="red"]msgbox[/COLOR]("Message","Product Code is Required"[COLOR="red"])[/COLOR]
                  	    ui_dlg_ctl_goto(dlg_title,"PRODUCTCODE")
                     		a_dlg_button = ""
                     		end 
                  	end if
                  
                  	if PRODUCTDESCRIPTION = null_value() [COLOR="red"]then[/COLOR]
                              [COLOR="red"]msgbox[/COLOR]("Message","Product Code is Required"[COLOR="red"])[/COLOR]
                              ui_dlg_ctl_goto(dlg_title,"PRODUCTDESCRIPION"ON)
                   	   	a_dlg_button = ""
                  		end 
                  	end if
                  %code%)
                  LATER AFTER MIKE AND CAL:
                  >> IF...... then not the
                  Last edited by Mike Wilson; 09-21-2009, 10:04 AM. Reason: more
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: XDialog Box - Set Focus

                    and the "ON" should be removed (hard to catch 'em all).
                    ui_dlg_ctl_goto(dlg_title,"PRODUCTDESCRIPION"ON)
                    most likely just a copy error...
                    Mike
                    __________________________________________
                    It is only when we forget all our learning that we begin to know.
                    It's not what you look at that matters, it's what you see.
                    Henry David Thoreau
                    __________________________________________



                    Comment


                      #11
                      Re: XDialog Box - Set Focus

                      Originally posted by Mike Wilson View Post
                      ...Also, the cancel button should always end the sequence.
                      That's probably good form when using IF...END IF, IF...END IF, IF...END IF, but if you use IF...ELSEIF... where each ELSEIF evaluates one possible xdialog event*, then it really won't matter. As long as the a_dlg_button variable is not blank, the dialog will close when the end of the dialog code is reached. There are a couple reasons I use ELSEIF.
                      • By using ELSEIF, only one of the choices will actually be completely evaluated and there is no chance of 'accidentally' checking one of the others as well. (Edit: See the last paragraph.)
                      • If it is important to check something each time regardless of what other event occurred, it will be a separate IF and that helps me to understand the logic when editing later. A separate IF indicates to me that something special is going on. (I know I've done this but can't think of any examples at the moment.)
                      • For what little speed difference it makes, once one true ELSEIF has been found and evaluated, the rest are skipped over.
                      *definition of "one xdialog event":
                      I realized this could have multiple definitions so, to be more specific, "one event" in this situation means either one button push or one !<event_def>. Sometimes the !<event_def> can be used in multiple places and sometimes it is defined with an asterisk so, for example, !adg_* could result in multiple events such as adg_change, adg_changing, adg_dblclick, or adg_killfocus. However, for my purposes as explained here, the "adg_" is one event and would be tested as:
                      Code:
                      ELSEIF left( a_dlg_button, 4 ) = "adg_"
                          IF a_dlg_button = "adg_change"
                              <do something>
                          END IF
                          a_dlg_button = ""  'This keeps the xdialog from closing.
                      END IF
                      AND, now that I've finished typing the above, I noticed something else - probably the real issue here. The last example doesn't check first to see if the Submit button was pushed - perhaps it was left out because the writer was only showing the pertinent code. (The original post did include that check.) It's best to get in the habit of putting those 'completion' checks after an IF a_dlg_button = "Submit". In more complex xdialogs there are likely to be other, perhaps many other, event triggers besides the Submit or Cancel buttons and you don't want to be checking for blank fields until after the Submit button is pushed.

                      Comment


                        #12
                        Re: XDialog Box - Set Focus

                        Hi everyone... many thanks. I have learned that... sorri for the typo error.

                        By the way.. after the user enter the product code and product description and submit the record.

                        I want the field product code and product description become disable and background color is Light Green.

                        How should I write the code?
                        Many Thanks.

                        Jack Lim

                        Comment


                          #13
                          Re: XDialog Box - Set Focus

                          Code:
                          parentform:productcode.fill.color = "Light Green"
                          parentform:productcode.field.readonly = .T.
                          
                          parentform:productdescription.fill.color = "Light Green"
                          parentform:productdescription.field.readonly = .T.
                          Mike W
                          __________________________
                          "I rebel in at least small things to express to the world that I have not completely surrendered"

                          Comment


                            #14
                            Re: XDialog Box - Set Focus

                            Hi Mike

                            are u sure can work on XDialog Box?

                            the code you written is for the Form Design.

                            Thanks.
                            Many Thanks.

                            Jack Lim

                            Comment


                              #15
                              Re: XDialog Box - Set Focus

                              Originally posted by jacklcs22 View Post
                              Hi Mike

                              are u sure can work on XDialog Box?

                              the code you written is for the Form Design.

                              Thanks.
                              I was going to suggest the same thing Mike did. Doesn't the xdialog close after submitting the record?

                              Comment

                              Working...
                              X