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

Set Default Values in an Xdialog Multi Select Checkbox List

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

    Set Default Values in an Xdialog Multi Select Checkbox List

    I do not think this is possible, but I have two situations I am trying to accomplish. One is to set some checkboxes of an multi select checkbox list in an xdialog to be checked as default values and then for another list to start with them all checked. I cannot even get one to show a check at this point. Is the default mode not available with this type of dialog?

    #2
    Re: Set Default Values in an Xdialog Multi Select Checkbox List

    Prepopulate the dialog return variable.

    Try this

    Code:
    cities = <<%dlg%
    Atlanta
    New York
    Los Angeles
    Boston
    Johannesburg
    Sydney
    %dlg%
    ui_dlg_box("Multi-Select List Box",<<%dlg%
    {wrap=30}
    [%M%.30,5cities_chosen^#cities];
    {line=1,0};
    This variable shows what entries in the above list box are selected.;
    [%mw%.30,5cities_chosen];
    <OK>
    %dlg%)
    Then this

    Code:
    [COLOR="#FF0000"]cities_chosen[/COLOR] = <<%dlg1%
    Sydney
    Los Angeles
    %dlg1%
    cities = <<%dlg%
    Atlanta
    New York
    Los Angeles
    Boston
    Johannesburg
    Sydney
    %dlg%
    ui_dlg_box("Multi-Select List Box",<<%dlg%
    {wrap=30}
    [%M%.30,5[COLOR="#FF0000"]cities_chosen[/COLOR]^#cities];
    {line=1,0};
    This variable shows what entries in the above list box are selected.;
    [%mw%.30,5cities_chosen];
    <OK>
    %dlg%)
    Sorry, you specified check box. Working on another example.
    Last edited by Stan Mathews; 12-16-2011, 02:09 PM.
    There can be only one.

    Comment


      #3
      Re: Set Default Values in an Xdialog Multi Select Checkbox List

      Checkbox example.

      Code:
      color2_selected = "Orange,Cyan"
      color2_selected = stritran(color2_selected,",",crlf())
      
      colors = "Red,Green,Yellow,Blue,Purple,Orange,Lime,Cyan"
      colors = stritran(colors,",",crlf())
      dim a_colors[20] as C
      a_colors.initialize(colors)
      dim a_selected[20] as C
      a_selected[1] = "Orange"
      a_selected[2] = "Cyan"
      ui_dlg_box("Check Box-List Box",<<%dlg%
      {frame=1,1}
      {region}
      This control uses the '^$$' directive.;
      [.25,10color2_selected^$$colors!select_color];
      {lf};
      Value of check box-list box variable:;
      [.25,10colorname^#a_selected];
      {endregion}
      %dlg%,<<%code%
      if a_dlg_button = "select_color" then
      a_dlg_button = ""
      a_selected.clear()
      a_selected.initialize(color2_selected)
      end if
      %code%)
      There can be only one.

      Comment


        #4
        Re: Set Default Values in an Xdialog Multi Select Checkbox List

        Stan, Thank you for this. I have only done xdialogs with action script. This will force me to finally learn to create this for myself. 2 Questions, is there a good tutorial/refrence on xdialog boxes, and how would you put one window next to another window in the dialog instead of them stacked ontop of each other? Thanks so much.

        Comment


          #5
          Re: Set Default Values in an Xdialog Multi Select Checkbox List

          There's quite an extensive learning xdialog tutorial.

          I find it best to create the xdialog with the action script genie and then capture the xbasic for the action script. Then tweak the xbasic.

          Code:
          color2_selected = "Orange,Cyan"
          color2_selected = stritran(color2_selected,",",crlf())
          
          colors = "Red,Green,Yellow,Blue,Purple,Orange,Lime,Cyan"
          colors = stritran(colors,",",crlf())
          dim a_colors[20] as C
          a_colors.initialize(colors)
          dim a_selected[20] as C
          a_selected[1] = "Orange"
          a_selected[2] = "Cyan"
          ui_dlg_box("Check Box-List Box",<<%dlg%
          {frame=1,1}
          {region1}
          {row1}
          {col1}{frame=1,1}{region2}This control uses the '^$$' directive.
          [.25,10color2_selected^$$colors!select_color]{endregion2}
          {endcol1}
          {col2}{frame=1,1}{region1}Value of check box-list box variable:
          [.25,10colorname^#a_selected]{endregion1}
          {endcol2}
          %dlg%,<<%code%
          if a_dlg_button = "select_color" then
          a_dlg_button = ""
          a_selected.clear()
          a_selected.initialize(color2_selected)
          end if
          %code%)
          There can be only one.

          Comment


            #6
            Re: Set Default Values in an Xdialog Multi Select Checkbox List

            Perfect. I need to dig into the tutorial. I see the col reference which I did not before. Thanks again.

            Comment


              #7
              Bump to Stan

              Stan,
              If this checkbox list were populated from a table and another field was to be returned - how would you display one field and return the other?

              Say the Table data is this

              01 Red
              02 Green
              03 Yellow

              If the user checks Red from the first list how would you show 01 was the selection in the other box?
              Robin

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

              Comment


                #8
                Re: Set Default Values in an Xdialog Multi Select Checkbox List

                I'd have to see the xdialog of what you are doing but in general, there are xdialog events to use. When the user makes a choice it sets or alters the value of a variable. You would need to capture that change and apply it appropriately to the other variable represented by the other box.
                There can be only one.

                Comment


                  #9
                  Re: Set Default Values in an Xdialog Multi Select Checkbox List

                  I found an example Selwyn did in the What's New in v10 section of the XD tutorial using {DATA=} with *FOR_EACH() on the elements initialized in a pointer array to create a CRLF List that is then used to populate the ListView control. I have been wondering how that could be done...and wouldn't you know there actually was an example!
                  Robin

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

                  Comment


                    #10
                    Re: Set Default Values in an Xdialog Multi Select Checkbox List

                    Robin,
                    I have been collecting multiple fields from table records using delineations within table.external_record_content() and then from the dialog box selections, going through string variable searching, parsing, and list building using loops, filter_string_smatch() and word(). The attached example is an example that emulates your question with a table having the fields color_id and color and a dialog that presents check boxes for the user to chose, but returns a list of the color ids from the colors selected. You could always do this with lookup() but this way, it is one opening of the table, collecting the list you need, and filter_string_smatch() replaces the lookup() and many table openings. It's pretty fast a long as your list isn't huge. Hope this helps.
                    Attached Files
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Set Default Values in an Xdialog Multi Select Checkbox List

                      Mike,
                      1st question: if vLpicks_N is used to populate vxy, why doesn't msgbox(vxy) show any values but msgbox(vLpick_N) does?

                      2nd question on this part:
                      vLNM=table.external_record_content_get("colors","cid+'^^'+alltrim(color)","color","")
                      for i=1 to w_count(vLNM,crlf())
                      vLpicks_show=vLpicks_show+word(word(vLNM,i,crlf()),2,"^^")+crlf()
                      next

                      Did you add the '^^' just so you would have a unique pattern to find? very clever...
                      So this is the part where you get both values but only display one?

                      3rd question on the last string manipulation:
                      vLpicks_N=""
                      for k=1 to line_count(vLpicks_M)
                      insearch="*"+alltrim(word(vLpicks_M,k,crlf()))
                      vLpicks_N=vLpicks_N+word(filter_string_smatch(vLNM,insearch,crlf()),1,"^^")+crlf()
                      next

                      I understand that when a checkbox is selected a value is returned and when it is cleared so is the value. But what is the '*' for? Which takes me back to my 1st question - why can't the value of vxy be captured?

                      I can see this will help my limited skills at string manipulation finally improve!
                      Thanks for the example.
                      Last edited by MoGrace; 01-24-2012, 01:41 PM.
                      Robin

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

                      Comment


                        #12
                        Re: Set Default Values in an Xdialog Multi Select Checkbox List

                        Robin,
                        1st question: if vLpicks_N is used to populate vxy, why doesn't msgbox(vxy) show any values but msgbox(vLpick_N) does?
                        >> The vxy^#vLpicks_N is a presentation list box only and with the %r% makes it read only. So the vxy is mearly a place holder. If the %r% was removed, selection of that listbox would populate the vxy variable (I think it wasn't even dimmed). The presentation listbox can be converted to just text presentation by replacing [%r%.25,20vxy^#vLpicks_N] with {text=30,25vLpicks_N};

                        2nd question on this part:
                        Code:
                        vLNM=table.external_record_content_get("colors","cid+'^^'+alltrim(color)","color","")
                        for i=1 to w_count(vLNM,crlf())
                        vLpicks_show=vLpicks_show+word(word(vLNM,i,crlf()),2,"^^")+crlf()
                        next
                        Did you add the '^^' just so you would have a unique pattern to find? very clever...So this is the part where you get both values but only display one?
                        >> The double carrots is the delineator for each field value within the record string. Filter_string_smatch() can accept find strings with wildcards which will extract the record line from the vLNM crlf() list based on the checkboxes selected. Then from that, the ^^ delineates the field values in that line so word() can be used to extract the field value that you wish.

                        3rd question on the last string manipulation:
                        Code:
                        vLpicks_N=""
                        for k=1 to line_count(vLpicks_M)
                        insearch="*"+alltrim(word(vLpicks_M,k,crlf()))
                        vLpicks_N=vLpicks_N+word(filter_string_smatch(vLNM,insearch,crlf()),1,"^^")+crlf()
                        next
                        I understand that when a checkbox is selected a value is returned and when it is cleared so is the value. But what is the '*' for? Which takes me back to my 1st question - why can't the value of vxy be captured?
                        >> You are correct that when a checkbox is selected a value is returned, but it is a multiselct checkbox, so the return is a growing (or shrinking) crlf() list. The loop captures each selections, the "*" is added a wildcard value because in the vLNM (List of Number and naMe), the record looks like:
                        010^^aqua
                        007^^black
                        003^^blue
                        009^^brown
                        012^^burgundy
                        etc

                        If you selected blue, to extract out the color id for blue, you first get the line that contains blue. The * provides the wildcard to do that. Then the ^^ provides the delineator to extract the color id from that wildcard extracted line.

                        Hope that helps.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: Set Default Values in an Xdialog Multi Select Checkbox List

                          Very clear explanation - Thank you Mike!

                          ps: don't eat too many of those double 'carets' ;)
                          Robin

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

                          Comment


                            #14
                            Re: Set Default Values in an Xdialog Multi Select Checkbox List

                            Mike,

                            Another Master piece xdailog example

                            Thank you Mike

                            Comment

                            Working...
                            X