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

Field entry in Upper Case

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

    Field entry in Upper Case

    Hi - I had a problem, to which I've already found a solution (ableit a slightly unexpected one). I'd appreciate some feedback though, as to whether I've missed anything obvious .. or whether what I'm attempting to do can be achieved more easily in A5 v10 (I have A5 v9).

    Problem : To force entries in a character field into UPPER case as the user types, whilst allowing spaces, brackets and other symbols.

    First attempt : Use the Field Rules, selecting "Case Convert". However, this accepts characters in lower case then transforms them once the field is complete .... which I find Messy !

    Second attempt : Use a simple Mask in the Data Entry options. I selected 'N' for every character in the field as the Help file says this allows ... [N = Any uppercase letter, digit, sign or decimal]. However, it actually disallows spaces and other symbols such as brackets (only allows letters and numbers) .. and in addition only pushes the first character of the string into Upper case !

    Third attempt. Using an excellent function from Ira Perlow (Keyboardstate), I detected the status of CAPS LOCK. If the keyboard is in lower case mode, I switch the keyboard into 'CAPS LOCK ON' mode temporarily for Data Entry purposes using sys_send_keys("{CAPSLOCK}").

    All of this seems a bit of an overkill for what should in my opinion be a staple choice for field entry (either in the dictionary or an form level). This contrasts markedly with other database / development systems I've used in the past which have an option to force Upper Case at the field-entry stage.

    Some questions then - 1) Have I missed something obvious, particularly with regard to my understanding of the Mask facility in Field Rules and 2) If not in v9, is the faciilty I'm after available in v10 ?

    Depending on your responses, I've a feeling that this may end up in the Features-Wishlist pile !

    Regards to all, Jem

    #2
    Re: Field entry in Upper Case

    Problem : To force entries in a character field into UPPER case as the user types, whilst allowing spaces, brackets and other symbols.
    What is the point?

    If you want all uppercase stored in your table there are multiple ways to force that. One would be to code the cansaverecord event in the field rules.

    tbl = table.curent()
    tbl.yourfieldname = upper(tbl.yourfieldname)

    If you want to see only uppercase no matter what is stored in the field there is the display format UPPERCASE for objects on layouts.
    There can be only one.

    Comment


      #3
      Re: Field entry in Upper Case

      Hi Stan,

      The point of what I'm trying to achieve is for any given format (UPPER, Lower, Sentance Case etc.), to have the field enforce the formatting as the user types, not perform a case conversion as the user leaves the field.

      It's a matter of personal preference I guess, but as I said in my original post, I find the "type-whatever-then-convert" concept messy, and users invariably ask me why their app. behaves in this way.

      I would prefer that if a field is designated for instance as UPPER, that whichever the way the CAPS LOCK is switched, the user's input is immediately formatted as they type into Upper case - with no post-conversion needed either on screen of for data storage.

      If I understand correctly, the various methods you've suggested achieve a conversion after the fact, and don't force e.g. an UPPER status as the user types.

      Cheers Jem

      Comment


        #4
        Re: Field entry in Upper Case

        The problem comes when you want to do something a bit different.
        I tend to use the inbuilt functions as I can manage whatever has been entered after the event. Users will beat you every time.

        If it is that important to you, then the Caps Lock will work IF there is no screen message like the one I get on screen from my wireless keyboard. Then your user will have some fun.

        Ted
        See our Hybrid Option here;
        https://hybridapps.example-software.com/


        Apologies to anyone I haven't managed to upset yet.
        You are held in a queue and I will get to you soon.

        Comment


          #5
          Re: Field entry in Upper Case

          Jem, I think this is a wishlist item. Don't know of an easy way to do this keystroke by keystroke. Might be possible to build a custom script tied to the form's onkey event script that looks at the ascii value of each keystroke, after determining which text object was active first, and then shifts the key value to upper case. Don't know. Haven't ever tried it.

          Comment


            #6
            Re: Field entry in Upper Case

            I've had a fiddle with this and the only way I could do what you want is to use the Sys_Send approach. Problem is that the Keyboard state needs to be constantly monitored as sausage fingers might trip the CapsLock and then the case changes. I used the simple OnArrive and OnDepart events on a singe field as I prsumed there are only a few of the fields which are required as upper case.

            Bit of a poser as they say. Time for a beer or two to clear the neural blockage.
            Ted
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            Apologies to anyone I haven't managed to upset yet.
            You are held in a queue and I will get to you soon.

            Comment


              #7
              Re: Field entry in Upper Case

              Have a look at this page. You should be able to cobble together a script to set this up.

              http://www.technipages.com/set-capsl...t-startup.html
              See our Hybrid Option here;
              https://hybridapps.example-software.com/


              Apologies to anyone I haven't managed to upset yet.
              You are held in a queue and I will get to you soon.

              Comment


                #8
                Re: Field entry in Upper Case

                The answer is use xdialog for data entry. With xdialog you can have change events fire with each keystroke. As I have posted before, I have converted practically all data entries to use xdialogs. Much greater flexibility. Cut and paste this simple one field example dialog into the Interactive Window, highlight it and run it.


                Code:
                dim vco as C
                dim dlg_title as C="Upper Case Change"
                dim dlg_body as C
                dim dlg_code as C
                dim vR as C
                
                dlg_body=<<%dlg%
                {background=#185,185,150}{font=Arial,10}{xmargin=5,5}
                {lf};
                Company: | [.40vco!coev_*];
                {lf};
                <OK>
                %dlg%
                
                dlg_code=<<%code%
                IF left(a_dlg_button,5)="coev_"
                	if a_dlg_button="coev_change"
                		vco=upper(vco)
                		sys_send_keys("{END}")
                	end if
                  a_dlg_button=""
                END IF
                %code%
                
                vR=ui_dlg_box(dlg_title,dlg_body,dlg_code)
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: Field entry in Upper Case

                  Hi all,

                  Thanks very much for your suggestions. They've got me thinking along the right lines, and I'm getting there ...

                  Mike's suggestion re Dialog boxes is sound (thanks for the example), but I like the graphical UI of forms and I'm not ready to give up on my form just yet, so I took a look at Tom's suggestion of using the OnKey event. So far, I've been able to successfully trap lower case key-presses (i.e. any letter a through z).


                  My plan now is either to use A_USER.KEY.HANDLED = .T. to suppress the lowercase letter as typed, and use SYS_SEND_KEYS() to replace it with an UPPER Case one, or ....

                  On detecting a lower case letter as above, simply alter the whole field value using the UPPER() function then push the resulting value to the field on screen.

                  More later. Ta, Jem

                  Comment


                    #10
                    Re: Field entry in Upper Case

                    Hi all,

                    I'm making progress, and wanted to share my thoughts before I forget the principles ...

                    This simple snippet of code is placed in the OnKey event for my form, to evaluate the contents of the "Description" field.

                    If the last letter typed in the "Description" field is a lower case letter, the whole field text is transformed to Upper case and the result is written back to the field on screen. Given that this "check 'n correct" routine applies to each character added on to the field, it appears to the user as capitalisation in real time.

                    IF BETWEEN(RIGHT(parentform:Description.text,1),"a","z")
                    parentform:Description.value = UPPER(parentform:Description.text)
                    END IF

                    Now all I have to do is put this into a function which can be called per field on my form that I want in upper case ....

                    Cheers Jem

                    Comment


                      #11
                      Re: Field entry in Upper Case

                      I fear it's a bit more complicated.

                      What if your user has entered 6 characters, and then backspaces to change character number 2, using a lowercase keystroke?

                      Comment


                        #12
                        Re: Field entry in Upper Case

                        Round, like a circle in a spiral
                        Like a wheel within a wheel...Never ending or beginning..

                        The answer is so simple, it's ridiculous.. but I could see how people could go round and round trying to figure it out.
                        Here you go. Put this script, this measly script, in the OnKey event:
                        Code:
                        if a_user.key.value>"96"
                        x=upper(LNAME.text)
                        field_name.text=x
                        end if

                        Comment


                          #13
                          Re: Field entry in Upper Case

                          Hi both,

                          Thanks once again for your contributions to my flawed thought processes. Tom's note pointed out the error of trapping the right-most character only. I'd spotted my earlier mistake of looking for values between A to Z, but Gabriel's code simplified it for me.

                          I now have the following that I can put into a function ...

                          IF parentform.Active() = "DESCRIPTION"
                          If a_user.key.value>"96"
                          parentform:active.value = UPPER(parentform:active.text)
                          END IF
                          END IF

                          Comment


                            #14
                            Re: Field entry in Upper Case

                            I had anticipated couple more questions to arise:
                            1-How do I get this to work on any character field in the form?
                            2-How do I get it to work on any form?
                            And the answer is this function, which you could put in the OnKey event of any form:
                            Code:
                            FUNCTION ALL_UPPER AS C ()
                            obj=parentform.active()
                            if a_user.key.value>"96"
                             x=upper(eval(obj+".text"))
                             eval(obj+".text")=x
                            end if
                            END FUNCTION

                            Comment


                              #15
                              Re: Field entry in Upper Case

                              Just for academic purposes, another way to do this perhaps is to change field rules (with xbasic) to make all entries upper case. But it's a lot more work than this simple script.

                              Comment

                              Working...
                              X