Alpha Video Training
Page 2 of 2 FirstFirst 12
Results 31 to 59 of 59

Thread: Memo Control

  1. #31
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: Memo Control

    Steve

    To add a start date/time you just need to dim a variable

    Code:
     dim v_start as t
    Then insert this line of code after the dim statments

    Code:
     v_start=now()
    Here is the script:

    Code:
    Dim P as P
    dim newmemo as c
    dim v_start as t
    vMode = parentform.mode_get()
    v_start=now()
    IF vMode = "CHANGE" .or. vMode = "ENTER"
    parentform.commit()
    END IF
    
    tbl = table.current() 
    p.text=""
    
    vChoice = a5_memo_editor(p,"mitigation_memo") 
    
    IF vChoice = "save" then
    IF alltrim(tbl.mitigation_memo) = ""
    newmemo = p.text
    ELSE
    newmemo = tbl.mitigation_memo + crlf(2) +v_start+crlf()+p.text+crlf()+now()+" "+user_name()
    end if	
    tbl.change_begin()
    tbl.mitigation_memo=newmemo
    tbl.change_end(.t.)
    
    topparent.Refresh_Layout()
    
    END IF
    Also the code has been changed to reflect Tim's advice on the end if statement.


    Tim - thanks for that change in the end if statement - I was testing and the end if was put in the wrong place. Thanks again for correcting that.

    Tom

  2. #32
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    It's not putting the now() if the field is blank
    it does put the text but no time stamp
    and it doesn't stamp the start time on push put text now()
    something like that and the on the save in memo editor it will put the stamp at the end of the entry to show time spent with editor open

  3. #33
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: Memo Control

    Steve

    See if this works the way you want it

    Code:
    Dim P as P
    dim newmemo as c
    dim v_start as t
    dim user as c ="TOM SR"
    vMode = parentform.mode_get()
    v_start=now()
    IF vMode = "CHANGE" .or. vMode = "ENTER"
    parentform.commit()
    END IF
    
    tbl = table.current() 
    p.text=""
    
    vChoice = a5_memo_editor(p,"mitigation_memo") 
    
    IF vChoice = "save" then
    IF alltrim(tbl.mitigation_memo) = ""
    newmemo = v_start+crlf()+p.text+crlf()+now()
    ELSE
    newmemo = tbl.mitigation_memo + crlf(2) +v_start+crlf()+p.text+crlf()+now()+" "+user
    end if	
    tbl.change_begin()
    tbl.mitigation_memo=newmemo
    tbl.change_end(.t.)
    
    parentform.Refresh_Layout()
    
    END IF
    I guess I'm a little confused

    Tom Baker

  4. #34
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    thanks for the help tom I keep getting closer and closer
    i just need to learn more xbasic so i can fine tune this.
    i gotta put the dbase live so i can't be playing too much with it.
    that part of the code didn't work.
    here is what i am using
    Dim P as P
    dim newmemo as c
    vMode = parentform.mode_get()

    IF vMode = "CHANGE" .or. vMode = "ENTER"
    parentform.commit()
    END IF

    tbl = table.get("notes")
    p.text=""

    vChoice = a5_memo_editor(p,"mitigation_memo")

    IF vChoice = "save" then
    IF alltrim(tbl.mitigation_memo) = ""
    newmemo = p.text
    ELSE
    newmemo = tbl.mitigation_memo + crlf(2) + p.text +" "+now()+" "+user_name()

    end if
    tbl.change_begin()
    tbl.mitigation_memo=newmemo
    tbl.change_end(.t.)

    parentform.Refresh_Layout()

    END IF

  5. #35
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: Memo Control

    Steve

    I took your last script and entered it onto a new form on my test app that was composed of a set (parent style_lu1 - child Notes).

    I then used your code modified as follows:

    Code:
    Dim P as P
    dim newmemo as c
    dim v_start as t
    v_start=now()
    vMode = parentform.mode_get()
    
    IF vMode = "CHANGE" .or. vMode = "ENTER"
    parentform.commit()
    END IF
    
    tbl = table.get("notes") 
    p.text=""
    
    vChoice = a5_memo_editor(p,"mitigation_memo") 
    
    IF vChoice = "save" then
    IF alltrim(tbl.mitigation_memo) = ""
    newmemo = v_start+crlf()+p.text+crlf()+now()
    ELSE
    newmemo = tbl.mitigation_memo + crlf(2) + v_start+crlf()+p.text +crlf()+now()+" "+user_name()
    end if 
    tbl.change_begin()
    tbl.mitigation_memo=newmemo
    tbl.change_end(.t.)
    
    parentform.Refresh_Layout()
    
    END IF
    This works on my test app - I have attached a thumbnail showing what I get when I used this script (it is the bottom memo field)

    Is this what you want?

    Tom

  6. #36
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    works great tom
    one of my ladies brought up a good point. when the editor is open they can't read the other notes written is there a way we can put the previous notes in the editor but as read only? The editor keeps focus

  7. #37
    Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,629

    Default Re: Memo Control

    Quote Originally Posted by steve745 View Post
    when the editor is open they can't read the other notes written is there a way we can put the previous notes in the editor but as read only?
    Not exactly - but go back to my example. You can have the memo field read only on your form (as in my example), so they can view the prev. notes there. Then use the button code to open the xdialog for the new memo input. Make the read only memo as big as you want on the form.

  8. #38
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    Thats what we are doing your code helped me in many ways 1 to understand xbasic a little never used it before i started messing with your code. 2 xbasic offers lots of flexiblity. the memo is set read only on the form like your example, if they are on a call and have to review previous notes the have to close the editor to read them. can the editor open like a split window with field current data on bottom and new text entry area on top is that possible?
    as i use alpha5 more and more i find that almost anything is possible.

  9. #39
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: Memo Control

    Steve

    I don't know what your form look like, so don't know how much of the memo field would be visible when the memo editor is open - but you can position the memo editor anywhere on your form (drag it) so that it might not cover the memo field. The only thing is that as long as the memo editor is open you would not be able to use the vertical scroll on the memo field to read all of the lines (presuming that there are a lot of entries) so you would still have to close the memo editor.

    When you move the memo editor it will remember that position and will reappear at that same location until you exit the application.

    Tom

  10. #40
    Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,629

    Default Re: Memo Control

    Quote Originally Posted by steve745 View Post
    can the editor open like a split window with field current data on bottom and new text entry area on top is that possible?
    Sorry, not possible.

  11. #41
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Memo Control

    Steve,

    As Peter said, it is not possible if you use just the one table.

    The method I use, which is on a 50 user network, is 2 tables. First for text input, second for viewing only. See thumbnail.

    This was all taken form Application Programming by Dr Peter Wayne.

    The user types in the top box and when text is saved, it is appended to the bottom box and then deleted from the top box. So the top box is always ready to take new text. Notice there is also the Users Initials and date and time stamp. The bottom box is Read Only.

    Both boxes are RTF, which means all font, size, colour and spelling controls are available.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  12. #42
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    wow keith
    i could make a button just open another form based on current record and see the other notes. wow that is just what i was looking for do i need to make the entry table part of the set or can it be indepenant?

  13. #43
    Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,629

    Default Re: Memo Control

    Quote Originally Posted by Keith Hubert View Post
    The method I use, which is on a 50 user network, is 2 tables. First for text input, second for viewing only.
    Which gets us back to Tom Cone's suggestion (post #2 of this thread).

  14. #44
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    keith the women in the office are raving over you they are so excited

  15. #45
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default Re: Memo Control

    It is with xdialog. See attached.

    Are they excited over his physique or his coding skills?
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  16. #46
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Memo Control

    Hi Steve,

    Both tables are part of the set. Here is code used on the Save button.

    Nice touch Mike, only this has no text formatting. Can that be done in Xdialog, with the user having control over font size and colour?
    'Date Created: 17-May-2007 03:54:40 PM
    'Last Updated: 18-May-2007 08:26:45 AM
    'Created By : Keith Hubert
    'Updated By : Keith Hubert
    topparent:Approved.Text="T"

    constant separator=chr(13)+chr(10)

    topparent.commit()
    dim ft1 as p
    ft1=topparent:free_text1_rtf.this
    ft2=topparent:free_text2_rtf.this
    ft1.rtf.set_cursor(1)
    ft1.rtf.insert_text(separator+initials()+" "+dtoc(date())+" "+time("0h:0m")+crlf())
    ft1.activate()
    xbasic_wait_for_idle()
    textlen=len(ft1.rtf.plain_text)
    ft1.rtf.set_cursor(textlen+1)
    ft1.rtf.insert_text(crlf())
    xbasic_wait_for_idle()
    ft1.textselect(1,-1)
    ft1.rtf.cut()

    ft2.field.readonly=.f.
    ft2.activate()
    ft2.rtf.set_cursor(1)
    ft2.rtf.paste()

    topparent:approved.Value=.F.

    ft2.field.readonly=.t.
    topparent.commit()
    sys_send_keys("{F9}")
    This code puts the last saved text at the top of the viewing box.

    I dont know what you have told the women in your office, it is only a database.
    Last edited by Keith Hubert; 10-03-2008 at 03:23 PM.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  17. #47
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    They like his design skills

  18. #48
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Memo Control

    I knew I had something to show the ladies, now I know what it is.

    Thanks Steve.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  19. #49
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default Re: Memo Control

    Nice touch Mike, only this has no text formatting. Can that be done in Xdialog, with the user having control over font size and colour?
    see next
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  20. #50
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default Re: Memo Control

    Nice touch Mike, only this has no text formatting. Can that be done in Xdialog, with the user having control over font size and colour?
    To some degree, yes. But It can't be changed on the fly with coding as with a table/form field. At least not that this boy can do!
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  21. #51
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    mike i moded that code for my dbase and it works great.

    i was also thinking about keiths idea of the form with 2 tables one appending to the other the only question i have for that approach is if the form is left open and the form it's fired from is changed to another record is there a way to tell the code to close that form on a different button like my lookup case button on push close form then when i go to add notes form the records will not mismatch example: think your entering notes on current record but really entering them on the last record you had the add notes form open on????

  22. #52
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default Re: Memo Control

    Steve,
    I am not exactly sure what your saying but maybe this might answer it.

    Your tables should have a field that holds a unique id for each record. You would open the Add_notes form filtered to the same unique value as the record in focus.

    I was interested in Kieth's code so I made an example. Nice, except I can't see a way to check for a blank RTF2 value to have it not add the times with nothing else if the button is pushe with nothing in the new note RTF memo field.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  23. #53
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    Thanks a lot Mike for pateintly helping me, i'm a student taking comp science and i will be learning vb java and 2 other langs this xbasic is the first taste of code i've ever attempted and i have found that i can look at it for long enough and make sense of how things go and even edit a touch here and there. just seeing what everyone has helped me with creating and the several different ways things can be done, it makes the impossible look more possible. I love this program i'll master it one day.

  24. #54
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    is there a safe way to change field type from memo to real text memo

  25. #55
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Memo Control

    Hi Steve,

    Safest way is to make a second Memo field, this one to be RTF. Update this new field with the text from the first memo field.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  26. #56
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Memo Control

    would that be a post operation or should i use the update operation

  27. #57
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Memo Control

    Hi Steve,
    would that be a post operation or should i use the update operation
    Answer
    Update this new field with the text from the first memo field
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  28. #58
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default Re: Memo Control

    BTW,
    For all followers- Kieth, your code that you posted has a line#15 function: initials() that throws an error. I'm guessing that is a UDF in your hands. I removed it to get things to work.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  29. #59
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Memo Control

    For those following this thread, here is the function Mike has mentioned I used to create the Initials of the logged on User. User_Name() is from the built in Alpha Security.
    'Date Created: 06-Apr-2007 01:55:27 PM
    'Last Updated: 12-Jun-2007 03:15:42 PM
    'Created By : Keith
    'Updated By : Keith Hubert
    FUNCTION initials AS C ( )

    initial_1=left(user_name(),1)
    initial_2=left(word(user_name(),2),1)
    initial_3=left(word(user_name(),3),1)
    initials=if(w_count(user_name())>2,initial_1+initial_2+initial_3,initial_1+initial_2)

    END FUNCTION
    There might have been a better way to build this function but it works.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

Similar Threads

  1. Transfer Memo text to RTF Memo
    By Keith Hubert in forum Alpha Five Version 7
    Replies: 4
    Last Post: 03-25-2007, 09:05 PM
  2. Memo/Rich Text Memo Date/Time
    By Rayr in forum Archived Wishlist
    Replies: 0
    Last Post: 02-04-2007, 10:22 AM
  3. Memo-RTF Memo - Rightclick shortcoming
    By martinwcole in forum Alpha Five Version 7
    Replies: 3
    Last Post: 08-21-2006, 12:47 AM
  4. Page Break not working in Memo and Rich Memo Field
    By pk9 in forum Alpha Five Version 7
    Replies: 0
    Last Post: 03-15-2006, 04:19 PM
  5. Disappearing dropdown box control with use of Nav control on a5w page
    By Hansolo in forum Web Application Server v7
    Replies: 2
    Last Post: 01-24-2006, 04:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •