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



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 a_dlg_button

  • Filter
  • Time
  • Show
Clear All
new posts

    Re: Xdialog a_dlg_button

    In Finian's example #9, what needs to change if instead of embedding the functions in the script, these were global functions instead? I am trying to learn to code my modeless xdialogs like this example below (*) where local variables can be used in a global UDF called from a button script that passes values from the form to local variables instead of global or shared. Is the pointer to the local_variables() all that is needed in the script and the UDF to make it work like this embedded example? I am trying to get these lengthy xdialog definitions out of my button scripts...

    *varC_Result = ui_modeless_dlg_box(dlg_title,dlg_body,dlg_event)

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


      Re: Xdialog a_dlg_button


      I don't think that using "local_variables()" in a global function makes much sense. Oops, as I typed that I just realized you said "global" which is not necessarily "generic". If you want to use it as a generic function then I really would not attempt to use "local_variables()" at all. In fact, I seldom use "local_variables()" because it usually becomes much too difficult to remember all my local variables - especially after working on something else then coming back to debug/update my function. When creating functions (with one exception in the past and I'm not sure I'd do it if starting over today) I just pass all necessary variables as arguments to the function.

      Oops again! Just as I was ready to post this I realized you were wanting to use a modeless xdialog. Oh well, most of what I did would still be applicable to a modeless xdialog. Only minor modifications would be required to make this example modeless.

      Here's how I would create it as a generic function (with lots of internal comments):
      FUNCTION Color_select as C ( color_list as C, not_allowed_list as C )
      	'FYI: Personally I HATE the use of varC_Result. It's the result from the xdialog so I use 
      	'I  already know that the result from an xdialog will always be a character string and 
      	'don't need a reminder. Besides, if you are running this check: IF some_var = "Fred", then 
      	'you can be pretty sure that some_var should be a character string. Using varC_some_var 
      	'adds nothing to that as far as I'm concerned.
      	DIM dlg_result as C
      	'The color list should be a crlf() list. Assume any commas need to be changed to a crlf()
      	color_list = stritran( color_list, ",", crlf() )
      	'Sort the list JIC.
      	color_list = sortsubstr( color_list, crlf() )
      	'Remove any leading or trailing blanks JIC.
      	'FYI: If it helps, consider the "line" variable here to be "line_in_color_list".
      	color_list = *for_each( line, alltrim( line ), color_list )
      	'FYI: Don't need to create an array - just use the list.
      	'FYI: Don't need to define a label name variable for buttons. Just put the name in the button definition.
      	'FYI: Regions are WAAAY overused. In most cases, they are only necessary to maintain 
      	'alignment of columns on multiple rows. This dialog has no such issue so all regions were removed.
      	'FYI: Added background color just to make it look better.
      	'FYI: I replaced {line=1,0} with {sp} only because I've been told it looks more modern to 
      	'eliminate the line. Also changed ysize to .3 rather than using multiple semicolons.
      	'FYI: I added an 'OK' button because some users prefer to select an item then click the OK 
      	'button rather than double clicking. (In this case I also reduced the size of the buttons 
      	'for aesthetic purposes only.)
      	dlg_code = <<%dlg%
      Double click on a color:;
      <10OK> <10Cancel>
      	event_code = <<%code%
      IF left( a_dlg_button, 6 ) = "colors"	'FYI: The "THEN" is not needed. So I leave them off.
      	IF a_dlg_button = "Colors_dblclick"
      		'FYI: Removed the 'selected' message that was really only useful for the developer.
      		'FYI: Since the user double clicked, that should be the same as selecting a color then 
      		'clicking 'OK' so set a_dlg_button to OK and we'll do more checking later.
      		a_dlg_button = "OK"
      		a_dlg_button = ""
      		'FYI: Setting color_select to blank is not necessary.
      	END IF
      	'FYI: I prefer using ELSEIF *unless* it's absolutely necessary to use a separate IF 
      	'statement. That way (1) it's easier to tell where the whole thing ends and (2) if I see a 
      	'new IF then I know that something (probably a_dlg_button in the case of xdialogs) could 
      	'have been changed in one of the previous statements - as above - and needs separate handling.
      'ELSEIF a_dlg_button = "Close"	'FYI: This whole ELSEIF section is no longer needed.
      '	Color_select = ""
      END IF
      'Once a color has been selected, verify that it's not on the 'not allowed' list.
      IF a_dlg_button = "OK"
      	IF is_one_of( color_selected, not_allowed_list )
      		msg = "The color " + color_selected + " is not permitted in this case." + crlf(2)
      		msg = msg + "Please select another color or press 'Cancel' to quit."
      		ui_msg_box( "SELECTION ERROR", msg, ui_attention_symbol )
      		a_dlg_button = ""
      	END IF
      END IF
      	dlg_result = ui_dlg_box( "Select Color", dlg_code, event_code )
      	IF dlg_result = "OK"
      		Color_select = color_selected
      		Color_select = ""	'FYI: This ELSE really isn't required. Just added it for clarification.
      	END IF
      END FUNCTION	'Color_select
      ui_msg_box( "RESULT", Color_select( "Red , Blue ,Green", "Green" ) )
      Take all the "FYI" stuff out - and the one ELSEIF section - and you will have a much shorter script and it would include all the comments I would normally include.

      If you have any questions about why I did something, post them and I'll do my best to explain my reasoning.

      By the way, to see it with "my" colors, check out the attached screen shot. I will be happy to send a color file (.a5t) to anyone that wants to use those colors.
      Attached Files
      Last edited by CALocklin; 08-13-2014, 01:19 PM.


        Re: Xdialog a_dlg_button

        Hi Cal,
        I have several lookup scripts that create xd's and all they need do is return a value for finding a record, so they seem to be good candidates for functions instead. In the script version I was dimming all variables used by the xd as shared, but in the function I set the arguments as Finian did so the script I call the function from, only needs to set
        dim lv as p = local_variables() for it to work.

        I like the idea of using dlg_result since it makes sense to use that with the dlg_title, dlg_body and dlg_event variables. Once I get the hang of writing my xd's this way it should be easier to convert the genie generated scripts.

        I am curious for the need to have so many empty regions, I usually just remove them.

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