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

Character formatting using an event

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

    Character formatting using an event

    Hi,

    I've seen derivatives of this thought, but nothing specific to what I'm looking for - but I can't say my search skills here are stellar...

    Anyway, I'd like to use something like W_UPPER() with either the OnChange or OnDepart event for a field... essentially, I want to be able to change the case of characters in a field the user just entered, WITHOUT using field rules (I want to let the user set a flag that will allow an override of the automatic formatting if necessary). The field rules are a bit too rigid and unforgiving.

    If anyone can shed some light on the subject or point me in the right direction, I'd appreciate it.

    #2
    Re: Character formatting using an event

    Originally posted by smrogers View Post
    Hi,

    I've seen derivatives of this thought, but nothing specific to what I'm looking for - but I can't say my search skills here are stellar...

    Anyway, I'd like to use something like W_UPPER() with either the OnChange or OnDepart event for a field... essentially, I want to be able to change the case of characters in a field the user just entered, WITHOUT using field rules (I want to let the user set a flag that will allow an override of the automatic formatting if necessary). The field rules are a bit too rigid and unforgiving.

    If anyone can shed some light on the subject or point me in the right direction, I'd appreciate it.
    it is pretty easy.

    for example, put this in the onDepart event of a control on the form:


    Code:
    this.text = upper(this.text)

    Comment


      #3
      Re: Character formatting using an event

      May I add?

      If you need a flag of some kind you will have to make it up a bit.

      I only use it in field rules on certain fields(most). I use the word mostly, but if you type in

      harvey - results = Harvey
      hArvey - results = HArvey

      In the ondepart event you could have something like

      if flag="x" then
      upper(this.text)
      end if


      .
      Dave Mason
      [email protected]
      Skype is dave.mason46

      Comment


        #4
        Re: Character formatting using an event

        Selwyn and Dave, I appreciate your interest in my issue. While I'm getting better at XBasic, I still often rely on starting with an action script then analyzing the xbasic is generates to figure out how things work. In this instance, I understand what your saying I should do and pretty much get the logistics on how to do it... here's my problem. The syntax your using, i.e. 'upper(this.text)' is a bit general. What do I replace with 'this' and 'text'? The fieldname? Or is that litteral? Thanks very much again for your help (and everyone else's)... the reason I continue to praise the software

        Comment


          #5
          Re: Character formatting using an event

          Shawn, that's a pretty good question. Check the help file topic on "Relative Addresses"

          THIS is a reserved word that has special meaning depending on the context. Selwyn's script runs in an event tied to an object on the form. The OnDepart event. THIS in his script refers to the CURRENT OBJECT which is the text box the user has just edited.

          Comment


            #6
            Re: Character formatting using an event

            As always, thanks Tom!

            Comment


              #7
              Re: Character formatting using an event

              Hi - thanks for that Info again, Tom... I guess I'm having some kind of syntax problem, because I'm not getting it to work correctly. The object is a type-in-field, and I have a simple, one-line script attached to the OnDepart event, which is simply

              upper(this.text)

              When I go to the next object (another type-in-field), nothing changes; it remains as it was. What do you suggest I look at next?

              Thx.

              Comment


                #8
                Re: Character formatting using an event

                Two corrections.

                1) use the CanDepart event instead of OnDepart. OnDepart fires too late. Focus is already on the next object.

                2) use Selwyn's code (all of it).

                And one suggestion:

                Condition the script so it doesn't run unless the form is in ENTER or CHANGE mode.

                Comment


                  #9
                  Re: Character formatting using an event

                  Continued thanks for your attention to this Tom.

                  It still isn't working, and can't figure out why. I've attached a small, sample database using the exact code I'm using in my live database. The table has three fields, and the simple form has the exact code I used in my live database (sans the CHANGE or ENTER checking) attached to the CanDepart event. Still no go - when you type everything into the field in lowercase, and then move on to the next field, nothing changes.

                  If you have a chance, please give this a lookover and let me know what I'm doing wrong. Thanks again.

                  Comment


                    #10
                    Re: Character formatting using an event

                    Shawn,

                    Selwyn's code was this:
                    Code:
                    this.text = upper(this.text)
                    You only used part of it, like this:
                    Code:
                    upper(this.text)
                    You missed the point when I suggest you use "all" of Selwyn's code in my previous post?

                    What Selwyn's code does is boost the characters to upper case letters and then assign the changed characters to the text property of the current object. Your code was incomplete. It failed to assign anything to the text property of the current object. Does this make sense? (Don't be embarrassed to ask further questions. This is fundamental. Let's answer all your questions, ok?)

                    -- tom

                    Comment


                      #11
                      Re: Character formatting using an event

                      As Homer Simpson would say, "Doh!"

                      If I understand correctly, this.text literally represents the text in the object, and by saying this.text = upper(this.text), you are saying "the text in this object is equal to upper(this.text)" i.e., it's = to this format, or whatever... correct?

                      I get it now. Thanks as always Tom.

                      Comment


                        #12
                        Re: Character formatting using an event

                        Shawn, it will serve you well if you abandon notions of equality in this context. The equals sign is an "operator". It assigns whatever is on the right hand side to whatever is on the left hand side.

                        In other contexts the equals sign is used to compare two values, as in

                        Code:
                        if A = B then
                            do something
                        else
                            do something else
                        end if
                        In your form each object you place in the layout has it's own collection of properties. Some describe the color, position, font, etc. Others describe the "content" entered by the user. For a text box object like you're using, the TEXT property always holds the string of characters entered by the user. To change it with a script you reference the TEXT property like so:

                        Code:
                        :form_name:object_name.text
                        using a period or dot to separate the property from its object; and colons to separate the objects from each other.

                        We use THIS in your script because it's convenient. THIS is a relative alias for the object name.

                        If we want to write a script that assigns the character string "BOO" to the object we write

                        Code:
                        :form_name:object_name.text = "BOO"
                        I recommend you spend some time in the Xbasic reference manual reading up on Objects and Object Addresses. It will pay dividends for you.

                        Comment

                        Working...
                        X