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

Almost There

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

    Almost There

    This is in reference to a previous thread re: the font equation on a checkbox field not working. Tom Cone suggested a work around.

    I copied the code, created a variable and changed a few names to protect the innocent. It does change the color and font size, etc. but even though the record is saved before and during the close of the form, when the form is repopened, the checkbox is reset to False. It's as if someone changed the check mark from .t. to .f..

    Any idea what's causing the record to reset the checkbox to .F. when closing or opening the form?

    Thanks,

    kenn
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    #2
    RE: Almost There

    Ken,

    check the properties of the variable, and the onInit event for the form. either or both might be setting the value false ... this is how I did it on my example...

    -- tom

    Comment


      #3
      RE: Almost There

      Tom,

      I checked your example form's Oninit event as well as all the form's events and found no code. I also checked the variable's properties and don't see where a default setting could be placed. (Incidently, the same thing happens with your example)

      All I copied was the code and then simply changed the names. Since I didn't use your form and I created a variable, I don't understand how this could affect my form or variable.

      It's got to be in the code so I tried commenting out the last line (refresh). That had no effect.

      What else might I try on this treasure hunt?

      Thanks much,

      kenn
      TYVM :) kenn

      Knowing what you can achieve will not become reality until you imagine and explore.

      Comment


        #4
        RE: Almost There

        Ken, my memory let me down.

        The example I posted was called colortest3.zip. It contained one form. That form contained one checkbox, called Checkbox1. The checkbox was based on a variable called Test2, which I set false in the definition of the variable for this layout. This explains why my form always shows the checkbox as false when it first opens. The var is being set false by Alpha Five when the form opens. This much I remembered correctly. However, it's not being done in the OnInit script for the form, it's being done by the variable definition.

        In your case it sounds as though one of two things is happening:

        1) the logical field in your table contains the right value, but the form is displaying the wrong value. This could be caused by a corrupted form I suppose. More likely it's a problem with scripts in the form. Something in OnInit, OnActivate, or OnFetch that's stuffing a false value into your field. If this is happening it should force your record into change mode. If you close the form do you get a prompt to save changes even if you haven't made any changes on purpose?

        or

        2) the checkbox is displaying the correct value from your table, but it's different than you are expecting because a field rule is stuffing a false value into the field.


        I'd have to see the database to troubleshoot this further.

        -- tom

        Comment


          #5
          RE: Almost There

          Tom,

          My Close button had code built in to prompt for saving the record so I commented it out and created a close button w/the genie. The result; No, I am not prompted to save the record.

          This is my code on the OnInit event. I commented out the last 3 lines but that didn't solve the problem.

          t = table.current()

          ''
          '' Get the current record count
          ''
          i = t.index_primary_get()
          count = i.records_get()

          ''
          '' If there are no records then disable change/enter
          ''
          if count = 0
          topparent.allow_change(.F.)
          end if
          -----------------------------
          Cancel() is the code on the CanExit event but that is to disable the x (close) and I did comment it out but again, nothing.
          --------------------------------
          this.resynch()_ is on the OnActivate event. Again, nochange.
          ------------------------------
          That's all the code on the form.

          I created a checkbox field on the form (not a variable) and put the code in the OnChange event for a trial run. Interesting thing happens; The code makes the proper changes, I save the record and then close the form. When I re-enter, the checkbox value is still .t. but the font is back to default.

          Thanks,

          kenn
          TYVM :) kenn

          Knowing what you can achieve will not become reality until you imagine and explore.

          Comment


            #6
            RE: Almost There

            Ken,
            To my knowledge, check boxes have never worked. I posted a bug report about this in version three (I think Eisenhower had just taken office). For example, put a cancel() command in the CanArrive event of your check box--should prevent user-entry under any circumstances. I think you'll find that it fails. Same with color equations.

            I've been coding my own check boxes for so long, I'd almost forgotten about this. BTW, version five.....same thing. But who knows, could be working its way up the bug list.

            Comment


              #7
              RE: Almost There

              Hi Steve,

              Thanks for the info. For me, the color equation has always worked. It's the font equation that doesn't work.

              However, in this situation, I've been using code that Tom Cone supplied (Attached zip file on above post). I doubt there is anything wrong with the code cause it's pretty basic and does work very well. The problem is that even after saving the record, closing and then opening the form, the checkbox reverts back to it's original state (if it was created with a variable). If it was created with the tool bar, it will stay .t. but the code doesn't stay put, if ya know what I mean.

              kenn
              TYVM :) kenn

              Knowing what you can achieve will not become reality until you imagine and explore.

              Comment


                #8
                RE: Almost There

                Ken,

                why not post a working model here so we can see what you're talking about.

                In some of your posts I got the impression you were setting the checkbox with a field value from your table, now it sounds like you're using a variable on the form.

                You're describing a disconnect between values in the table and values displayed on the form through the checkbox, and we need to see how you have got it lashed together.

                -- tom

                Comment


                  #9
                  RE: Almost There

                  Tom,

                  The reason why the checkbox was resetting to .f. was because of the default valure of .F. in the variable setup (clicking V on the icon bar). Once I deleted the F, it now saves the value when it's checked to .t..

                  The code works when the checkbox is checked to .t., but when going to design view or closing the form, the code disengages.

                  Attached is the zip file you sent. Notice the checkbox will now retain the .t. value. When you open the form, if the checkbox is already checked to .t., notice the code for the font is disengaged. Click the check box to .t.. Notice the font is engaged. Save the record. Go to design view or close and reopen the form. Notice the code is now disengaged.

                  Thanks,

                  kenn
                  TYVM :) kenn

                  Knowing what you can achieve will not become reality until you imagine and explore.

                  Comment


                    #10
                    RE: Almost There

                    Oooops,

                    Forgot the file so it's here.

                    kenn
                    TYVM :) kenn

                    Knowing what you can achieve will not become reality until you imagine and explore.

                    Comment


                      #11
                      RE: Almost There

                      Ken,

                      I took a look at your file.

                      I am glad you agree with what I said earlier. The variable Test2 was being set
                      false when the form opens because of the way the variable is setup. You've
                      now changed it to a default value of True, which is fine.

                      I am not familiar with the concept of code disengaging, but my guess is that
                      when you say 'the code disengages' you mean that the color and
                      font of the checkbox no longer match the current value of the variable. This is
                      noticed when the form initially opens, or on returning from design mode.

                      Even though you don't say so, it's beginning to sound like you want the checkbox to be
                      set a particular way when the form opens. This should be very easy.

                      It's not happening now because the only code in the form that affects the color
                      and font properties of the checkbox object is in the OnChange event of that object.

                      Since the checkbox doesn't 'change' when you open the form, the OnChange event
                      doesn't fire. Similarly, it won't fire when the user fetches another record, or returns
                      from design mode. The onChange event of the checkbox fires when the user checks
                      or unchecks it. when this happens the color and font script seems to work ok.

                      So, why not use the OnInit event of the form to:

                      a) set the desired beginning value of the Test2 variable; and
                      b) set the desired font and color scheme for the checkbox ???

                      I would replicate the OnInit code in the OnActivate event for the form, too.

                      In each case the script used in the OnChange event for the checkbox object may be a
                      good starting point. It may have to be modified because the context is different, of
                      course. In the OnChange event focus is on the checkbox. In the OnInit and OnActivate
                      events, the focus is on the form, instead.

                      You may also want to re-set the value of the Test2 variable when the user pushes
                      the Save button, and will need to repaint the checkbox object then, too. Again,
                      pay attention to the context of the OnPush event for that button. It's different
                      from the checkbox and it's different from the form.

                      Have fun!

                      -- tom

                      Comment


                        #12
                        RE: Almost There

                        Tom,

                        ...Even though you don't say so, it's beginning to sound like you want the checkbox to be set a particular way when the form opens...

                        No, it only is to change when the checkbox is clicked to .t.. As long as the value is .t., the color and font should remain.

                        I'll work with the rest of your suggestions and see what I come up with. It's too bad the font equation of the checkbox doesn't work. Life, in regard to the checkbox, would be so much easier.

                        Thanks much,

                        kenn
                        TYVM :) kenn

                        Knowing what you can achieve will not become reality until you imagine and explore.

                        Comment


                          #13
                          RE: Almost There


                          Ken,

                          We're talking at cross purposes.

                          You say:

                          ...it only is to change when the checkbox is clicked to .t.. As long as the value is .t., the color and font should remain...

                          To me this definitely means you DO want the checkbox to be set in a particular way when the form opens. Since the value of the form level variable is not being saved when the form closes, it is likely the form level variable is being re-set each time the form opens, I think you may need to take that into consideration and paint the checkbox to suit each time the form opens. For example, if the user sets the variable false, and then closes the form you might want the form to open up the next time with the variable false and the checkbox painted accordingly. To do this you'd have to save off the variable value somewhere, read it back in when the form opens next time, and adjust (repaint) the checkbox accordingly. Similarly, if the user sets the var true, you might want the form to open up the next time with the variable true, and the checkbox painted accordingly.

                          -- tom

                          Comment


                            #14
                            RE: Almost There

                            Ken,

                            The checkbox behaves better on form load if you simply copy the onChange event script for the Checkbox and paste it into the onActivate event for the form itself. No other edits required.

                            The effect of this is to set the color and font of the checkbox when the form is activated, using color and options that vary according to whether variable Test2 is true or false. Thereafter, each time the checkbox is changed the variable is re-set, and the onchange event for the checkbox repaints the control.

                            -- tom

                            Comment


                              #15
                              RE: Almost There

                              Hi Tom,

                              Took a brief break from Saturday chores (more like a 'honey dooo') to check the board. I tried your suggestion and it works beautifully. You went above and beyond the call of duty.

                              Thank you very much. Your efforts are well appreciated!!!

                              kenn
                              TYVM :) kenn

                              Knowing what you can achieve will not become reality until you imagine and explore.

                              Comment

                              Working...
                              X