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

Ui_msg_box() Codes

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

    #16
    Re: Ui_msg_box() Codes

    This thread has inspired me to make my own custom message box xdialog tool.

    I like the ui_msg_box() function, but I�m always wanting to tweak it and I can�t. I would like to change the font or the back ground color and I don�t think I can do that. So I find myself constantly designing different ui_dlg_box()s.

    So for the simple run of the mill quickey ui_dlg_box, I have now created a crude tool to get me started with the typical ui_dlg_box that I usually start with. There are a number of areas that I plan on adding enhancements, but for now I thought I would give it to the board for feedback.

    It could use some lookups for the color, style and font. My code isn't the prettiest, but it does appear to work.

    The button width does automatically adjusts for longer text.

    Pressing �OK� will copy the code to the clipboard. I haven�t figures out how to have it paste into a script. The other feature I would like to incorporate would be the appropriate ui_beep sound with each image.

    Again, this is my macro for making a simple xdialog for a message or to control the flow of a script. Many on this board have been very generous with their time and have helped me so much that I hope someone can get some use out of this.

    Ron


    Code:
    'Date Created: 02-Oct-2011 11:35:46 AM
    'Last Updated: 02-Oct-2011 11:35:46 AM
    'Created By  : Ron
    'Updated By  : Ron
    
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED vTitle as C
    DIM SHARED vUnit as C
    DIM SHARED vSize as C
    DIM SHARED vMargin as C
    DIM SHARED vFont as C
    DIM SHARED vMsg as C
    DIM SHARED vBut1 as C
    DIM SHARED vBut2 as C
    DIM SHARED vBut3 as C
    DIM SHARED vButDefault as C
    DIM SHARED vButWth as C
    DIM SHARED vHeight as C
    DIM SHARED vButJusify as C
    DIM SHARED vSymbol as C
    DIM SHARED vAccent as C
    DIM SHARED vColor as C
    DIM SHARED vWinStyle as C
    
    
    DIM SHARED vXdialog as C
    
    DIM SHARED varC_result as C
    
    vTitle = "Title"
    vUnit = "F"
    vSize = ".3"
    vMargin = "4,4"
    vFont = "Arial,10"
    vMsg = "Message Text"
    vBut1 = "OK"
    vBut2 = "Cancel"
    
    vButDefault = "First"
    vButWth = "12"
    vHeight = "1.5"
    vButJusify = "Left"
    vSymbol = "None"
    vAccent = "Off White"
    vColor = "Blue White"
    vWinStyle = "Gradient Horizontal"
    
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Build a Custom Message Box",<<%dlg%
    {xmargin=4,4}{ysize=.3}{font=arial,10,b};;
    {region}
    Title:|
    {font=arial,10}
     [.60vTitle];;;
    {font=arial,10,b}
    Units:|
    {font=arial,10}
     [.5vUnit]
    {font=arial,10,b}
      Ysize:
    {font=arial,10}
     [.6vSize]
    {font=arial,10,b}
      Xmargin:
    {font=arial,10}  
     [.10vMargin];;;
    {font=arial,10,b}
    Font:|
    {font=arial,10}
     [.40vFont];;;
    {endregion};
    
    {region}{font=arial,10,b}
    Color:|
    {font=arial,10}
     [.50vColor];
     {font=arial,10,b}
    Accent Color:|
    {font=arial,10}
     [.50vAccent];
    
    {font=arial,10,b}
    Windows Style:|
    {font=arial,10}
     [.50vWinStyle];;; 
    {endregion};
    
    {font=arial,10,b}
    Message:
    {font=arial,10}
     [%mw%.80,3vMsg];;;
    {font=arial,10,b}
    Button 1:
    {font=arial,10}
     [.40vBut1!x];
    {font=arial,10,b}
    Button 2:
    {font=arial,10}
     [.40vBut2!x];
    {font=arial,10,b}
    Button 3:
    {font=arial,10}
     [.40vBut3!x];;;
    {font=arial,10,b}
    {region}Default Button:{font=arial,10}{endregion}
    {region} (vButDefault:First) 
    (vButDefault:Second) 
    (vButDefault:Third){endregion};
    ;
    {region}
    {font=arial,10,b}
    Button Width:{font=arial,10}  | [.6vButWth];
    {font=arial,10,b}
    Button Height:{font=arial,10} | [.6vHeight]
    {endregion};;;
    
    {region}{font=arial,10,b}Button Alignment:{font=arial,10}{endregion}
    {region} (vButJusify:Left) 
    (vButJusify:Center) 
    (vButJusify:Right){endregion};;;
    
    
    {region}{font=arial,10,b}Image:{font=arial,10}{endregion}
    {region} (vSymbol:None) 
    (vSymbol:Error) 
    (vSymbol:Information) 
    (vSymbol:Question) 
    (vSymbol:Warning){endregion};
    ;
    {endregion};;
    {region}
    <*12,1.5=ok_button_label!OK> <12,1.5=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    
    IF a_dlg_button = "x" THEN
    	a_dlg_button = ""
    	
    	'get max button length
    	button_temp = vBut1+","+vBut2+","+vBut3
    	btn_length = max_str_length(button_temp, ",")
    	IF btn_length > 12
    		vButWth = btn_length +4
    	ELSE
    		vButWth = 12
    	END IF
    END IF
    
    %code%)
    
    IF varC_result = "OK" THEN
    	goto keepgoing
    ELSE
    	END
    END IF
    
    keepgoing:
    
    IF vSymbol <> "none" THEN
    	vSymbol = "{image=$sys_"+vSymbol+"}"
    END IF
    
    dim shared vrows as C
    IF vSymbol="none" THEN
    	vrows="2"
    ELSE
    	vrows="3"
    END IF
    
    dim Shared vtextlength as C
    vTextLength = alltrim(str((len(vMsg)+10)))
    IF val(vtextlength) < 25 THEN
    	vtextlength = "25"
    ELSE IF val(vtextlength) > 75
    	vtextlength = "80"
    	vrows = "3"
    END IF
    
    vXdialog = "DIM SHARED vDlg_Title as C"+crlf()+\
    "DIM SHARED vMsg as C"+crlf()+\
    "vMsg="+s_quote(vmsg)+crlf()+\
    "DIM SHARED varC_result as C"+crlf()+\
    "DIM XDialogStyle as P"+crlf()+\
    "XDialogStyle.AccentColor = "+s_quote(vAccent)+crlf()+\
    "XDialogStyle.Color = "+s_quote(vColor) +crlf()+\
    "vDlg_Title="+s_quote(vTitle)+crlf()+\
    "dlg_text = <<%dlg%"+crlf()+\
    "{Windowstyle="+vWinStyle+"}"+crlf()+\
    "{ysize="+vSize+"}"+"{units="+vUnit+"}"+"{xmargin="+vMargin+"}"+"{font="+vFont+"};"+crlf()+\
    if(vSymbol="none","",vSymbol+"{sp}{sp}{sp}")+crlf()+\
    "{text=%H=R%"+vtextlength+","+vrows+"vMsg};"+crlf()+\
    "{justify=center,"+vButJusify+"}"+crlf()+\
    "<"+if(vButDefault="First","*","")+vButWth+","+vHeight+vBut1+"> "  +crlf()+\
    if(vBut2="",""," <"+if(vButDefault="Second","*","")+vButWth+","+vHeight+vBut2+"> " +crlf())+\
    if(vBut3="",""," <"+if(vButDefault="Third","*","")+vButWth+","+vHeight+vBut3+"> " +crlf())+\
    "%dlg%"+crlf()+\
    "varC_result=ui_dlg_box(vdlg_title, dlg_text, <<%code%"+crlf()+\
    "%"+"code%)"+crlf(2)+\
    "IF varC_result = "+quote(vBut1)+" THEN"+crlf()+\
    "	goto keepgoing"+crlf()+\
    "ELSE"+crlf()+\
    "	END"+crlf()+\
    "END IF"+crlf(2)+\
    "keepgoing:"
    
    ui_msg_box("",vXdialog)
    
    clipboard.Clear_Data()
    clipboard.Set_Data(vXdialog)
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    Comment


      #17
      Re: Ui_msg_box() Codes

      I decided to add lookups to the Font, Color, Accent Color and Windows Style. I added only a few as I usually only use a couple of choices. You can change the lookups as you wish. Also, I made the variables global so if you run the script again, your last choices have been retained.

      I run the script making my selections. The xDialog script is generated and copied to the clipboard. I then select where I want the xDialog code and do a paste.

      Ron
      Attached Files
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #18
        Re: Ui_msg_box() Codes

        OK, you guys have shamed me into it. I've attached my AIMS_msg_box2() that can be used as a direct replacement for the ui_msg_box() - but with additional features available.

        The additional features are similar to the ones suggested/used in previous posts here: the ability to change the font, restrict the wrap width (but it will not allow wrapping wider than the screen), and the ability to set a different background color. I did not add gradients and accent colors because they just aren't something I normally use in message boxes - although that may change in the future as I upgrade old apps.

        The code also demonstrates some methods that can be used so almost any text can be displayed. Without them, things like parentheses, braces, square brackets, backslashes, and leading digits will cause display issues.

        The one minor downside that I've found is that you can't properly display a single paragraph that has over 1024 characters. This function will display them but they will be broken into 2 sections (or more - one for each 1024 chars). The solution is simple - don't get so wordy!

        I also like Ron's idea of creating an xdialog to handle setting up the options and creating the final dialog.

        USING CUSTOM BUTTON TEXT:
        - The longest button text will determine the width of all buttons. It was my decision that it looked better to have two long buttons even if one had 10 words and the other just said 'Cancel' rather than one real long button and one short button. KEEP THIS IN MIND - especially when using 4 buttons! Many of my custom buttons have something like "Yes - restore the old data" so the user has an additional 'check' to make sure the correct button is clicked. (Some users don't read messages very well so we need to do all we can to protect them from themselves!)
        - You can enter ui_yes_no, etc. as a button type but it will be ignored if you define even one custom button. You either use custom buttons or 'standard' buttons.
        - If you use custom buttons, the function will set the global variables aims_msg_btn1_selected, etc. and you can use them in the 'decision making process' the same way that you would use ui_yes_selected after closing the message box.

        AND A *GENERAL* ISSUE PEOPLE SHOULD BE AWARE OF:
        You guys are really stupid for doing this (yeah, I was doing it too until about 2 weeks ago) but the correct way to use {font=}, {ysize=}, {units=F}, {wrap=} and possibly some other font related "size" commands requires that the {font=} and {units=F} must come BEFORE the {ysize=} and {wrap=} commands. Otherwise {ysize=} and {wrap=} will be based on the "previously defined" font which will be the default font. Using the "previously defined font" means that you could specify something like a wrap width of 30 but it would appear to wrap at maybe 10 when using a large font. (Makes sense once you think about it, right!?)

        FWIW, this particular version is an update to my original AIMS_msg_box() but I had to call it AIMS_msg_box2 because the update included a change to the arguments. The original had the "font_def" broken up into the three separate components and I'm still using that in a LOT of places so I'm keeping the old one and slowly replacing it with "2".
        Attached Files
        Last edited by CALocklin; 10-03-2011, 05:54 PM.

        Comment


          #19
          Re: Ui_msg_box() Codes

          I've attached my latest version. I fixed some minor bugs.
          This tool has really helped me to create custom xdialogs very quickly.
          The ability to save previous selections works very nicely. I typically create the dialog, open an untitled and paste the results. If I don't like what I see, I found it faster at times to just rerun the builder, cut and paste than to play with the code.

          Every xdialog I build starts with my builder making the basic xdialog. Then if I need a lookup or list box etc., I use alpha's builder strickley to help create that code, cutting and pasting into my xdialog.
          Attached Files
          Alpha 5 Version 11
          AA Build 2999, Build 4269, Current Build
          DBF's and MySql
          Desktop, Web on the Desktop and WEB

          Ron Anusiewicz

          Comment

          Working...
          X