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

Dropdown box not triggering the OnChange Event

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

    Dropdown box not triggering the OnChange Event

    Here is my form:
    The combo boxes labeled "Front/Back Color" are the problem




    I am having a problem getting my combox boxes to trigger my onChange event. The onChange event simply .Activate()s the next combo box on my form. The combo boxes are dynamically populated buy a function called in my OnArrive event

    Here's the function:

    Code:
    [COLOR=darkorange]FUNCTION SetInkColors AS V (form as C, field as C)[/COLOR]
     [COLOR=darkorchid]DIM pObj as P[/COLOR]
    [COLOR=darkorchid]DIM fld as C[/COLOR]
    [COLOR=darkorchid]DIM arrayFld as C[/COLOR]
    [COLOR=darkorchid]DIM selectedColors[5] as C[/COLOR]
    [COLOR=darkorchid]DIM color[19] as C[/COLOR]
     
     [COLOR=red]' Build a string containing the field name.[/COLOR]
     fld = ":"+form+":"+field
     pObj = eval(fld+".this")
     [COLOR=red]' Same as fld but doesn't include the last character of the field name.[/COLOR]
     arrayFld = substr(fld, 1, len(fld)-1) 
     
     
    [COLOR=red]' Initalize the color array with all of the possible color choices.[/COLOR]
     color.initialize(<<%list%
    Yellow
    Autumn Orange
    Red 185
    Flag Red 
    Rubine
    Burgundy
    Rhodamine
    Purple
    Violet
    Reflex Blue
    Turquoise
    Process Blue
    Medium Blue
    Sunlight Green
    Green 347
    Green 357
    Irish Green
    Dark Brown
    Gold
    %list%)
     
    [COLOR=red] ' Loop through the array containing all of the colors.[/COLOR]
    [COLOR=red] ' Compare the each color with the five color fields on the form.[/COLOR]
    [COLOR=red] ' IF we find a match... set that color = "".[/COLOR]
       FOR j = 1 TO 19 STEP +1
          FOR i = 1 TO 5 STEP +1
              IF (color[j] = eval(arrayFld+alltrim(str(i))+".value"))
                   color[j] = ""
              END IF     
           NEXT
        NEXT
     
     
    [COLOR=red]   ' Set the combobox =  CR-LF string of the colors left in the original [/COLOR]
    [COLOR=red]    array.[/COLOR]
    [COLOR=red]    '  The first element is a blank followed by CR-LF.[/COLOR]
    [COLOR=blue]    pObj.settings.dynamic_list = chr(13)+chr(10)+color.dump("R")[/COLOR]   
    [COLOR=darkorange]END FUNCTION[/COLOR]
    The line in blue is where I set my combo box list. I'm not sure if it's proper to add a chr(13)+chr(10) as the first item in the list... could this have anything to do with the problem??

    -- The first time you select a color from any of the combo boxes in EITHER "Front Colors" OR "Back Colors" you will see ALL of the colors in the dropdown list.
    -- After you select the first color it should be removed from the list for the next dropdown box.
    -- The idea is that the user shouldn't be able to select the same color twice for "Front Colors" OR "Back Colors".

    The problem can be repeated if you:
    1. open the OConfirm_Form
    2. click on the 3rd tab (Piece Description)
    3. click on the Add button
    4. Select a color from the top combo box under the label "Front Colors"
    5. Select a color from the combo box below the first selection.
    -- The very first item in the combo box list is a blank.
    6. Change the first (or second) combo box to the blank.
    -- Most of the time the OnChange event won't fire.
    -- The problem can occur on ANY of the combo boxes under "Front Colors" or "Back Colors".
    -- When the onChange event doesn't fire if you try to change the color you just set to blank back to the color it was before you "blanked" it, the list will not have been refreshed. This "Refreshing" occurs in the OnArrive event of each combo box.

    If anybody has any insight as to why this is happening I would be eternally grateful! Thanks in advance!

    #2
    Re: Dropdown box not triggering the OnChange Event

    UPDATE:

    The line in blue is where I set my combo box list. I'm not sure if it's proper to add a chr(13)+chr(10) as the first item in the list... could this have anything to do with the problem??
    It appears my hunch is right. I removed the chr(13)+chr(10) from the line of code that populates my combo box and it fixed the OnChange issue. This is still a problem because without the chr(13)+chr(10) I don't get a blank choice in my combo box and I need that so the user can clear the field if they choose a color and decide they would like to leave that field blank instead.

    Any suggestions?

    Comment


      #3
      Re: Dropdown box not triggering the OnChange Event

      Ok here's the simplified version of the question:

      Code:
      pObj.settings.dynamic_list = chr(13)+chr(10)+color.dump("R")
      color.dump("R") simply returns a CR-LF list of values stored in the array color[]. The "R" parameter forces dump to only return non-blank values.

      pObj points to a dropdown box (see pic in first post.)

      Having chr(13)+chr(10) in the parameter list simply adds a blank choice to the front of the list.

      My Problem:

      If I select a non-blank value from the dropdown and then go back and change my selection to the blank value 3/4 of the time it doesn't fire the OnChange event.

      Has anyone had this problem? Is this a bug? Help!

      Comment


        #4
        Re: Dropdown box not triggering the OnChange Event

        Originally posted by Jeff@Listbrokers View Post
        Ok here's the simplified version of the question:

        Code:
        pObj.settings.dynamic_list = chr(13)+chr(10)+color.dump("R")
        color.dump("R") simply returns a CR-LF list of values stored in the array color[]. The "R" parameter forces dump to only return non-blank values.

        pObj points to a dropdown box (see pic in first post.)

        Having chr(13)+chr(10) in the parameter list simply adds a blank choice to the front of the list.

        My Problem:

        If I select a non-blank value from the dropdown and then go back and change my selection to the blank value 3/4 of the time it doesn't fire the OnChange event.

        Has anyone had this problem? Is this a bug? Help!
        I created a test database to duplicate the problem, but in my test database, it works ok. I don't believe that there is a generic bug here.

        There may be something specific to your database, but since you did not post an example that shows how to duplicate the problem, we can't be sure.

        Comment


          #5
          Re: Dropdown box not triggering the OnChange Event

          Jeff:
          dump("r") would be appropriate when you do not know the number of non-blank lines in the array, but in your case, you do since the array is static. Therefore you do not need the "r" flag.

          Have you tried to initialize the array as:

          color.initialize(<<%list%

          Yellow
          Autumn Orange
          ....

          %list%)
          where you leave the first line blank?
          or use something other than blank to signify that it is yet to be determined, for example:
          color.initialize(<<%list%
          TBD (or "choose later")
          Yellow
          Autumn Orange
          ....

          %list%)
          Last edited by G Gabriel; 01-19-2007, 02:31 PM.

          Comment


            #6
            Re: Dropdown box not triggering the OnChange Event

            Originally posted by Selwyn Rabins View Post
            I created a test database to duplicate the problem, but in my test database, it works ok. I don't believe that there is a generic bug here.

            There may be something specific to your database, but since you did not post an example that shows how to duplicate the problem, we can't be sure.
            Selwyn,

            Oop!!! I forgot to append the database! My apologies! Here's a copy of the database. Thank you for looking at this.

            P.S. could you post a copy of the test database so I could compare?

            Comment


              #7
              Re: Dropdown box not triggering the OnChange Event

              bump

              Comment


                #8
                Re: Dropdown box not triggering the OnChange Event

                Originally posted by G Gabriel View Post
                Jeff:
                dump("r") would be appropriate when you do not know the number of lines in the array, but in your case, you do since the array is static. Therefore you do not need the "r" flag.

                Have you tried to initialize the array as:

                color.initialize(<<%list%

                Yellow
                Autumn Orange
                ....

                %list%)
                where you leave the first line blank?
                or use something other than blank to signify that it is yet to be determined, for example:
                color.initialize(<<%list%
                TBD (or "choose later")
                Yellow
                Autumn Orange
                ....

                %list%)
                Actually Gabe, the array isn't static. It works like this. There 5 dropdown boxes. There are a total of 20 values possible (including the blank). The first combobox gets populated with all 20 values. The OnChange event of the first dropdown makes the next dropdown .Active(). Then the OnArrive event of that dropdown populates it with the remaining 19 values, unless the first one is blank, in which case it gets all 20 values. The third dropdown gets 18 the fourth gets 17...etc. My function compares each value in the color[] array with the values from the dropdown boxes. When it finds a match it simply sets that particular value in the color[] array to "". I then use "R" to just return the non-"" values. It's kind of a mess... but it was the best I could come up with at the time.

                Comment


                  #9
                  Re: Dropdown box not triggering the OnChange Event

                  Jeff,
                  Any chance you could have the word 'blank' and then use an OnDepart field event: if field value = "blank" then set value to "" ?
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: Dropdown box not triggering the OnChange Event

                    Originally posted by Mike Wilson View Post
                    Jeff,
                    Any chance you could have the word 'blank' and then use an OnDepart field event: if field value = "blank" then set value to "" ?
                    hmmm... That's a good idea. I'd really like to get it to work without a work around though. It would be cleaner if it would just do what I tell it to!!! j/k:D If Sewlyn can't help me, then I'll give that a shot.

                    Thanks for the input!

                    Comment


                      #11
                      Re: Dropdown box not triggering the OnChange Event

                      Jeff:
                      When I say static I mean you are not dynamically populating the array, so there is no chance of blank lines. I am refering to the first one.

                      The purpose of the "r" flag is to eleminate blank lines from an array. When and why does that happen?
                      It happens because you have to determine the number of the lines in an array befoehand and if you populate it dynamically, for example from a table, then you might end up with blank lines. In this case, you are populating it with pre-detemined colors.

                      BTW, you could do the same thing and a lot easier by:
                      1-either use word_substract() to remove the used color from the first array, or
                      2-even easier, use array.delete()
                      instead of iterating over the array.
                      Last edited by G Gabriel; 01-19-2007, 02:21 PM.

                      Comment


                        #12
                        Re: Dropdown box not triggering the OnChange Event

                        Originally posted by G Gabriel View Post
                        Jeff:
                        dump("r") would be appropriate when you do not know the number of lines in the array, but in your case, you do since the array is static. Therefore you do not need the "r" flag.

                        Have you tried to initialize the array as:

                        color.initialize(<<%list%
                        TBD (or "choose later")
                        Yellow
                        Autumn Orange
                        ....

                        %list%)
                        Sometimes, it helps to read the responses!

                        Comment


                          #13
                          Re: Dropdown box not triggering the OnChange Event

                          I am not sure how Selwyn's response and your response to Selwyn got qued before my response?

                          When I entered my response, there was no response from anyone!

                          Comment


                            #14
                            Re: Dropdown box not triggering the OnChange Event

                            Originally posted by G Gabriel View Post
                            Jeff:
                            When I say static I mean you are not dynamically populating the array, so there is no chance of blank lines. I am refering to the first one.
                            By "first one" do you mean the color array or the first dropdown?
                            If you mean the color array, it get's populated with the same function that gets called from each dropdown. So I kinda had to make it a generic function.
                            If you're referring to the first dropdown... the user can actually select a value from any of the dropdowns in any order, so again, it had to be dynamic.

                            The purpose of the "r" flag is to eleminate blank lines from an array. When and why does that happen? In my case it happens when a user selects a color from a dropdown and the OnArrive event fires from one of the other dropdowns.
                            It happens because you have to determine the number of the lines in an array befoehand and if you populate it dynamically, for example from a table, then you might end up with blank lines. In this case, you are populating it with pre-detemined colors. And then removing some of the values from the array.

                            BTW, you could do the same thing and a lot easier by:
                            1-either use word_substract() to remove the used color from the first array.
                            I just found out about word_subtract() in another post today actually.
                            2-even easier, use array.delete()
                            Didn't know about this one either but, it doesn't look like array.delete() would have saved me from doing dump("R") would it? The documentation shows a picture of an array[4] with four values in it. After making a call to array.delete(2,2) it still appears the array is of size [4] with two blank values at the end. Using dump() without the "R" would probably produce a list with two blanks at the end right?
                            The <ARRAY>.DELETE() method deletes Count entries in a single dimensional array starting at Position. "Empty" entries in the array are closed up

                            instead of iterating over the array.

                            EDIT

                            Just a confirmation of my suspicion, I enter the following into the interactive window:

                            Code:
                            DIM a[4] as C
                            a[1] = "one"
                            a[2] = "two"
                            a[3] = "three"
                            a[4] = "four"
                            
                            a.delete(2,2)
                            ?a
                            = [1] = "one"
                            [2] = "four"
                            [3] = ""
                            [4] = ""



                            This was the best solution I could come up with with what I know. :)
                            Last edited by Jeff@Listbrokers; 01-19-2007, 03:17 PM.

                            Comment


                              #15
                              Re: Dropdown box not triggering the OnChange Event

                              Originally posted by G Gabriel View Post
                              I am not sure how Selwyn's response and your response to Selwyn got qued before my response?

                              When I entered my response, there was no response from anyone!
                              Strange! Everyone must have chimed in at the same time... It's amazing we can communicate. :p

                              Comment

                              Working...
                              X