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: Increment String

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

    Xdialog: Increment String

    I am trying to turn my login password script into a splash screen and want to give the user 3 tries to enter his correct user id. The correct user id in this example is "A5". The script should prompt you for the bitmap which I included.

    Enter a wrong user id and what the Try Again button is supposed to do is increment the var qi to show the user is on try #2 when it shows vStr1 again. But I can't get it to display - what am I doing wrong?

    Test Login_05-13-2015.txt
    SKK_logo24.bmp
    Robin

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

    #2
    Re: Xdialog: Increment String

    I don't see this line being modified to change the tries number.

    Code:
    vStr2 = "{sp=43}<%O={F=Arial,10,B}{C=Red}{J=C,C} Try Again%30,2!Try>;{lf};{sp=18}{'%O={F=Arial,12,B}{C=Dark Blue}{J=C,C}Sorry! You have 3 tries or the program will close%75,1.5};"
    There can be only one.

    Comment


      #3
      Re: Xdialog: Increment String

      I don't think that {include=} works here

      Change:
      vStr = "{sp=15}{'%O={F=Arial,10}{C=Black}{J=C,C}__vqi__. To Log In Please Enter Your User ID %45,1.5} [%p%.20vPwd!pw_*];"
      to
      vStr = "__vqi__. To Log In Please Enter Your User ID"

      Change your step 1 section to:

      {condition=step=1}
      {region=a}
      {font=arial,10}
      {sp=15}{text=50,2vstr1}[%p%.20vPwd!pw_*];;

      Change in the 'try' code section:

      vStr1 =strtran(vstr,"__vqi__",alltrim(str(qi+1)) )
      to
      vstr1 = strtran(vstr,"__vqi__",alltrim(str(qi)))

      Comment


        #4
        Re: Xdialog: Increment String

        Thanks guys, I am preparing for an audit for tomorrow, and will try your suggestions afterwards.
        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: Increment String

          Thanks Allen that worked so well I decided to add a 4th step, string and condition to notify the user the program is about to close and would like it to display for a few seconds then set a_dlg_button = "Cancel". But I can't seem to do both. I tried adding a sleep(2) but then the message doesn't display. Any advice on how to do this?
          Robin

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

          Comment


            #6
            Re: Xdialog: Increment String

            Robin,

            Did see this sample code ("Dialog Box for User Sign-in") from help?

            Comment


              #7
              Re: Xdialog: Increment String

              I have seen Tom Henkel's example before and he is using msgbox() whereas I wanted to display the message on the original XD before closing it. Stan has an example for having a ui_dlg_box self close and I am thinking that might be a better way to go so it only displays if the program is going to close.
              Robin

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

              Comment


                #8
                Re: Xdialog: Increment String

                Robin,

                I have a different way to show the message.
                Code:
                msghere="To Log In Please Enter Your User ID"
                
                dlgtitle ="Robin Login"
                Delete XdialogStyle
                dim XDialogStyle as p
                XDialogStyle.AccentColor = "White"
                XDialogStyle.Color = "#221+226+176"
                
                dlgbody = <<%dlg%
                {removecomments}
                {Windowstyle=Gradient Horizontal Middle}
                {can_exit=exit}
                {startup=init}
                
                
                {region}
                {justify=center}
                Enter Code;{lf};
                Log In Please Enter Your User ID: [%p%.20vPwd!pw_*];
                
                {lf};
                
                {text=100,2msghere};
                {endregion};
                
                
                {lf};
                {justify=center}
                <*12Ok!OK?okflag>   <12Cancel!CANCEL>;
                
                %dlg%
                
                dlgcode = <<%code%
                if a_dlg_button = "Init"	
                	step = 1	
                	a_dlg_button = ""	
                end if
                
                if a_dlg_button = "exit" then
                	'close the dialog
                	msgbox("Log In","Log In Cancelled",0)
                	'ui_modeless_dlg_close(dlgtitle)
                end if
                
                if a_dlg_button = "CANCEL"
                	userid = ""
                	ui_modeless_dlg_close(dlgtitle)	
                end if
                
                if left(a_dlg_button,3) = "pw_" then	
                	if a_dlg_button = "pw_killfocus" then	
                		a_dlg_button = ""	
                		'test without using UDF's
                		vTrys = vTrys+1
                		if vPwd = ut("a5") then
                			okflag = .t.
                			msghere="*** Log In Accepted ***"
                		else
                			okflag = .f.
                			vPwd=""
                		end if
                		msgbox("How many? ",str(vTrys))
                		
                		'Make it as Dynamic font n color..
                		If vTrys =2 .or. vTrys =3 then
                			msghere="Try again"
                		else if vTrys =4
                			msghere="Sorry! You have 3 tries or the program will close"	
                			sleep(2) 'too soon, not see the changing msghere
                			ui_modeless_dlg_close(dlgtitle)
                		else if vTrys = 5
                			'close it
                			ui_modeless_dlg_close(dlgtitle)	
                		end if							
                	end if
                end if
                	
                
                %code%
                
                dlgresult = ui_dlg_box(dlgtitle,dlgbody,dlgcode )

                Comment


                  #9
                  Re: Xdialog: Increment String

                  Robin,
                  I have a pretty robust login sequence that uses a username (8 characters) and a password (8 characters), with the functionality of limiting the number of failed attempts and a timed lockout so the user can't keep trying. The attached is an example. The username is the first 6 characters on my last name first initial and middle initial - wilsonjm. The password is 'password'. There is also a backdoor without having to enter a password with username = 'backdoor'. This may be more than you were seeking, but I thought I would throw it out there since I had it as an example. I threw your logo image into the login dialog since you provided it. Hope it helps.
                  Attached Files
                  Last edited by Mike Wilson; 05-16-2015, 04:57 PM.
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: Xdialog: Increment String

                    Thanks Mike,
                    I have an old version of your login, this one looks a bit easier...(I hope!)
                    Robin

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

                    Comment


                      #11
                      Re: Xdialog: Increment String

                      Mike,

                      Easier is apparently relative...until I ran across this line in your other dlg box functions:

                      vlen=int(max_str_length(input_msg,crlf())+( max_str_length(input_msg,crlf())^.81))

                      You sent me on a search for exponent syntax for which I didn't find any examples using a decimal (fractions I found).

                      So how did you come up with this decimal, since each function is using a different value?
                      Robin

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

                      Comment


                        #12
                        Re: Xdialog: Increment String

                        Robin,
                        I did it empirically. I made a bunch of different length input strings with an assortment of different length words and looped through them displaying them in the dialog adjusting the numbers until the strings presented the best. It's there to try and accommodate for higher number font. There is probably a more sophisticated and elegant way, but years ago when I wrote that I didn't know of one and it works OK for the message size and lengths I use it for so I haven't bothered to re-visited it. Yeah, I see that one uses .81 and another .83. Not intentional. I just wrote them at different times and got the number inconsistent in one or more of them.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: Xdialog: Increment String

                          Robin,
                          Yes, I did use a msgbox, because way back when I wrote the dialog, I wasn't nearly as comfortable with xdialog coding as I am now. Now you've made me think that I need to revisit the dialog and put an error message box on it and dynamically display the error messages like I do in countless other dialogs I have written since.

                          Tom

                          Comment

                          Working...
                          X