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

Disable A Button

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

    Disable A Button

    Hi
    I have a field called Email in my customer table and a
    button labeled Email I want to disable the button using Xbasic if the field email is blank and I don't want to have
    to exit the field for the disable to work

    Any Help
    Ray

    #2
    RE: Disable A Button

    Ray,

    You can disable a button and you can also hide it. My choice would be to gray out the text on it which would give the user feedback on what's happening, namely that an option (pressing the button) doesn't exist except when it makes sense.

    All of the above is your choice.

    The heart of your question boils down to where to attach the code. I think you need to put it in three places: the form's on_ini, on_activate, and on_fetch events.

    As for the code, because it is attached to form events, the context of the code is the form itself so you would use the "this" alias instead of parentform or the form's actual name. (For more on this look in the xbasic manual under relative addressing.)

    Here is the pseudocode:

    If the email field is blank
    disable the button
    otherwise
    enable the button

    This should ensure that when you start the form (onini), or if you come back to it from another form (onactivate) or as you use it to navigate among records the email field will be checked out and the button configured as appropriate.

    Is this enough to get you started?

    Bill
    Bill Hanigsberg

    Comment


      #3
      RE: Disable A Button

      Hi Bill
      Thank you for you'r reply but could you show me an the code
      I should use.

      Thank you

      Comment


        #4
        RE: Disable A Button

        Ray, visit the Code Archive and check out my Basic Data Entry example.

        Buttons are hidden and shown, and disabled and enabled. Open the form in design mode and study it to your heart's content.


        -- tom

        Comment


          #5
          RE: Disable A Button

          Ray,

          Tom is right. Check out his example as there is much to be learned from it. Meanwhile, I made you a little demo.

          There is a form with two fields one of which is email. The button properties are varied based on the whether there is anything in the field. If email is empty the button is disabled and the font grayed out. Otherwise the button is enabled and the font darkened. I stuck a sound on the button so you could prove to yourself that it is in fact disabled-enabled.


          As Tom is always careful to advise, put unzip the demo into a separate folder where it won't get mixed up with anything important.

          Bill
          Bill Hanigsberg

          Comment


            #6
            RE: Disable A Button

            Hi Bill
            Thank you very much for the form I looked at your form it
            work's good but when I copied the code and made the necessary changes for my form I get an error the error is

            Error
            Script:onchange line:1
            If this:Email_Address.text=""
            this Email_Address not found

            Bill I don't no if this matters but my field and button are
            on a tab sub form

            Any help
            Ray

            Comment


              #7
              RE: Disable A Button

              Ray, when you start to write scripts which reference objects on your form, and objects in objects on your form, it's important to understand the 'name game'.

              Check out Chapters 4, 5, and 6 of the Xbasic Reference Manual, especially chapter 6. Bill's script is referencing objects on his form. You have to modify it to reference objects on yours...

              -- tom

              Comment


                #8
                RE: Disable A Button

                Ray,

                Tom has offered his usual good advice. As he says it is absolutely essential to read. Life is too short to do this stuff by trial and error because there are more wrong ways than right ways to do it.

                I would only add that it is unnecessary to actually type these addresses yourself. Learn to use the xbasic explorer.

                Open your form in design mode.
                In the xbasic explorer find objects and then your form.
                Expand the tree of objects.
                Drag any of an object's properties to the code window and you will see its full address.

                I did exactly this when I produced the little example for you. I then modified the addresses to incorporate the aliases, "this" and "parentform".

                The interface will be even better in version 5 but you will still need to read. (Is the fact that I'm a teacher still showing?)

                Bill
                Bill Hanigsberg

                Comment


                  #9
                  RE: Disable A Button

                  Hi Bill
                  Thank you very much I don't no y we have to change the color with code when we disable it that should be automatic I would think at lest it's that way with Microsoft VB ONE LESS STEP A DAY 352 LESS STEP'S A YEAR

                  Thank you very much
                  Ray

                  Comment

                  Working...
                  X