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

Help with edit memo button

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

    Help with edit memo button

    I'm attempting to create a button that opens the memo editor to allow changes to an existing memo field.

    The code I've come up with sort of works but not quite...

    Code:
    Dim P as P
    
    vMode = parentform.mode_get()
    
    IF vMode = "CHANGE" .or. vMode = "ENTER"
    	parentform.commit()
    END IF
    
    tbl = table.current() 
    p.text=Memo->Notes
    
    vChoice = a5_memo_editor(p,"Notes Editor") 
    
    IF vChoice = "save"
    	tbl.change_begin()
    	IF alltrim(tbl.Notes) = ""
    		tbl.Notes = date() +" (" +word(api_getusername(),1) +")"+ crlf() + p.text
    	ELSE
    		tbl.Notes = date() +" (" +word(api_getusername(),1) +")"+ crlf() + p.text
    	END IF
    	tbl.change_end(.t.)
    	Notes.refresh()
    END IF
    I would like the memo editor to open with the cursor at the end of any existing text and the new text to be entered as follows:

    Date (User first name):
    Added text here

    Any help appreciated!

    #2
    Re: Help with edit memo button

    Try this for the editing/adding.

    Code:
    Dim P as P
    
    vMode = parentform.mode_get()
    
    IF vMode = "CHANGE" .or. vMode = "ENTER"
    	parentform.commit()
    END IF
    
    tbl = table.current() 
    p.text=tbl.Notes
    p.text = p.text + crlf()+ date() +" (" +word(api_getusername(),1) +")"+ crlf()
    
    ins_pt = len(alltrim(p.text))
    vChoice = a5_memo_editor(p,"Notes Editor",.f.,ins_pt) 
    
    IF vChoice = "save"
    	tbl.change_begin()
    	tbl.Notes = p.text
    	tbl.change_end(.t.)
    	Notes.refresh()
    END IF
    Last edited by Stan Mathews; 08-25-2009, 11:41 AM. Reason: Fixed the position cursor issue.
    There can be only one.

    Comment


      #3
      Re: Help with edit memo button

      I slightly modified your suggestion and it works fine if there is no text in the memo fiekld. However, if there is existing text it does not enter the date and username at the end of the existing text - it does insert the new text correctly though.

      My new code:

      Code:
      Dim P as P
      
      vMode = parentform.mode_get()
      
      IF vMode = "CHANGE" .or. vMode = "ENTER"
      	parentform.commit()
      END IF
      
      tbl = table.current() 
      p.text=tbl.Notes
      
      p.text = p.text
      
      
      ins_pt = len(alltrim(p.text))
      vChoice = a5_memo_editor(p,"Notes Editor",.f.,ins_pt) 
      
      IF vChoice = "save"
      	tbl.change_begin()
      	tbl.Notes = date() + ": " +" (" +word(api_getusername(),1) +")" + crlf() + p.text
      	tbl.change_end(.t.)
      	Notes.refresh()
      END IF

      Comment


        #4
        Re: Help with edit memo button

        Also, is it possible to add a carriage return after the insertion point so the cursor starts on a new line?

        Comment


          #5
          Re: Help with edit memo button

          You want jam with that?

          Code:
          p.text = p.text + crlf()+ date() +" (" +word(api_getusername(),1) +")"+ crlf([B][COLOR="Red"]2[/COLOR][/B])
          There can be only one.

          Comment


            #6
            Re: Help with edit memo button

            Appreciate the help Stan but still not getting the correct results.

            The entries are showing up as follows:

            08/25/2009: (Mark)

            08/25/2009: (Mark)

            test
            test2

            and it should be:

            08/25/2009: (Mark)
            test

            08/25/2009: (Mark)
            test2

            Thanks!

            Comment


              #7
              Re: Help with edit memo button

              Doesn't do that here with v8. Maybe someone else can pitch in who has v9.
              There can be only one.

              Comment


                #8
                Re: Help with edit memo button

                Stan,
                I just tried it on a machine with v8 and it works like I explained above (same as v9).

                It works correctly if there is no previous text in the notes field.

                ex:

                08/25/09 (Mark)
                Test

                However, if you append Test 2 to the above it displays as:

                08/25/09 (Mark)
                08/25/09 (Mark)
                Test
                Test2

                Make sense?

                Thanks!

                Comment


                  #9
                  Re: Help with edit memo button

                  Mark,

                  I just tried it in ver9. I had to tweak it a bit so that the tag is placed AFTER the entered text. Our note field is "Case_Notes".
                  Our function, "workerbyacess()" returns the current user name based on our internal security system.

                  Code:
                  Dim P as P
                  workerbyaccess()
                  vMode = parentform.mode_get()
                  
                  IF vMode = "CHANGE" .or. vMode = "ENTER"
                  	parentform.commit()
                  END IF
                  
                  tbl = table.current() 
                  p.text=tbl.Case_Notes
                  
                  p.text = p.text
                  
                  
                  ins_pt = len(alltrim(p.text))
                  vChoice = a5_memo_editor(p,"Notes Editor",.f.,ins_pt) 
                  
                  IF vChoice = "save"
                  	tbl.change_begin()
                  	    tbl.Case_Notes = p.text + crlf()+"*** "+ date() + ": " +" (" +wname +")" +crlf()
                  	tbl.change_end(.t.)
                  END IF
                  Results of the memo as edited
                  Her bill is not that high so I told her that needed to arrange payments with PSE because we can not help her anymore. OD

                  Test2
                  Test3
                  *** 08/25/2009: (T. Henkel)
                  test 4
                  *** 08/25/2009: (T. Henkel)
                  Tom

                  Comment


                    #10
                    Re: Help with edit memo button

                    Removed few lines that serve no purpose.
                    Code:
                    Dim P as P
                    workerbyaccess()
                    vMode = parentform.mode_get()
                    IF vMode = "CHANGE" .or. vMode = "ENTER"
                    	parentform.commit()
                    END IF
                    tbl = table.current() 
                    p.text=tbl.Case_Notes
                    vChoice = a5_memo_editor(p,"Notes Editor") 
                    IF vChoice = "save"
                    	tbl.change_begin()
                    	    tbl.Case_Notes = p.text + crlf()+"*** "+ date() + ": " +" (" +wname +")" +crlf()
                    	tbl.change_end(.t.)
                    END IF

                    Comment


                      #11
                      Re: Help with edit memo button

                      but doesn't the insert point put you at the end of whatever text is already there??

                      Comment


                        #12
                        Re: Help with edit memo button

                        I appreciate all the help!

                        For reference, here is what I ended up with and it works great.

                        Code:
                        Dim P as P
                        
                        vMode = parentform.mode_get()
                        
                        IF vMode = "CHANGE" .or. vMode = "ENTER"
                        	parentform.commit()
                        END IF
                        
                        tbl = table.current() 
                        p.text=tbl.Notes
                        
                        'p.text = p.text
                        
                        
                        ins_pt = len(alltrim(p.text))
                        vChoice = a5_memo_editor(p,"Notes Editor",.f.,ins_pt) 
                        
                        IF vChoice = "save"
                        	tbl.change_begin()
                        	    tbl.Notes = p.text + crlf()+"*** Above note entered on "+ date() + " by " +word(api_getusername(),1) +" ***"
                        	tbl.change_end(.t.)
                        	Notes.refresh()
                        END IF
                        this gives the following results:

                        This is a test
                        *** Above note entered on 08/25/2009 by Mark ***
                        This is another test
                        *** Above note entered on 08/25/2009 by Mark ***
                        Now for the question of the day...

                        With the memo field being read only on the parent form, will this prevent the bloated .fpt file problem that occurs when a user navigates off of a record when the memo field is in change mode?
                        Last edited by Mark Williams; 08-25-2009, 05:16 PM.

                        Comment


                          #13
                          Re: Help with edit memo button

                          Originally posted by Tom Henkel View Post
                          but doesn't the insert point put you at the end of whatever text is already there??
                          You are simply concatenating the existing text with the new.
                          When you say:
                          existing_text=existing_text+New_text
                          The new text will be inserted at the end of the existing one.

                          Comment


                            #14
                            Re: Help with edit memo button

                            Originally posted by G Gabriel View Post
                            You are simply concatenating the existing text with the new.
                            When you say:
                            existing_text=existing_text+New_text
                            The new text will be inserted at the end of the existing one.
                            The insertion point doesn't have any effect on where the new text is added.

                            It simply puts the cursor at the end of any existing text when the memo editor is opened. Otherwise the memo editor is opened with the cursor in the home position and you have to scroll to the end of any existing text before typing.

                            Thanks again for the help...

                            Comment


                              #15
                              Re: Help with edit memo button

                              That is the whole point. You don't want your users to have to scroll to get to where they need to be.

                              Comment

                              Working...
                              X