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

How to reload a combo box in an xdialog?

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

    How to reload a combo box in an xdialog?

    I have an xdialog with 2 combo boxes. When the user selects an item from the 1st dropdown, I want to use that to filter the contents of the 2nd dropdown. I have an event that executes when the 1st dropdown is changed which applies the filter and rebuilds the array that the 2nd dropdown is based upon. However, when I then click on the 2nd dropdown the list is empty. Initially, it contains a list of unfiltered values. I have tried using ui_dlg_refresh() and ui_dlg_refresh_targeted(), but the 2nd dropdown won't display the list of filtered values in the array. Is there a way to refresh the contents of the 2nd dropdown in this scenario?

    I can't find a solution to my predicament in the xdialog sample app.

    Does anyone have a suggestion that may solve my problem? Please let me know.

    Thanks,
    Bob A.
    Robert Adler
    Alpha Anywhere Programmer/Developer
    Eagle Dbase Solutions, LLC
    http://www.eagledbasesolutions.com/

    sigpic

    #2
    Re: How to reload a combo box in an xdialog?

    You don't need a refresh, you need to trap the change in the first dialog. So...


    [Your_1st_dropdown_code!db_*];


    IF a_dlg_button = "db_change"
    'Your code to populate the 2nd DD
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com


    Comment


      #3
      Re: How to reload a combo box in an xdialog?

      Hi Peter,

      Thanks for your reply. What you suggest does make sense, but the 2nd dropdown renders empty after applying the filter, even though the array it's base on is populated.

      Do you have a working example that I can test on my computer, which is running Windows 8.1? I have experienced a few issues since upgrading, which I reported as bugs. Selwyn reported back that he is unable to duplicate the problem in Windows 7.

      Thanks!
      Robert Adler
      Alpha Anywhere Programmer/Developer
      Eagle Dbase Solutions, LLC
      http://www.eagledbasesolutions.com/

      sigpic

      Comment


        #4
        Re: How to reload a combo box in an xdialog?

        You're not going to believe me but I did this yesterday and i blew away all my samples. Just build a sample in the genie and then convert to xbasic. That's how I usually do it. The key is !db_*] (note: "db" is an arbitrary tag) followed by the:

        IF a_dlg_button = "db_change"
        Peter
        AlphaBase Solutions, LLC

        [email protected]
        https://www.alphabasesolutions.com


        Comment


          #5
          Re: How to reload a combo box in an xdialog?

          Bob,

          I think you may have the problem with
          (1) Event -
          (a) How and When does 2nd_Dropdown fire.
          (b) An array to get the 2nd_dropdown list after 1st dropdown is changed.
          How do you refresh the Array_list after changed the 1st_dropdown's value ?
          Where is located the action code? <=== this is Peter's comment
          If you have the "Array" to get the list code, try without an Array.

          (2) xdialog structure layout problem. from this sample,
          Code:
          vGetDivision_c = " "
          vGetDistrict_c = " "
          
          divchoices = <<%dlg%
          Central
          Dallas
          Fort Worth
          Gulf Coast
          Houston
          Northeast
          South
          Southeast
          West
          %dlg%
          
          centraldistchoices = <<%dlg%
          27
          31
          32
          33
          34
          36
          37
          95
          %dlg%
          
          dallasdistchoices = <<%dlg%
          12
          20
          21
          22
          50
          51
          90
          %dlg%
          
          result=ui_dlg_box("District ",<<%dlg%
          
          {xmargin=2,2}
          {region}
          {font=Arial,9,b}
          {frame=1,0:Select A Division}
          {font=Arial,9,n}
          [.20,10vGetDivision^#divchoices!vDiv_changed];
          {endregion}|{sp=5}|
          
          
          {region}
          {font=Arial,9,b}
          {frame=1,1:Select A District}{font=Arial,9,n}
          [.20,10vGetDistrict^#distchoices];
          {endregion};
          
          
          {lf};
          <7OK> <9Cancel>
          %dlg%,<<%code% 
          If a_dlg_button ="vDiv_changed" then
              msgbox("changed ","What is vgetdivision? "+vgetdivision)
          	SELECT
          		CASE vgetdivision = "Central"
          			distchoices = centraldistchoices
          		CASE vgetdivision = "Dallas"
          			distchoices = Dallasdistchoices
          		'ETC.
          	END SELECT
                  'It does not matter of the event_action type, It will not work.
          	'did not effected (refreshed)  the distchoices
              a_dlg_button =""
          end if
          %code%)
          In this xdialog, the 2nd_dlg value should be changed as I wished without problem. But It does not changed the 2nd dialog value.

          Comment


            #6
            Re: How to reload a combo box in an xdialog?

            As far as an array not populating after a change is concerned, it's possible, even required, that you use "REDIM Arr[0]", rather than DIM, inside the "Code" section. This has usually solved the problem for me.
            Finian

            Comment


              #7
              Re: How to reload a combo box in an xdialog?

              Finian,

              Thank you for comment

              that you use "REDIM Arr[0]", rather than
              which I did not know how to refresh an array list and gave up using the "ARRAY" .

              Comment


                #8
                Re: How to reload a combo box in an xdialog?

                After added the "dim" variable (distchoices) at beginning, it works well. Sorry about the confusing. enclosed revised code.

                Code:
                vGetDivision_c = " "
                vGetDistrict_c = " "
                
                dim distchoices as c =""
                'at start
                start =<<%start%
                Select Division
                %start%
                
                distChoices = start 'default value when start xdlg
                
                
                divchoices = <<%dlg%
                Central
                Dallas
                Fort Worth
                Gulf Coast
                Houston
                Northeast
                South
                Southeast
                West
                %dlg%
                
                centraldistchoices = <<%cent%
                27
                31
                32
                33
                34
                36
                37
                95
                %cent%
                
                dallasdistchoices = <<%dall%
                12
                20
                21
                22
                50
                51
                90
                %dall%
                
                Notlisted =<<%dnl%
                Not listed yet
                %dnl%
                result=ui_dlg_box("District Export",<<%dlg%
                
                {xmargin=2,2}
                {region}
                {font=Arial,9,b}
                {frame=1,0:Select A Division}
                {font=Arial,9,n}
                [.20,10vGetDivision^#divchoices!vDiv_changed];
                {endregion}|{sp=5}|
                
                
                
                {region}
                
                {font=Arial,9,b}
                {frame=1,1:Select A District}{font=Arial,9,n}
                [.20,10vGetDistrict^#distchoices!vDist_changed];
                {endregion};
                
                
                {lf};
                <7OK> <9Cancel>
                %dlg%,<<%code% 
                If a_dlg_button ="vDiv_changed" then
                    'msgbox("changed ","What is the vgetdivision? "+vgetdivision)
                	SELECT
                		CASE vgetdivision = "Central"
                			distchoices = centraldistchoices
                		CASE vgetdivision = "Dallas"
                			distchoices = Dallasdistchoices
                		case else
                			distchoices = notlisted
                	END SELECT
                	'did not effected (refreshed) with the datachoice
                	'2/7/14; after added the "dim" , distchoices it works well
                	
                    a_dlg_button =""
                end if
                
                If a_dlg_button ="vDist_changed" then
                    msgbox("check value","Division "+vgetdivision+" and District is "+vGetDistrict)
                    a_dlg_button =""
                end if
                %code%)

                Comment


                  #9
                  Re: How to reload a combo box in an xdialog?

                  Here's a simple example updating the 2nd box:
                  Code:
                  DIM SHARED Choice as C
                  DIM SHARED Result as C
                  DIM SHARED varC_result as C
                  DELETE a_Choice		
                  DIM a_Choice[4] as c
                  dim temp_list as c 
                  temp_list = <<%list%
                  Moe
                  Larry
                  Curly
                  Shemp
                  %list%
                  
                  a_Choice.initialize(temp_list)
                  ok_button_label = "&OK"
                  cancel_button_label = "&Cancel"
                  varC_result = ui_dlg_box("Alpha Five",<<%dlg%
                  {region}
                  Type prompt here:| [.40,5Choice^#a_Choice!choice_*];
                  Type prompt here:| [.40Result];
                  {endregion};
                  {line=1,0};
                  {region}
                  <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                  {endregion};
                  %dlg%,<<%code%
                  IF a_dlg_button = "choice_change"
                  	Result = Choice
                  	
                  	a_dlg_button = ""
                  END IF
                  %code%)
                  Peter
                  AlphaBase Solutions, LLC

                  [email protected]
                  https://www.alphabasesolutions.com


                  Comment


                    #10
                    Re: How to reload a combo box in an xdialog?

                    Hello guys,

                    Thanks to all who replied for your input. Here's the solution:

                    Once you have a filtered list (based on what you selected in the 1st dropdown) of choices for the 2nd dropdown, you have to do the following:
                    1. Get a count of items in the new filtered list: count = w_count(list, crlf())
                    2. Do an array.resize(count) to resize your array
                    3. Now rebuild the array with the updated list: array.initialize(list)

                    I was deleting the array and rediming it, which broke its link to the combo box control in the xdialog. That's why the dropdown had an empty list.

                    Peter, as far as using !db_* is concerned, I think it's better to use !db_change in the control's syntax and include code to capture that event. If you use !db_* and then only test for
                    a_dlg_button = "db_change" in your code, other events that the control kicks off won't be captured and the xdialog will close.

                    I hope this helps anyone who experiences this issue as I have.

                    Have a great day!
                    Bob A.
                    Robert Adler
                    Alpha Anywhere Programmer/Developer
                    Eagle Dbase Solutions, LLC
                    http://www.eagledbasesolutions.com/

                    sigpic

                    Comment

                    Working...
                    X