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

Replacement for ui_msg_box()

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

    Replacement for ui_msg_box()

    I love the simplicity of ui_msg_box(), not to mention the one line of code. But I really needed to customize the text on buttons so the actions were more intuitive for users. Doing an individual xdialog each time is a pain.

    So here is a udf that accepts custom button text.

    In return I need some help. Depending on the length of the message text, the last word may be dropped. This can be corrected by adding a couple spaces to the end of the message text, but hopefully there is a directive in the xdialog that can correct this without embedding the workaround into the function.

    These examples demonstrate the problem.
    p_msg_box("","my long message text here test one2345678")'drops last word
    p_msg_box("","my long message text here test one2345678 ")'shows last word
    p_msg_box("","First line of text in message box. jsdkjzsdkjf zkjfnsd kdbfn kjn")'too much space at end of text
    p_msg_box("","my long message text here test" +crlf()+"line 2")'line 2 dropped
    p_msg_box("","my long message text here test " +crlf()+"line 2")'works fine

    Bill.

    EDIT: Attachment removed, please see new attachment below.
    Last edited by AaronBBrown; 12-11-2006, 12:48 PM.

    #2
    Re: Replacement for ui_msg_box()

    Bill,

    I have had a look.
    I think the problem lies in the fact xDialog uses a default font (usually Arial 8)for its col and row sizing.

    The first example seems to drop a word because the last word won't fit and tries to wrap. However you have initially calculated only one line so there is no where for it to go. It seems that there is just not enough room in the cols that you allow to accommodate the characters you calculate. You would think one character one column would work. It must be in the way certain characters get drawn. And that is probably why your third sample has extra space at the end. It has characters that take up less space. Compare the two samples below

    p_msg_box("","my long message text here test one2345678") 'This drops last word
    p_msg_box("","my long message text here test oneiiiiiii") ' This doesn't.

    Both samples have the same count of characters.

    If you can live with a bit of extra extra space on the right you could do
    Code:
    cols = max_str_length(message,crlf())[COLOR=Red]+3'or however many[/COLOR]
    You might try different fonts as well.
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

    Comment


      #3
      Re: Replacement for ui_msg_box()

      I was hopeful that the %H=R% directive would adjust to the actual font, but it seems not. In my tests above, 2 spaces on the end seems to do it, but i and w can produce a big difference.

      I have an update that better calculates button width when there is an event name included, but I will wait to see if there are further suggestions on text width before uploading.

      Bill.

      Comment


        #4
        Re: Replacement for ui_msg_box()

        There does not seem to be a way to acurately calculate width in a dynamic text box, so I have changed the code to use static text. Static calculates the width correctly. So what is lost is the ability to use owner draw strings and other xdialog formatting on the message text.

        This version also acurately calculates the width of buttons that have an event name specified.

        Bill.

        Comment


          #5
          Re: Replacement for ui_msg_box()

          Hands down first class winner of the year award for 'most useful new function' from all the folks at Cole Custom Programming!!!!!!!!!

          I changed the name for me to pmsgbox, which has it display at the 2nd character when writing code, and also added a ui_beep() inside the function.
          Cole Custom Programming - Terrell, Texas
          972 524 8714
          [email protected]

          ____________________
          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

          Comment


            #6
            Re: Replacement for ui_msg_box()

            Here are a few minor updates to the function.

            Bill.

            Comment


              #7
              Re: Replacement for ui_msg_box()

              Bill,
              I have been using this function for a good while now, and give thanks for it everyday. I have duplicated it out so I have p_msg_warn() and p_msg_info() with custom images for each and then I don't have to write in the title, button, and image parameters. Call me lazy. Thanks for sharing.
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: Replacement for ui_msg_box()

                Thanks Mike. The code archive is great for all of us.

                Thankfully in v9 xbasic aotocomplete now works if the 2nd letter is underscore, so typing "p_" now displays the function.

                Bill.

                Comment


                  #9
                  Re: Replacement for ui_msg_box()

                  Hi Bill,

                  Is there a way to include the function p_msg_box(), into the list of Alpha functions instead of having to import into each application?

                  Also is there any more info on the function parameters? eg Buttons.
                  Regards
                  Keith Hubert
                  Alpha Guild Member
                  London.
                  KHDB Management Systems
                  Skype = keith.hubert


                  For your day-to-day Needs, you Need an Alpha Database!

                  Comment


                    #10
                    Re: Replacement for ui_msg_box()

                    Could you please explain how to import this function into an application?
                    Thanks!

                    Comment


                      #11
                      Re: Replacement for ui_msg_box()

                      Originally posted by Mark Williams View Post
                      Could you please explain how to import this function into an application?
                      Thanks!
                      Control panel - code tab - white space - right click - import - (follow from there)
                      Al Buchholz
                      Bookwood Systems, LTD
                      Weekly QReportBuilder Webinars Thursday 1 pm CST

                      Occam's Razor - KISS
                      Normalize till it hurts - De-normalize till it works.
                      Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                      When we triage a problem it is much easier to read sample systems than to read a mind.
                      "Make it as simple as possible, but not simpler."
                      Albert Einstein

                      http://www.iadn.com/images/media/iadn_member.png

                      Comment


                        #12
                        Re: Replacement for ui_msg_box()

                        Keith,

                        You can put that script, and any others, into an aex and put the aex into Addins_Installed folder.

                        There are some examples in the code of different ways to do buttons. Basically there is simple, "OK, Cancel", or very robust, by using full power of xdialog to create buttons. Is that what you are asking?

                        Bill.

                        Comment


                          #13
                          Re: Replacement for ui_msg_box()

                          Hi Al,
                          Control panel - code tab - white space - right click - import - (follow from there)
                          This only works if the script was exported from Alpha first or has the correct top and end lines.

                          As in:

                          Index of Scripts
                          ----------------
                          1: script_name


                          Script Name ( 1): script_name
                          --------------------------------------------------------------------------------

                          script code goes here

                          End Script ( 1)---------------------------------------------------------------
                          Regards
                          Keith Hubert
                          Alpha Guild Member
                          London.
                          KHDB Management Systems
                          Skype = keith.hubert


                          For your day-to-day Needs, you Need an Alpha Database!

                          Comment


                            #14
                            Re: Replacement for ui_msg_box()

                            Hi Bill,

                            I think what I meant was, how do you put more that one button on the msg_Box?

                            I dont understand "Buttons = comma, crlf() list or full Xdialog code <......>"
                            Regards
                            Keith Hubert
                            Alpha Guild Member
                            London.
                            KHDB Management Systems
                            Skype = keith.hubert


                            For your day-to-day Needs, you Need an Alpha Database!

                            Comment


                              #15
                              Re: Replacement for ui_msg_box()

                              Keith,

                              Here are some comment lines from the code.
                              Code:
                              'p_msg_box("test","message here","OK, Cancel","question")
                              'p_msg_box("test","message here","button 1 text!one, button 2 text!two","a5_a5icon32")	' returns "one" or "two"
                              'p_msg_box("test","message here","<15Button1!one> <20Button2!two>")
                              In the first example the 2 buttons are "OK,Cancel".

                              The 2nd example is button1 and button2 in an abbreviated xdialog syntax.

                              The 3rd example is button1 and button2 in a full xdialog syntax.

                              I almost always use the example 1 approach. Have as many buttons as you want, separated by commas, and the whole thing enclosed in quotes (because it is one parameter to the function). Here is an example I was coding today.
                              Code:
                              vReply = p_msg_box("Notice",vFilename +crlf() +"already exists." +crlf(2) +"Overwrite the existing file or rename the new file?","Overwrite,Rename,Cancel","QUESTION")
                              Bill.

                              Comment

                              Working...
                              X