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

Multi-select list on form via embedded xdialog

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

    Multi-select list on form via embedded xdialog

    I'm trying to create a multi-select list on a form. The only way I've found to do this is to embed an Xdialog supercontrol in the form. That part works. But I need to show/report which items in the original list were selected and keep the order of the original list. That requires knowing what the original list order was, as discussed here:

    http://msgboard.alphasoftware.com/al...ad.php?t=84693

    Therefore, I need to send 2 variables back to the form from the embedded Xdialog, the multiple selections plus the original list.

    I set up a form in a sample db to illustrate this, named some_new_form.

    If I click on the embedded Xdialog, I can return 1 of the variables back to the form via binding, but I can't manage to make the other one return. I've tried a lot of things, but nothing seems to work. Is there a limit on the number of variable bindings in an embedded xdialog? Based on the description at the top of the Embedded Xdialog window, which says "You can link variables in the dialog to fields and variables on the form by adding them to the bindings list", it sounds like binding multiple variables should work. But nothing I've tried let's me get more than 1 back.

    Can someone see a problem in what I've done or explain how to get more than 1 variable back from an embedded Xdialog?

    #2
    Re: Multi-select list on form via embedded xdialog

    Works in v9. Report it as a bug. I was also getting Unhandled exception errors which closed Alpha

    Edit: just tested in the new Beta patch and doesn't work there either.
    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: Multi-select list on form via embedded xdialog

      Thanks for the testing & feedback, Tim.

      I just tested it myself in v9 and it works for me as well. I'll report it.

      Comment


        #4
        Re: Multi-select list on form via embedded xdialog

        I took a look at the application and determined that the problem is that we *assume* the bound variables are passed in from the form (i.e. form determines initial values) - the xdialog gets set up *before* even the forms OnInit event occurs.

        Given that the design assumes that the xdialog first 'consumes' variables, after which we respond to changes, having the LIST reflected in the xdialog requires the form to initialize the list.

        I was able to get this working by Create an OnInit event for the form that looks like this:

        dim global vmyVar2 as c
        dim tbl as p
        tbl = table.open("anothertable")
        vmyVar2 = tbl.record_content_get("myfirstfield")
        tbl.close()
        vmyVar2 = line_insert(vmyVar2,"All",0)



        This xdialog code I changed to this:


        DIM item as c
        DIM vlist as c

        'IMPORTANT: Do not change the dialog title.
        ui_modeless_dlg_box(dlgTitle,<<%dlg%
        {watch=vlist}
        {background=<Transparent>}

        [%M%.40,5item^#vlist];
        {lf};

        %dlg%,<<%code%

        %code%)

        And the variable binding to this:

        item=VAR->vMyVar1
        vlist=VAR->vMyVar2


        Important to note - I needed to add a {watch=} expression to xdialogs list variable to address a caveat in xdialog - if no xdialog event has occurred, the xdialog does *not* check to see if the list has changed. On the plus side, changes to vmyvar2 made on the form get reflected in the xdialog when the user gives it focus.

        Comment


          #5
          Re: Multi-select list on form via embedded xdialog

          Thanks for taking a look at it and making a suggestion.

          Unfortunately, at least on my system, the suggestion doesn't work, assuming I copied/pasted correctly. I've uploaded a revision with your code in the OnInit event and a revised embedded Xdialog. In the RC, what I see happening is that only 1 of the 2 variables shows on the form. In my real work, I implemented your suggestion and had a slightly different result. I could get both fields to display, but only on the 2nd pass of displaying the form. The first time, the embedded xdialog was blank but clicking in it caused the entries to appear. Also, although I set the equivalent of vMyVar1 to a value, I couldn't get to show as selected on the form.

          The original code worked fine in ver 9, as Tim & I confirmed. Was this an intentional change in the way variable bindings worked from ver 9 to 10?

          Any other suggestions?

          Comment


            #6
            Re: Multi-select list on form via embedded xdialog

            You are correct - When I tested the form, I forgot to take into consideration that the variable in question is a global - so it was remembering the value from the *first* pass. If I start from scratch I have to run the form twice.

            This issue seems to be caused by a bug in form-embedded xdialogs - it appears that the watch on this xdialog is *never* being evaluated. I put a couple watches on the xdialog & none are ever getting evaluated, its as if the xdialog is locked, prevented from processing watch events- This is a bug that needs to be fixed & once it is fixed the example provided should work.

            Comment


              #7
              Re: Multi-select list on form via embedded xdialog

              I have a work-around that should work with the existing build the first time through.

              This uses direct binding to 'vMyVar2', instead of making a copy - my first attempt failed because the Global frame appears to be 'hidden' from the xdialog (another bug - which I am looking into). I got around this by getting an explicit pointer to the global variable frame, and accessing the globals through that pointer.

              DIM item as c
              DIM g as p = global_variables()


              'IMPORTANT: Do not change the dialog title.
              ui_modeless_dlg_box(dlgTitle,<<%dlg%
              {watch=g.vMyVar2}
              {background=<Transparent>}

              [%M%.40,5item^#g.vMyVar2];
              {lf};

              %dlg%,<<%code%

              %code%)


              Then you can remove the binding to vmyvar2, since it is being used directly.

              Comment


                #8
                Re: Multi-select list on form via embedded xdialog

                Bill,
                Although using the embedded xdialog gives you the added option of multi-select via highlighting, an embedded browse with checkboxes will do the same as the checkbox xdialog control....just another option if this doesn't work out for you.

                ...unless this is a networked situation--then, if the embedded xdialog is still unbound from a table it would be better. Which I guess is just a related question--Is an xdialog that is embedded in a form and bound to data still unbound to a table thus preventing networking issues?? Guess it would depend upon how the data is being bound to the xdialog. I could experiment but maybe someone knows already......
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Multi-select list on form via embedded xdialog

                  @ Cian - The workaround works. Thanks. One thing I'll point out for others following this: you have to set any default value for the field in the form (in this case vMyVar1) in the OnInit event. Another thing: because the xdialog assumes the variables are there even before the OnInit event, you can create the same affect by running any script that initializes the variables as globals as long as you do it before you open the form.

                  But that leaves unanswered this question: the original design worked in v 9. It changed in v 10. Was that intentional, because v 9 wasn't working the way it should? Cian, can you comment on that?

                  @ Mike - Ignoring the networked implications, it comes down to design preference. In another thread, you showed a big xdialog where you used checkboxes in a browse, but then you had to create a button to select "all". That button took up space and made the xdialog crowded, IMO. The checkboxes themselves took up horizontal space. By inserting "all" into the list and by avoiding the button, you save both horizontal and vertical screen real estate. And this technique was only required to put the selected items in the original list order. If you take out that consideration, it works even without Cian's workarounds. But your tip is a good one to add to the toolbag. You never know when you have to go digging in there for another tool.

                  Comment


                    #10
                    Re: Multi-select list on form via embedded xdialog

                    Hi Bill - form initialization has completely changed between v9 and v10 because of the browse rewrite, and because of the 'bound property' feature - variable update occurs at the same time as dynamic properties calculation - this was done to fix issues were variables were *not* being refreshed.

                    The issue I was seeing when I debugged the code is that it appeared that the xdialog was being initialized, then the binding occurred *after* the fact - at which point the binding needs to determine *which* variable/field is correct - it currently assumes that the form level variable/field WINS over the xdialogs variable.

                    V9 worked in this case because of a different ordering of operations, but has its own set of caveats.

                    The only design level change I can see making that could fix this ambiguity would be to make variable binding a separate pass, and do it BEFORE any of the controls are opened.

                    The Good news from this is that two serious bugs were uncovered and fixed as a result of this investigation:

                    1) {watch=} now works properly for xdialog supercontrols - the locked control issue has been resolved.
                    2) Global & Shared variables were *not* visible to the xdialog supercontrol (I tested this against v9 as well - it has the same problem) - in the next patch, they should work fine, which will eliminate the need to make 'bound' copies of the list variables in the first place, people will just be able to directly use the form variables to populate the listboxes. The 'selected' variable will still want to be bound, however since both the xdialog AND the form can change them.

                    Comment


                      #11
                      Re: Multi-select list on form via embedded xdialog

                      Thanks, Cian. That explanation is very useful. Great job on getting to the bottom of this so quickly.

                      Comment


                        #12
                        Re: Multi-select list on form via embedded xdialog

                        Cian, could you elaborate on the concept of "bound variables" and "binding variables" and "bound property"? Without experience using super-controls I"m having trouble following this discussion. Where might I turn for mor information on this? Thanks.

                        -- tom

                        Comment

                        Working...
                        X