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

<form>.new_record() and hide combo. Is this a bug?

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

    <form>.new_record() and hide combo. Is this a bug?

    Here is what happens...

    When a form goes into enter mode, the previous record is still displayed. This happens when hiding a combo box on a form using the 'OnEnterRecord' record event and <form>.new_record() form function. (This combo box is used for navigation on a form, so don't want it visible when in enter mode.) This problem does not show up using the navigation bar to enter a new record.

    To duplicate the problem, in the attached database, open the 'contacts' form and navigate to any existing record (either with the combo box or the navigation bar), and then click the 'new' button in the top right of the form. You will see the form go into enter mode, but still show the previous record. If you click the 'previous' button in the navigation bar, you will see the record number show the last record, indicating it went to a new record, but didn't show it. At this point if you use the 'next' button on the navigation bar, it works fine.

    Now, close the form and comment out the code in the table field rules 'OnEnterRecord' event, and try the same thing. Everything works fine (except, of course, the combo box isn't hidden). Is it a 'form' function conflicting with a 'table' event? Any comments?

    I submitted it as a bug report, but if anyone sees something I am doing wrong, please let me know.

    Thanks,
    Dan
    - Dan Hooley
    - Custom Desktop or Web database development -

    #2
    Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

    I took a look. The sample you posted does not seem to work as you describe, or I'm missing something. When I click the NEW button the new record begins, but the combo box does not get hidden. I suggest you unzip the file you uploaded to a new machine or folder and run it from there to see what I mean. Thanks.


    Later on...

    I guess I don't know what you mean when you say...

    "... still show the previous record"

    The form goes into enter mode the fiield values of the previous record no longer appear. However, the most recent selection in the combobox continues to be displayed.

    -- tom
    Last edited by Tom Cone Jr; 11-06-2009, 03:49 PM.

    Comment


      #3
      Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

      Dan, I could not find a way to hide the combo box and begin a new record. By the time the form processes the instruction to repaint the control the new record has already begun.

      I don't use field rules for this sort of thing, preferring not to bind field rule record events to specific form layouts...

      So, I've commented out the onEnterRecord event you wrote, and then modified the "New" button script as follows:

      Code:
      result = hidecombo(.t.)
      if result then 
      	parentform.resynch()
      	xbasic_wait_for_idle()
      	parentform.new_record()
      end if	
      
      Function hidecombo as L (hide_it as L)
      	if hide_it then
      	    'parentform:findcombo.hide()
      	    parentform:findcombo.disable()
      	    parentform:findcombo.refresh()
      	    hidecombo = .t.
      	else
      	    'parentform:findcombo.show()
      	    parentform:findcombo.enable()
      	   hidecombo = .f.
      	end if
      end function
      This will leave the combo showing, but disable it so the user can't do anything with it if they get bored entering the new record and start clicking just see what might happen.

      You'll need to enable the combo box again when the user saves or cancels the new record. HTH

      -- tom

      Comment


        #4
        Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

        Dan, this was bugging me, so to speak, so I took a second look. Your hoist by your own petard.

        Your form's OnFetch event is

        Code:
        topparent:findcombo.show()
        If you trace the events that fire when you push button1 ("New") you'll see that the form fires the onFetch event a couple of times after the button's onPush. Using my button script to hide the control (instead of your field rule) the effect is to hide the control, and then show it again.

        Later on...

        So, the answer to your orignal question is no. Not a bug.

        Here's a working example for you to play with. Again, pls note I am not using your field rule approach.

        HTH

        -- tom
        Last edited by Tom Cone Jr; 11-06-2009, 05:14 PM.

        Comment


          #5
          Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

          OK, comment out the OnFetch event. It has nothing to do with it. It works exactly the same. I only put that there to bring the combobox back when you click the previous or next buttons. The problem is not with hiding and showing the combobox, or what is displayed in the combobox.

          If it is not a bug, why does it work just fine using the nav bar, but not using the button on the form?


          The sample you posted does not seem to work as you describe, or I'm missing something. When I click the NEW button the new record begins, but the combo box does not get hidden. I suggest you unzip the file you uploaded to a new machine or folder and run it from there to see what I mean. Thanks.
          I unzipped it into a new folder and it works just as I described.
          Open the form, and click on the 'new' button on the form, not on the nav bar. It changes to enter mode, (and the combo box disappears) but the field values still show the values from the previous record. Click the 'previous' button on the nav bar, and record 11 appears, indicating it was in a new record, but did not clear the fields. This does not happen if I do not try to hide the combo box (comment out the OnEnterRecord code), or if I use the nav bar to enter a new record. Just on the 'new' button on the form.

          I guess I don't know what you mean when you say...

          "... still show the previous record"
          What I mean is; the field values still display the values from the previous record. Whatever record you were in before clicking the 'new' button, still shows in the new record.

          The form goes into enter mode the fiield values of the previous record no longer appear. However, the most recent selection in the combobox continues to be displayed.
          The problem is this doesn't happen. The field values from the previous record DO still appear.

          As far as your modification, the way I am doing it is part of a bigger scheme of things, that works on multiple forms, so I cannot just modify the code on that button. I just pared it down to this example to show the problem.

          Dan
          - Dan Hooley
          - Custom Desktop or Web database development -

          Comment


            #6
            Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

            Tom's solutions seems to work fine.

            Try this approach:
            comment out the onenterrecord event
            add topparent:Findcombo.HIDE() to the end of the script for the new button

            Comment


              #7
              Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

              Dan,

              I see the behavior exactly as you describe. Removing the code in the field rules eliminates the issue. I think there is a timing issue between the form and the field rule code. When a new record is started from the toolbar the form does not have focus so the new record command is given from a different context. However when using the form button the form has focus and the conflict happens. This is my best guess.

              I do my very best to not add code to field rules that interacts with the form. It may very well work in many situations but I don't think field rules were intended for the application layer (ie forms and user interfaces). I see them as analogous to triggers and stored procedures in the SQL type databases. That is to manipulate the data at the table level.

              So I would not really consider it a bug. Maybe a limitation. It is also one of those areas that could change down the track when Alpha code gets tightened up. Either allowing it to work or not allowing something that does work now.

              Probably not what you want to hear. Sorry.

              Another way to hide your combo box is to place it on a conditional object. That way you don't need to adjust your code at all. For the expression use:
              Code:
              topparent.mode_get() <> "View"
              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


                #8
                Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                Hi Tim,

                Thanks for the reply. I wonder too if it has something to do with timing. At least you were able to see what I am talking about.

                I had thought of the conditional idea, and will explore that route, or just disable the combo box. Disabling seems to work, which seems odd. I still think, bug or not, it should not act that way. But I might still have to rethink the way I am doing things and see if I can improve it so I don't have to use field rules. It was just working so beautifully until I ran into this problem. Thanks again for your time. Will see what I can figure out.
                Dan
                - Dan Hooley
                - Custom Desktop or Web database development -

                Comment


                  #9
                  Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                  The problem is this doesn't happen. The field values from the previous record DO still appear.
                  The problem is this doesn't happen. The field values from the previous record DO still appear.
                  Dan, I'm sorry to have annoyed you. What you report is NOT what I saw on my XP Pro SP3 machine. Won't bother you again. -- tom

                  Comment


                    #10
                    Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                    was out for the weekend...

                    no problem, tom. I guess we were just not on the same page.

                    I am not arguing with the idea of not using field rules to control forms, but just for interest sake, if you try this simple test;

                    In my attached database, in the OnEnterRecord table event, change frm:FindCombo.hide() to frm:FindCombo.disable(), then in the OnFetch event in the form change topparent:FindCombo.show() to topparent:FindCombo.enable() and the problem goes away. By the problem I am talking about the fields showing the values from the record you just came from instead of being cleared like it should for a new blank record.

                    This seems (IMHO) at the very least like an inconsistency in the program. Why would disable/enable work, but not hide/show? This took me a long time to test and figure out, and I don't think it is anywhere in the documentation.

                    Dan
                    Last edited by danh; 11-09-2009, 05:21 PM.
                    - Dan Hooley
                    - Custom Desktop or Web database development -

                    Comment


                      #11
                      Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                      Dan,

                      Using your original database example I get different behavior than you describe.

                      1) the code in the OnEnterRecord event does not hide the combo box. [ this I thought was the original problem, for which I've previously offered an alternative approach ]

                      2) the data entry fields in the form do NOT retain the previous record's field values when the NEW button is pushed. The form goes into ENTER mode normally, and the data entry fields are blanked out, ready to receive new input; and, the next autoincremented customer id appears in place. [ pdf image of what I'm saying is attached ]

                      I do not know why the previous record's field values persist for you. I'm running XP Pro SP3 and build 2095 / 3264 of Alpha Five vers 9.

                      -- tom

                      Comment


                        #12
                        Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                        Tom,

                        It must be an environment thing, ie our machines. As noted previously I see the same as behaviour as Dan. I am running the same build as you but on Vista.

                        Edit: I told a lie.
                        On XP Pro SP3 and build 2095 / 3264 I see the same as Dan
                        On Vista Business SP1 and build 2095 / 3264 I see the same as Tom
                        Last edited by Tim Kiebert; 11-09-2009, 07:05 PM.
                        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


                          #13
                          Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                          I'm running:
                          Alpha Five Version (Registered): 9
                          Build: 2095
                          Addins: 3264
                          Operating System: Microsoft Windows XP Professional Service Pack 3

                          I had stated earlier that the code in the OnFetch event had nothing to do with it, and for me it doesn't, but I'm wondering now if in Tom's case and Tim's Vista case maybe its bringing the combo box back. Still doesn't explain the field values not clearing, but might have something to do with the combo box not getting hidden.

                          I'm a little unsure when exactly the OnFetch event is supposed to fire. It fires when you move from record to record, but on my computer it doesn't fire when you move to a new record. Is that the way it's supposed to act? I guess it is not actually "fetching" another record so maybe so. I've ran into this before where it doesn't seem to fire when entering a new record. But maybe it does sometimes. Any comments?

                          Dan
                          - Dan Hooley
                          - Custom Desktop or Web database development -

                          Comment


                            #14
                            Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                            I'm running:
                            Alpha Five Version (Registered): 9
                            Build: 2095
                            Addins: 3264
                            Operating System: Microsoft Windows XP Professional Service Pack 2

                            I get different results when I add debug to your new button.

                            debug(1)
                            topparent.new_record()
                            Debug(0)

                            Executed line by line the program appears to work correctly (as anticipated). Comment out the debug and the errors you report appear. Could this be a timing issue?

                            Comment


                              #15
                              Re: &lt;form&gt;.new_record() and hide combo. Is this a bug?

                              A further complexity. I'm running vers 9 with the new browse object. Wonder if that accounts for the different browse behavior I'm seeing here?

                              -- tom

                              Comment

                              Working...
                              X