View previous topic :: View next topic |
Author |
Message |
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Fri Dec 23, 2005 6:46 pm Post subject: VDSOBJ: Saving RICHEDIT ELEMENT data to a variable? |
|
|
Overview: What I'm trying to do is save the contents of a RICHEDIT element (including the formating) to a database to be retreived later and redisplayed in a RICHEDIT element.
Problem: I can use %X = @Object(dlgtext,RICHEDIT1) and send %X to the database but I lose all the formating. If fact I seems like @Object(dlgtext,RICHEDIT1) dosen't retrieve the formating.
I was thinking maybe copying the contents to the clipboard first because it does keep the formating and then somehow send the clipboard contents to the database. I can't use VDS's @clipbrd() because it will only get the plain text.
-OR-
Maybe there is a way to convert the contents of RICHEDIT (or the clipboard) to binary and send the binary string to the database and then convert it back after retieveing it.
Note: the database is SQL and I'm using Tommy's VDSDB to connect to it. I've tried using both "Image" and "Binary" data types in conjunction with @Object(dlgtext,RICHEDIT1) but then when redisplayed, it displays as binary.
Anyone have any ideas?
Thanks in advance,
Aslan
Last edited by Aslan on Sat Dec 24, 2005 4:47 am; edited 1 time in total |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Sat Dec 24, 2005 3:15 am Post subject: |
|
|
Theres no easy way to do this. The method you can use is with @OBJECT(GETFORMAT) function. Which will return the formatting for characters that are selected in the richedit control.
You will then use the OBJECT FORMAT,RICHEDIT1,CLIPBOARD,SELECT command to select one character at at time, use the function @object(getformat) to get the formatting and then save this data somewhere that you can later use to recreate the rtf document.
Take a look at the helpfile for vdsobj and you can learn more about the function and command. |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Dec 24, 2005 6:34 pm Post subject: |
|
|
I was afraid you were gonna say that |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Dec 24, 2005 8:43 pm Post subject: |
|
|
Ok, I figured out how I'm going to proceed with this however, I'm having problem with "OBJECT FORMAT,RICHEDIT1,INSERTIMAGE"
How can I have text following an image on the same line
If I insert the image and then append text, the text shows below the image.
also when I insert an image everything after the image maintains the same formating even if I change it.
Code: |
OBJECT FORMAT,RICHEDIT1,CLIPBOARD,INSERTIMAGE,someimage.gif
OBJECT FORMAT,RICHEDIT1,CLIPBOARD,SELECT,@len(@object(dlgtext,richedit1)),@len(@object(dlgtext,richedit1))
OBJECT FORMAT,RICHEDIT1,SETFONT,Verdana,16,DKRED
OBJECT FORMAT,RICHEDIT1,UNDERLINE,ON
OBJECT FORMAT,RICHEDIT1,BOLD,ON
OBJECT APPEND,RICHEDIT1,Some text I'd like to follow the image.
OBJECT FORMAT,RICHEDIT1,CLIPBOARD,SELECT,@len(@object(dlgtext,richedit1)),@len(@object(dlgtext,richedit1))
OBJECT FORMAT,RICHEDIT1,UNDERLINE,OFF
OBJECT FORMAT,RICHEDIT1,BOLD,OFF
OBJECT FORMAT,RICHEDIT1,CLIPBOARD,SELECT,@len(@object(dlgtext,richedit1)),@len(@object(dlgtext,richedit1))
OBJECT FORMAT,RICHEDIT1,SETFONT,Arial,12,BLACK
OBJECT APPEND,RICHEDIT1,Several lines of more text....
|
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Sat Dec 24, 2005 9:45 pm Post subject: |
|
|
I've never done this so I can't be certain. But what I would do is first place all the text (nonformatted) into the richedit control. Then format the text one character at a time and finally place the images in where they need to go between characters.
A better method would be to simply have a custom dll written that lets you grab the clipboard data as binary contents and then be able to save that into your database. Something that extends the clipboard function in vds. |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Dec 24, 2005 10:59 pm Post subject: |
|
|
I agree, so for now I'm not going to use images and I will define fonts as a standard.
Thanks for your help P |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Thu Dec 29, 2005 5:01 pm Post subject: |
|
|
Hmmm.... I haven't tried that
It would be great if this works but it might make it a bit slow.
This is for storing notes in a work order program so when I retrieve the notes, they get appended together. This could potentially, create a lot temp files unless I can load the notes to the Richedit control directly.
I'll play around with this |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Fri Dec 30, 2005 5:14 am Post subject: |
|
|
Hey Skit it worked Thanks for the
It was actually a bit more complicated than just saving it as a file then loading the file into a list. Actually saving the data was that simple, but retrieving it and the other saved objects, then redisplaying them was a bit tricky. This was mostly due to inserting TimeStamps between each data item.
Now another question for eveyone.
I'm trying to make the editable RICHEDIT control to work like Wordpad where the user can change fonts and styles but only the text they want.
So far I can only change all the text or 'Object Format' seems to get ignored.
Code: | :FontMenu
%%tFont = @FONTDLG(%%Font,%%FontSize,%%FontStyle)
If @ok()
parse "%%Font;%%FontSize;%%FontStyle", %%tFont
If @equal(%%FontStyle,BI)
%%Bold = on
%%Italic = on
Elsif @equal(%%FontStyle,B)
%%Bold = on
%%Italic = off
Elsif @equal(%%FontStyle,I)
%%Bold = off
%%Italic = on
Else
%%Bold = off
%%Italic = off
End
End
OBJECT FORMAT,RICHEDIT2,CLIPBOARD,SELECT,@len(@object(dlgtext,richedit2)),@len(@object(dlgtext,richedit2))
OBJECT FORMAT,RICHEDIT2,BOLD,%%Bold
OBJECT FORMAT,RICHEDIT2,ITALIC,%%Italic
OBJECT FORMAT,RICHEDIT2,SETFONT,%%Font,%%FontSize,BLACK
OBJECT FORMAT,RICHEDIT2,CLIPBOARD,SELECT,@len(@object(dlgtext,richedit2)),@len(@object(dlgtext,richedit2))
goto evloop |
Anyone have any ideas |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|