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

Open RTF Memo editor by button

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

    Open RTF Memo editor by button

    Hi everyone.

    I was wondering if there is a way to open an RTF memo on a form by a button. I have looked but I can't seem to find the right text. I keep getting an error message when I try.

    Any help would be great.

    Thanks for your time

    Rick

    #2
    Re: Open RTF Memo editor by button

    Rick,

    The function you want to use is A5_RTF_EDITOR2()

    For an example of a 'OnPush' Script, lets assume you have a customer table caller "Customers" and you have a RTF Memo field called "Cust_Notes". The form object for this field will be use the same name as the field for this example, but it could be anything you like.The following code will open the RTF Editor for that field:

    Code:
    p.text=Customers->Cust_Notes
    a5_rtf_editor2(p,"Customer Notes")
    parentform:Cust_Notes.value = p.text
    Hope this helps.

    Happy New Year,

    Scott

    Comment


      #3
      Re: Open RTF Memo editor by button

      Thanks very much Scott.

      It works great

      Happy New Year to you and all.

      Rick

      Comment


        #4
        Re: Open RTF Memo editor by button

        Hi Scott

        It opens it up Ok, but when I save it there is an error message.

        Thanks for the help by the way, I am just learning A5.

        I made a learning (test) table.

        The table is named T1 and the form is named T1. The memo field is named clmemo.

        This is what I now have in the onpush button editor

        p.text=T1->clmemo
        a5_rtf_editor2(p,"clmemo")
        parentform:T1.value = p.text

        The error message is:

        Parent Form T1.value = P.Text
        Not Found
        Parent Form: T1 not found

        It does not appear to be saving any data I put in there.

        Thanks

        Rick

        Comment


          #5
          Re: Open RTF Memo editor by button

          Rick,

          While you are in design mode, get the properties of the RTF Memo field object on the form. That is what you want to use here:

          parentform:<Form Object Name>.value = p.text

          Currently you are looking for the table not the form field.

          Scott

          Comment


            #6
            Re: Open RTF Memo editor by button

            Sorry it took so long to say thanks Scott.

            I had to step out for a while.

            RS

            Comment


              #7
              Re: Open RTF Memo editor by button

              Originally posted by Scott Emerick View Post
              Code:
              p.text=Customers->Cust_Notes
              a5_rtf_editor2(p,"Customer Notes")
              parentform:Cust_Notes.value = p.text
              Hope this helps.
              Maybe it's just me. But I don't see how Scott's code will work.

              Have you tried it?

              Does it work? - even if you already have data in the field?

              Here are 3 code snippets that have worked for me in the past:
              Code:
              ''=================================
              ''Change an existing RTF memo w. a Value already assigned to field
              ''=================================
              'the button on the form executes this xbasic:
              
              topparent.commit()
              dim r as p
              r = rtf.create("")
              t = table.current()
              f = t.field_get("rtfmemo")
              rtfBinary = f.value_get()
              r.binary_text = rtfBinary
              result = a5_rtf_editor(r,"Edit")
              
              IF result = "save" THEN
                  RtfMemo.refresh()
                  t.change_begin()
                  f.value_put(r.binary_text)
                  t.change_end(.t.)
                  topparent.Resynch()
              END IF
              
              
              ''=================================
              ''Change an existing RTF memo record w. NO value in the field
              ''=================================
              r = rtf.create("")
              tbl2 = table.get("Tbl_FormMemos")
              f = t.field_get("Memo")
              
              IF RTF_FIELD_TO_TEXT("Memo") = ""    
                  ''Change the RTF memo
                  vChoice = a5_rtf_editor(r,"New Quik Letter")
                  IF vChoice = "save" THEN
                      Memo.refresh()
                      tbl2.change_begin()
                          f.value_put(r.binary_text)
                      tbl2.change_end(.t.)
                  END IF
              END IF
              
              
              ''=================================
              ''Enter a New RECORD AND RTF memo field
              ''=================================
              topparent.commit()
              dim r as p
              r = rtf.create("")
              t = table.current()
              f = t.field_get("rtfmemo")
              result = a5_rtf_editor(r,"Edit")
              IF result = "save" THEN
                  RtfMemo.refresh()
                  t.enter_begin()
                  f.value_put(r.binary_text)
                  t.enter_end(.t.)
                  topparent.Resynch()
              END IF
              ''=================================
              You may need to combine two or more of these to get what you want. There is nothing simple about RTF memo fields.
              Last edited by Peter.Greulich; 12-31-2008, 07:46 PM.
              Peter
              AlphaBase Solutions, LLC

              [email protected]
              https://www.alphabasesolutions.com


              Comment


                #8
                Re: Open RTF Memo editor by button

                Note: You may notice that I have refresh() commands before the table change or enter. The reason for this is that this code comes from v.5 where I encountered some supernatural resynching issues, and it would not work any other way. I moved the command just now in v8 and it works properly. You can presumably move that to after the record is saved in v9, as well.
                Peter
                AlphaBase Solutions, LLC

                [email protected]
                https://www.alphabasesolutions.com


                Comment


                  #9
                  Re: Open RTF Memo editor by button

                  Hi Peter.

                  No, I hadn't tried it at that time. It opens the memo field up, but when I save data and then re-open the memo field, the data was gone (u/k where).

                  I was looking at yours Peter. Wow !! All that to open a Rich text memo with a button. I am new to A5 and all of what you put there is like a foreign language to me.

                  Maybe the guru's at A5 could have a look at a more simplistic and automatic way of doing that.

                  Maybe I'm "pipe-dreaming" here, but I thought whatever A5 offered in the DBF structure, A5 would have an easy way to put that on a form (buttons or whatever), especially for non-programmers like myself.

                  --> Maybe through a Genie or a function where you just have to add your memo field name?

                  Wish list ?

                  Thanks Peter for the heads-up regarding Rich Text Memo Fields being problematic. I am reverting back to plain memo fields at least till I learn the program a bit better.

                  Thanks again,

                  RS

                  Comment


                    #10
                    Re: Open RTF Memo editor by button

                    Originally posted by Rick Sloan View Post
                    Maybe I'm "pipe-dreaming" here, but I thought whatever A5 offered in the DBF structure, A5 would have an easy way to put that on a form (buttons or whatever), especially for non-programmers like myself.
                    No, you're not dreaming. I agree. There should be a simple function or genie to do this. RTF memo fields have always been a sore point for many, including me.
                    Peter
                    AlphaBase Solutions, LLC

                    [email protected]
                    https://www.alphabasesolutions.com


                    Comment


                      #11
                      Re: Open RTF Memo editor by button

                      Guys,

                      I am sorry, I gave you the wrong code. That's what I get for trying to be quick.

                      This is the working code:
                      Code:
                      p.text = parentform:note.rtf.rtf_text
                      a5_rtf_editor2(p,"Contact Notes")
                      parentform:note.rtf.rtf_text = p.text
                      I have attached a working example so you can see it does work.

                      Happy New Year!!

                      Scott

                      Comment


                        #12
                        Re: Open RTF Memo editor by button

                        Sorry, Scott. It doesn't work. Try it w. a little more testing. Change the font size, color, bold, etc. After you close the dialog, click in the memo field itself - or open it again. It doesn't hold the change. You have to use the code I showed above. If there is a shortcut, it's not the one (or at least, not the way) you showed.
                        Peter
                        AlphaBase Solutions, LLC

                        [email protected]
                        https://www.alphabasesolutions.com


                        Comment


                          #13
                          Re: Open RTF Memo editor by button

                          Peter,

                          Your right I had to tweak the code. It should work now.

                          Scott

                          Comment


                            #14
                            Re: Open RTF Memo editor by button

                            That was a simple enough change. Nice! Thanks for being persistant, Scott.
                            Peter
                            AlphaBase Solutions, LLC

                            [email protected]
                            https://www.alphabasesolutions.com


                            Comment

                            Working...
                            X