Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Rich Text Edit Issues (several)...

9 posts in Objects Last posting was on 2007-03-17 14:18:12.0Z
Steve Posted on 2007-03-14 20:53:18.0Z
Sender: 7d7e.45ef215f.1804289383@sybase.com
From: Steve
Newsgroups: sybase.public.powerbuilder.objects
Subject: Rich Text Edit Issues (several)...
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <45f860be.352f.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 14 Mar 2007 12:53:18 -0800
X-Trace: forums-1-dub 1173905598 10.22.241.41 (14 Mar 2007 12:53:18 -0800)
X-Original-Trace: 14 Mar 2007 12:53:18 -0800, 10.22.241.41
Lines: 74
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9270
Article PK: 736427

I'm developing a prototype Rich Text Editor window that will
let the users enter rich text and save it to our SQL Server
2005 database.
First I created a new table called RTF_TEST with id_record
(int) as the primary key, and TXT_RTF (text) as the
unlimited column to store the RTF text in the db. I also
created record number 1 (id_record = 1) with a blank TXT_RTF
value.
Next, I created a normal Free-Form datawindow against this
table in PB 10.5.1. However, I noticed that the TXT_RTF
column got typed as char(32766) in the datawindow. I did at
least change the "Limit" to 0 (unlimited), but I don't think
it helped with the issues below.
Next, I placed an RTE control on the window, and coded the
"OPEN" even for the window as follows:
STRING ls_RTF
dw_1.SetTransObject(SQLConn)
dw_1.Retrieve(1)
rte_1.SetRedraw(FALSE)
ls_RTF = dw_1.Object.txt_rtf[1]
rte_1.SelectTextAll()
rte_1.Clear()
rte_1.PasteRTF(ls_RTF)
rte_1.SelectText(0,0,0,0)
rte_1.SetRedraw(TRUE)

Next, the LoseFocus event for the RTE...
STRING ls_RTF
GraphicObject objControl
objControl = GetFocus()
IF (NOT ISVALID(objControl)) THEN
RETURN 0
END IF
IF (TypeOf(objControl) = RichTextEdit!) THEN
RETURN 0
END IF
// Prevent screen flicker...
rte_1.SetRedraw(FALSE)
rte_1.SelectTextAll()
ls_RTF = rte_1.CopyRTF()
dw_1.Object.txt_rtf[1] = ls_RTF
rte_1.SelectText(0,0,0,0)
rte_1.SetRedraw(TRUE)

And finally, I created a Save button with the following
code:
dw_1.Update()

What happens is as follows:
1. At first, I tried to open a word document with a picture
in it and hit Control-A to select the entire word document,
then pasted it into the RTE. Everything pasted just fine
except the image. Only got a skeleton box instead. The users
are really going to want this Copy/Paste to work with the
graphics.
2. Upon right-clicking the RTE and selecting "Insert File",
I was able to open that very same document, and it DID
display the picture properly. I was able to click save, and
it seems to have saved it properly to the database. I ran an
SQL statement to look at the DATALENGTH(txt_rtf), and it
reported 476312 bytes, so I think the entire thing did save
to SQL Server. However, when I open up the window again to
try and re-load the document from SQL Server, it just does
not display anything. No error message either.
3. The statements above that read rte_1.SelectText(0,0,0,0)
do not seem to be working, as the entire document remains
selected even after the script runs.
4. I've turned on the toolbar, but I don't see any Font
Color Picker in the toolbar at the top.
Any help would be much appreciated. I'm excited about this
new RTE control, but want to make sure I'm taking the right
approach to doing this.
Thanks!
=Steve=


Steve Posted on 2007-03-14 21:03:52.0Z
Sender: 7d7e.45ef215f.1804289383@sybase.com
From: Steve
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: Rich Text Edit Issues (several)...
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <45f86338.3567.1681692777@sybase.com>
References: <45f860be.352f.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 14 Mar 2007 13:03:52 -0800
X-Trace: forums-1-dub 1173906232 10.22.241.41 (14 Mar 2007 13:03:52 -0800)
X-Original-Trace: 14 Mar 2007 13:03:52 -0800, 10.22.241.41
Lines: 106
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9271
Article PK: 736437

OK, a little more investigation reveals more info.
I went ahead and put some error checking into the OPEN event
as follows:
STRING ls_RTF
INT li_Result
dw_1.SetTransObject(SQLConn)
li_Result = dw_1.Retrieve(1)
IF (li_Result < 1) THEN
MessageBox("Error return " + STRING(li_Result) + "
retrieving datawindow row 1.","Hey...",StopSign!)
RETURN
END IF
rte_1.SetRedraw(FALSE)
ls_RTF = dw_1.Object.txt_rtf[1]
rte_1.SelectTextAll()
rte_1.Clear()
rte_1.PasteRTF(ls_RTF)
rte_1.SelectText(0,0,0,0)
rte_1.SetRedraw(TRUE)

The Retrieve() method is returning 1 (no error happening
there). However, when I step through the code in the
debugger and inspect the contents of ls_RTF that is fetched
out of the datawindow, the entire RTF text was not present.
I went ahead and copied it to the clipboard and pasted the
partial RTF text into my UltraEdit editor and saved the
file. Guess what the size of the file is? Sure enough, 32K.
So the issue of PowerBuilder assigning the char(32766) size
for the TXT_RTF column is killing this whole thing, I think.
Any ideas?
=Steve=

> I'm developing a prototype Rich Text Editor window that
> will let the users enter rich text and save it to our SQL
> Server 2005 database.
> First I created a new table called RTF_TEST with id_record
> (int) as the primary key, and TXT_RTF (text) as the
> unlimited column to store the RTF text in the db. I also
> created record number 1 (id_record = 1) with a blank
> TXT_RTF value.
> Next, I created a normal Free-Form datawindow against this
> table in PB 10.5.1. However, I noticed that the TXT_RTF
> column got typed as char(32766) in the datawindow. I did
> at least change the "Limit" to 0 (unlimited), but I don't
> think it helped with the issues below.
> Next, I placed an RTE control on the window, and coded the
> "OPEN" even for the window as follows:
> STRING ls_RTF
> dw_1.SetTransObject(SQLConn)
> dw_1.Retrieve(1)
> rte_1.SetRedraw(FALSE)
> ls_RTF = dw_1.Object.txt_rtf[1]
> rte_1.SelectTextAll()
> rte_1.Clear()
> rte_1.PasteRTF(ls_RTF)
> rte_1.SelectText(0,0,0,0)
> rte_1.SetRedraw(TRUE)
>
> Next, the LoseFocus event for the RTE...
> STRING ls_RTF
> GraphicObject objControl
> objControl = GetFocus()
> IF (NOT ISVALID(objControl)) THEN
> RETURN 0
> END IF
> IF (TypeOf(objControl) = RichTextEdit!) THEN
> RETURN 0
> END IF
> // Prevent screen flicker...
> rte_1.SetRedraw(FALSE)
> rte_1.SelectTextAll()
> ls_RTF = rte_1.CopyRTF()
> dw_1.Object.txt_rtf[1] = ls_RTF
> rte_1.SelectText(0,0,0,0)
> rte_1.SetRedraw(TRUE)
>
> And finally, I created a Save button with the following
> code:
> dw_1.Update()
>
> What happens is as follows:
> 1. At first, I tried to open a word document with a
> picture in it and hit Control-A to select the entire word
> document, then pasted it into the RTE. Everything pasted
> just fine except the image. Only got a skeleton box
> instead. The users are really going to want this
> Copy/Paste to work with the graphics.
> 2. Upon right-clicking the RTE and selecting "Insert File"
> , I was able to open that very same document, and it DID
> display the picture properly. I was able to click save,
> and it seems to have saved it properly to the database. I
> ran an SQL statement to look at the DATALENGTH(txt_rtf),
> and it reported 476312 bytes, so I think the entire thing
> did save to SQL Server. However, when I open up the window
> again to try and re-load the document from SQL Server, it
> just does not display anything. No error message either.
> 3. The statements above that read
> rte_1.SelectText(0,0,0,0) do not seem to be working, as
> the entire document remains selected even after the script
> runs. 4. I've turned on the toolbar, but I don't see any
> Font Color Picker in the toolbar at the top.
> Any help would be much appreciated. I'm excited about this
> new RTE control, but want to make sure I'm taking the
> right approach to doing this.
> Thanks!
> =Steve=


Brad Wery[TeamSybase] Posted on 2007-03-15 13:12:55.0Z
From: "Brad Wery[TeamSybase]" <bradweryatagricoreunited.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: Rich Text Edit Issues (several)...
References: <45f860be.352f.1681692777@sybase.com> <45f86338.3567.1681692777@sybase.com>
In-Reply-To: <45f86338.3567.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: ugg10.unitedgrain.ca
X-Original-NNTP-Posting-Host: ugg10.unitedgrain.ca
Message-ID: <45f94657$1@forums-1-dub>
Date: 15 Mar 2007 05:12:55 -0800
X-Trace: forums-1-dub 1173964375 165.23.247.49 (15 Mar 2007 05:12:55 -0800)
X-Original-Trace: 15 Mar 2007 05:12:55 -0800, ugg10.unitedgrain.ca
Lines: 123
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9272
Article PK: 736430

You encountered a limitation with the datawindow. It can only put 32k
worth of data into a single column. Ideally, what we need is a new
column type that could handle an infinite amount of characters.

To get around this you will have to use the SELECTBLOB and UPDATEBLOB
commands to retrieve and save data to your database.

Brad

Steve wrote:
> OK, a little more investigation reveals more info.
> I went ahead and put some error checking into the OPEN event
> as follows:
> STRING ls_RTF
> INT li_Result
> dw_1.SetTransObject(SQLConn)
> li_Result = dw_1.Retrieve(1)
> IF (li_Result < 1) THEN
> MessageBox("Error return " + STRING(li_Result) + "
> retrieving datawindow row 1.","Hey...",StopSign!)
> RETURN
> END IF
> rte_1.SetRedraw(FALSE)
> ls_RTF = dw_1.Object.txt_rtf[1]
> rte_1.SelectTextAll()
> rte_1.Clear()
> rte_1.PasteRTF(ls_RTF)
> rte_1.SelectText(0,0,0,0)
> rte_1.SetRedraw(TRUE)
>
> The Retrieve() method is returning 1 (no error happening
> there). However, when I step through the code in the
> debugger and inspect the contents of ls_RTF that is fetched
> out of the datawindow, the entire RTF text was not present.
> I went ahead and copied it to the clipboard and pasted the
> partial RTF text into my UltraEdit editor and saved the
> file. Guess what the size of the file is? Sure enough, 32K.
> So the issue of PowerBuilder assigning the char(32766) size
> for the TXT_RTF column is killing this whole thing, I think.
> Any ideas?
> =Steve=
>
>
>>I'm developing a prototype Rich Text Editor window that
>>will let the users enter rich text and save it to our SQL
>>Server 2005 database.
>>First I created a new table called RTF_TEST with id_record
>>(int) as the primary key, and TXT_RTF (text) as the
>>unlimited column to store the RTF text in the db. I also
>>created record number 1 (id_record = 1) with a blank
>>TXT_RTF value.
>>Next, I created a normal Free-Form datawindow against this
>>table in PB 10.5.1. However, I noticed that the TXT_RTF
>>column got typed as char(32766) in the datawindow. I did
>>at least change the "Limit" to 0 (unlimited), but I don't
>>think it helped with the issues below.
>>Next, I placed an RTE control on the window, and coded the
>>"OPEN" even for the window as follows:
>>STRING ls_RTF
>>dw_1.SetTransObject(SQLConn)
>>dw_1.Retrieve(1)
>>rte_1.SetRedraw(FALSE)
>>ls_RTF = dw_1.Object.txt_rtf[1]
>>rte_1.SelectTextAll()
>>rte_1.Clear()
>>rte_1.PasteRTF(ls_RTF)
>>rte_1.SelectText(0,0,0,0)
>>rte_1.SetRedraw(TRUE)
>>
>>Next, the LoseFocus event for the RTE...
>>STRING ls_RTF
>>GraphicObject objControl
>>objControl = GetFocus()
>>IF (NOT ISVALID(objControl)) THEN
>> RETURN 0
>>END IF
>>IF (TypeOf(objControl) = RichTextEdit!) THEN
>> RETURN 0
>>END IF
>>// Prevent screen flicker...
>>rte_1.SetRedraw(FALSE)
>>rte_1.SelectTextAll()
>>ls_RTF = rte_1.CopyRTF()
>>dw_1.Object.txt_rtf[1] = ls_RTF
>>rte_1.SelectText(0,0,0,0)
>>rte_1.SetRedraw(TRUE)
>>
>>And finally, I created a Save button with the following
>>code:
>>dw_1.Update()
>>
>>What happens is as follows:
>>1. At first, I tried to open a word document with a
>>picture in it and hit Control-A to select the entire word
>>document, then pasted it into the RTE. Everything pasted
>>just fine except the image. Only got a skeleton box
>>instead. The users are really going to want this
>>Copy/Paste to work with the graphics.
>>2. Upon right-clicking the RTE and selecting "Insert File"
>>, I was able to open that very same document, and it DID
>>display the picture properly. I was able to click save,
>>and it seems to have saved it properly to the database. I
>>ran an SQL statement to look at the DATALENGTH(txt_rtf),
>>and it reported 476312 bytes, so I think the entire thing
>>did save to SQL Server. However, when I open up the window
>>again to try and re-load the document from SQL Server, it
>>just does not display anything. No error message either.
>>3. The statements above that read
>>rte_1.SelectText(0,0,0,0) do not seem to be working, as
>>the entire document remains selected even after the script
>>runs. 4. I've turned on the toolbar, but I don't see any
>>Font Color Picker in the toolbar at the top.
>>Any help would be much appreciated. I'm excited about this
>>new RTE control, but want to make sure I'm taking the
>>right approach to doing this.
>>Thanks!
>> =Steve=

--

Join the Advanced GUI Development project on CodeXchange
https://advanced-gui-development.codexchange.sybase.com/


Steve Posted on 2007-03-15 16:43:47.0Z
Sender: 7d7e.45ef215f.1804289383@sybase.com
From: Steve
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: Rich Text Edit Issues (several)...
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <45f977c3.531c.1681692777@sybase.com>
References: <45f94657$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 15 Mar 2007 08:43:47 -0800
X-Trace: forums-1-dub 1173977027 10.22.241.41 (15 Mar 2007 08:43:47 -0800)
X-Original-Trace: 15 Mar 2007 08:43:47 -0800, 10.22.241.41
Lines: 137
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9274
Article PK: 736434

Thanks Brad.
The on-line help for the UPDATEBLOB statement indicates that
the column in the database should be a "blob" column. Do you
know if it would be OK to leave my SQL Server column as
"text" (unlimited length text)?
Assuming this solves the issue with saving & reading the
larger documents, does anyone know how to solve the first
problem mentioned below where the Copy/Paste from a Word
document does not get the pictures copied into the RTE
control properly?
Thanks.
=Steve=

> You encountered a limitation with the datawindow. It can
> only put 32k worth of data into a single column. Ideally,
> what we need is a new column type that could handle an
> infinite amount of characters.
>
> To get around this you will have to use the SELECTBLOB and
> UPDATEBLOB commands to retrieve and save data to your
> database.
>
> Brad
>
> Steve wrote:
> > OK, a little more investigation reveals more info.
> > I went ahead and put some error checking into the OPEN
> > event as follows:
> > STRING ls_RTF
> > INT li_Result
> > dw_1.SetTransObject(SQLConn)
> > li_Result = dw_1.Retrieve(1)
> > IF (li_Result < 1) THEN
> > MessageBox("Error return " + STRING(li_Result) + "
> > retrieving datawindow row 1.","Hey...",StopSign!)
> > RETURN
> > END IF
> > rte_1.SetRedraw(FALSE)
> > ls_RTF = dw_1.Object.txt_rtf[1]
> > rte_1.SelectTextAll()
> > rte_1.Clear()
> > rte_1.PasteRTF(ls_RTF)
> > rte_1.SelectText(0,0,0,0)
> > rte_1.SetRedraw(TRUE)
> >
> > The Retrieve() method is returning 1 (no error happening
> > there). However, when I step through the code in the
> > debugger and inspect the contents of ls_RTF that is
> > fetched out of the datawindow, the entire RTF text was
> > not present. I went ahead and copied it to the clipboard
> > and pasted the partial RTF text into my UltraEdit editor
> > and saved the file. Guess what the size of the file is?
> > Sure enough, 32K. So the issue of PowerBuilder assigning
> > the char(32766) size for the TXT_RTF column is killing
> > this whole thing, I think. Any ideas?
> > =Steve=
> >
> >
> >>I'm developing a prototype Rich Text Editor window that
> >>will let the users enter rich text and save it to our
> SQL >>Server 2005 database.
> >>First I created a new table called RTF_TEST with
> id_record >>(int) as the primary key, and TXT_RTF (text)
> as the >>unlimited column to store the RTF text in the db.
> I also >>created record number 1 (id_record = 1) with a
> blank >>TXT_RTF value.
> >>Next, I created a normal Free-Form datawindow against
> this >>table in PB 10.5.1. However, I noticed that the
> TXT_RTF >>column got typed as char(32766) in the
> datawindow. I did >>at least change the "Limit" to 0
> (unlimited), but I don't >>think it helped with the issues
> below. >>Next, I placed an RTE control on the window, and
> coded the >>"OPEN" even for the window as follows:
> >>STRING ls_RTF
> >>dw_1.SetTransObject(SQLConn)
> >>dw_1.Retrieve(1)
> >>rte_1.SetRedraw(FALSE)
> >>ls_RTF = dw_1.Object.txt_rtf[1]
> >>rte_1.SelectTextAll()
> >>rte_1.Clear()
> >>rte_1.PasteRTF(ls_RTF)
> >>rte_1.SelectText(0,0,0,0)
> >>rte_1.SetRedraw(TRUE)
> >>
> >>Next, the LoseFocus event for the RTE...
> >>STRING ls_RTF
> >>GraphicObject objControl
> >>objControl = GetFocus()
> >>IF (NOT ISVALID(objControl)) THEN
> >> RETURN 0
> >>END IF
> >>IF (TypeOf(objControl) = RichTextEdit!) THEN
> >> RETURN 0
> >>END IF
> >>// Prevent screen flicker...
> >>rte_1.SetRedraw(FALSE)
> >>rte_1.SelectTextAll()
> >>ls_RTF = rte_1.CopyRTF()
> >>dw_1.Object.txt_rtf[1] = ls_RTF
> >>rte_1.SelectText(0,0,0,0)
> >>rte_1.SetRedraw(TRUE)
> >>
> >>And finally, I created a Save button with the following
> >>code:
> >>dw_1.Update()
> >>
> >>What happens is as follows:
> >>1. At first, I tried to open a word document with a
> >>picture in it and hit Control-A to select the entire
> word >>document, then pasted it into the RTE. Everything
> pasted >>just fine except the image. Only got a skeleton
> box >>instead. The users are really going to want this
> >>Copy/Paste to work with the graphics.
> >>2. Upon right-clicking the RTE and selecting "Insert
> File" >>, I was able to open that very same document, and
> it DID >>display the picture properly. I was able to click
> save, >>and it seems to have saved it properly to the
> database. I >>ran an SQL statement to look at the
> DATALENGTH(txt_rtf), >>and it reported 476312 bytes, so I
> think the entire thing >>did save to SQL Server. However,
> when I open up the window >>again to try and re-load the
> document from SQL Server, it >>just does not display
> anything. No error message either. >>3. The statements
> above that read >>rte_1.SelectText(0,0,0,0) do not seem to
> be working, as >>the entire document remains selected even
> after the script >>runs. 4. I've turned on the toolbar,
> but I don't see any >>Font Color Picker in the toolbar at
> the top. >>Any help would be much appreciated. I'm excited
> about this >>new RTE control, but want to make sure I'm
> taking the >>right approach to doing this.
> >>Thanks!
> >> =Steve=
>
>
> --
>
> Join the Advanced GUI Development project on CodeXchange
> https://advanced-gui-development.codexchange.sybase.com/


Steven McKenna Posted on 2007-03-17 14:18:12.0Z
From: "Steven McKenna" <techsupport@creativedatatech.com>
Newsgroups: sybase.public.powerbuilder.objects
References: <45f94657$1@forums-1-dub> <45f977c3.531c.1681692777@sybase.com> <45f97f95$1@forums-1-dub>
Subject: Re: Rich Text Edit Issues (several)...
Lines: 196
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 164.51.156.8
X-Original-NNTP-Posting-Host: 164.51.156.8
Message-ID: <45fbf8a4@forums-1-dub>
Date: 17 Mar 2007 06:18:12 -0800
X-Trace: forums-1-dub 1174141092 164.51.156.8 (17 Mar 2007 06:18:12 -0800)
X-Original-Trace: 17 Mar 2007 06:18:12 -0800, 164.51.156.8
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9286
Article PK: 736448

OK, I finally got to the bottom of the Copy/Paste issue from Microsoft Word
into an RTE edit box not bringing over the pictures:
When I originally created the Word document, I got the pictures into the
document by using my web browser (IE 7.0) and searching Google images for a
picture of Bob Barker (just for fun). What I found out is that if you
right-click a picture in your browser and select Copy, then Paste it into a
Word document, it not only embeds the picture into your word document, but
also embeds a hidden link to the web page where you got the picture from on
the Internet. Later on, the readers of your Word document, and hold down the
Control key while they click on the picutre, and it will bring up their
browser and take them to the original site. This extra link information is
confusing the PowerBuilder RTE control, and it doesn't properly paste the
picture while pasting the entire document into the RTE control. To further
prove this, I searched for the very same image in Google, and used my
"PrintKey" screen capture program to copy the picture to the clipboard, and
then pasted that into the Word document. After that, the entire document
Copy/Paste into the RTE control works like a charm!

=Steve=

"Brad Wery[TeamSybase]" <bradweryatagricoreunited.com> wrote in message
news:45f97f95$1@forums-1-dub...
> SELECTBLOB and UPDATEBLOB will work with the Text database datatype. We
> use it all the time here.
>
> As for your first issue, I can't reproduce it. I selected an image from a
> word document, copied it then pasted it into my RTE just fine. But, I do
> remember seeing this problem once before (with the InsertDocument
> function). The image was resized to display smaller in Word but in reality
> it's dimesions were really large. The image your pasting into the RTE may
> not be scaling down like it does in word. I bet you would see differenct
> results if you inserted a small picture into word (do not size it), then
> copy and paste it into your RTE. If this is truly the case, you will need
> to open a case with Sybase so they can open a case with the RTE people.
>
> Brad
>
> Steve wrote:
>> Thanks Brad.
>> The on-line help for the UPDATEBLOB statement indicates that
>> the column in the database should be a "blob" column. Do you
>> know if it would be OK to leave my SQL Server column as
>> "text" (unlimited length text)?
>> Assuming this solves the issue with saving & reading the
>> larger documents, does anyone know how to solve the first
>> problem mentioned below where the Copy/Paste from a Word
>> document does not get the pictures copied into the RTE
>> control properly?
>> Thanks.
>> =Steve=
>>
>>>You encountered a limitation with the datawindow. It can
>>>only put 32k worth of data into a single column. Ideally,
>>>what we need is a new column type that could handle an
>>>infinite amount of characters.
>>>
>>>To get around this you will have to use the SELECTBLOB and
>>>UPDATEBLOB commands to retrieve and save data to your
>>>database.
>>>
>>>Brad
>>>
>>>Steve wrote:
>>>
>>>>OK, a little more investigation reveals more info.
>>>>I went ahead and put some error checking into the OPEN
>>>>event as follows:
>>>>STRING ls_RTF
>>>>INT li_Result
>>>>dw_1.SetTransObject(SQLConn)
>>>>li_Result = dw_1.Retrieve(1)
>>>>IF (li_Result < 1) THEN
>>>> MessageBox("Error return " + STRING(li_Result) + "
>>>>retrieving datawindow row 1.","Hey...",StopSign!)
>>>> RETURN
>>>>END IF
>>>>rte_1.SetRedraw(FALSE)
>>>>ls_RTF = dw_1.Object.txt_rtf[1]
>>>>rte_1.SelectTextAll()
>>>>rte_1.Clear()
>>>>rte_1.PasteRTF(ls_RTF)
>>>>rte_1.SelectText(0,0,0,0)
>>>>rte_1.SetRedraw(TRUE)
>>>>
>>>>The Retrieve() method is returning 1 (no error happening
>>>>there). However, when I step through the code in the
>>>>debugger and inspect the contents of ls_RTF that is
>>>>fetched out of the datawindow, the entire RTF text was
>>>>not present. I went ahead and copied it to the clipboard
>>>>and pasted the partial RTF text into my UltraEdit editor
>>>>and saved the file. Guess what the size of the file is?
>>>>Sure enough, 32K. So the issue of PowerBuilder assigning
>>>>the char(32766) size for the TXT_RTF column is killing
>>>>this whole thing, I think. Any ideas?
>>>> =Steve=
>>>>
>>>>
>>>>
>>>>>I'm developing a prototype Rich Text Editor window that
>>>>>will let the users enter rich text and save it to our
>>>
>>>SQL >>Server 2005 database.
>>>
>>>>>First I created a new table called RTF_TEST with
>>>
>>>id_record >>(int) as the primary key, and TXT_RTF (text)
>>>as the >>unlimited column to store the RTF text in the db.
>>>I also >>created record number 1 (id_record = 1) with a
>>>blank >>TXT_RTF value.
>>>
>>>>>Next, I created a normal Free-Form datawindow against
>>>
>>>this >>table in PB 10.5.1. However, I noticed that the
>>>TXT_RTF >>column got typed as char(32766) in the
>>>datawindow. I did >>at least change the "Limit" to 0
>>>(unlimited), but I don't >>think it helped with the issues
>>>below. >>Next, I placed an RTE control on the window, and
>>>coded the >>"OPEN" even for the window as follows:
>>>
>>>>>STRING ls_RTF
>>>>>dw_1.SetTransObject(SQLConn)
>>>>>dw_1.Retrieve(1)
>>>>>rte_1.SetRedraw(FALSE)
>>>>>ls_RTF = dw_1.Object.txt_rtf[1]
>>>>>rte_1.SelectTextAll()
>>>>>rte_1.Clear()
>>>>>rte_1.PasteRTF(ls_RTF)
>>>>>rte_1.SelectText(0,0,0,0)
>>>>>rte_1.SetRedraw(TRUE)
>>>>>
>>>>>Next, the LoseFocus event for the RTE...
>>>>>STRING ls_RTF
>>>>>GraphicObject objControl
>>>>>objControl = GetFocus()
>>>>>IF (NOT ISVALID(objControl)) THEN
>>>>> RETURN 0
>>>>>END IF
>>>>>IF (TypeOf(objControl) = RichTextEdit!) THEN
>>>>> RETURN 0
>>>>>END IF
>>>>>// Prevent screen flicker...
>>>>>rte_1.SetRedraw(FALSE)
>>>>>rte_1.SelectTextAll()
>>>>>ls_RTF = rte_1.CopyRTF()
>>>>>dw_1.Object.txt_rtf[1] = ls_RTF
>>>>>rte_1.SelectText(0,0,0,0)
>>>>>rte_1.SetRedraw(TRUE)
>>>>>
>>>>>And finally, I created a Save button with the following
>>>>>code:
>>>>>dw_1.Update()
>>>>>
>>>>>What happens is as follows:
>>>>>1. At first, I tried to open a word document with a
>>>>>picture in it and hit Control-A to select the entire
>>>
>>>word >>document, then pasted it into the RTE. Everything
>>>pasted >>just fine except the image. Only got a skeleton
>>>box >>instead. The users are really going to want this
>>>
>>>>>Copy/Paste to work with the graphics.
>>>>>2. Upon right-clicking the RTE and selecting "Insert
>>>
>>>File" >>, I was able to open that very same document, and
>>>it DID >>display the picture properly. I was able to click
>>>save, >>and it seems to have saved it properly to the
>>>database. I >>ran an SQL statement to look at the
>>>DATALENGTH(txt_rtf), >>and it reported 476312 bytes, so I
>>>think the entire thing >>did save to SQL Server. However,
>>>when I open up the window >>again to try and re-load the
>>>document from SQL Server, it >>just does not display
>>>anything. No error message either. >>3. The statements
>>>above that read >>rte_1.SelectText(0,0,0,0) do not seem to
>>>be working, as >>the entire document remains selected even
>>>after the script >>runs. 4. I've turned on the toolbar,
>>>but I don't see any >>Font Color Picker in the toolbar at
>>>the top. >>Any help would be much appreciated. I'm excited
>>>about this >>new RTE control, but want to make sure I'm
>>>taking the >>right approach to doing this.
>>>
>>>>>Thanks!
>>>>> =Steve=
>>>
>>>
>>>--
>>>
>>>Join the Advanced GUI Development project on CodeXchange
>>>https://advanced-gui-development.codexchange.sybase.com/
>
>
> --
>
> Join the Advanced GUI Development project on CodeXchange
> https://advanced-gui-development.codexchange.sybase.com/


Brad Wery[TeamSybase] Posted on 2007-03-15 15:40:12.0Z
From: "Brad Wery[TeamSybase]" <bradweryatagricoreunited.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: Rich Text Edit Issues (several)...
References: <45f860be.352f.1681692777@sybase.com> <45f86338.3567.1681692777@sybase.com>
In-Reply-To: <45f86338.3567.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: ugg10.unitedgrain.ca
X-Original-NNTP-Posting-Host: ugg10.unitedgrain.ca
Message-ID: <45f968dc@forums-1-dub>
Date: 15 Mar 2007 07:40:12 -0800
X-Trace: forums-1-dub 1173973212 165.23.247.49 (15 Mar 2007 07:40:12 -0800)
X-Original-Trace: 15 Mar 2007 07:40:12 -0800, ugg10.unitedgrain.ca
Lines: 118
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9273
Article PK: 736432

For issue 3, try SelectText(1,1,1,1) instead.
For issue 4, the toolbar works fine with my version of PB. What build
number are you using?

Steve wrote:
> OK, a little more investigation reveals more info.
> I went ahead and put some error checking into the OPEN event
> as follows:
> STRING ls_RTF
> INT li_Result
> dw_1.SetTransObject(SQLConn)
> li_Result = dw_1.Retrieve(1)
> IF (li_Result < 1) THEN
> MessageBox("Error return " + STRING(li_Result) + "
> retrieving datawindow row 1.","Hey...",StopSign!)
> RETURN
> END IF
> rte_1.SetRedraw(FALSE)
> ls_RTF = dw_1.Object.txt_rtf[1]
> rte_1.SelectTextAll()
> rte_1.Clear()
> rte_1.PasteRTF(ls_RTF)
> rte_1.SelectText(0,0,0,0)
> rte_1.SetRedraw(TRUE)
>
> The Retrieve() method is returning 1 (no error happening
> there). However, when I step through the code in the
> debugger and inspect the contents of ls_RTF that is fetched
> out of the datawindow, the entire RTF text was not present.
> I went ahead and copied it to the clipboard and pasted the
> partial RTF text into my UltraEdit editor and saved the
> file. Guess what the size of the file is? Sure enough, 32K.
> So the issue of PowerBuilder assigning the char(32766) size
> for the TXT_RTF column is killing this whole thing, I think.
> Any ideas?
> =Steve=
>
>
>>I'm developing a prototype Rich Text Editor window that
>>will let the users enter rich text and save it to our SQL
>>Server 2005 database.
>>First I created a new table called RTF_TEST with id_record
>>(int) as the primary key, and TXT_RTF (text) as the
>>unlimited column to store the RTF text in the db. I also
>>created record number 1 (id_record = 1) with a blank
>>TXT_RTF value.
>>Next, I created a normal Free-Form datawindow against this
>>table in PB 10.5.1. However, I noticed that the TXT_RTF
>>column got typed as char(32766) in the datawindow. I did
>>at least change the "Limit" to 0 (unlimited), but I don't
>>think it helped with the issues below.
>>Next, I placed an RTE control on the window, and coded the
>>"OPEN" even for the window as follows:
>>STRING ls_RTF
>>dw_1.SetTransObject(SQLConn)
>>dw_1.Retrieve(1)
>>rte_1.SetRedraw(FALSE)
>>ls_RTF = dw_1.Object.txt_rtf[1]
>>rte_1.SelectTextAll()
>>rte_1.Clear()
>>rte_1.PasteRTF(ls_RTF)
>>rte_1.SelectText(0,0,0,0)
>>rte_1.SetRedraw(TRUE)
>>
>>Next, the LoseFocus event for the RTE...
>>STRING ls_RTF
>>GraphicObject objControl
>>objControl = GetFocus()
>>IF (NOT ISVALID(objControl)) THEN
>> RETURN 0
>>END IF
>>IF (TypeOf(objControl) = RichTextEdit!) THEN
>> RETURN 0
>>END IF
>>// Prevent screen flicker...
>>rte_1.SetRedraw(FALSE)
>>rte_1.SelectTextAll()
>>ls_RTF = rte_1.CopyRTF()
>>dw_1.Object.txt_rtf[1] = ls_RTF
>>rte_1.SelectText(0,0,0,0)
>>rte_1.SetRedraw(TRUE)
>>
>>And finally, I created a Save button with the following
>>code:
>>dw_1.Update()
>>
>>What happens is as follows:
>>1. At first, I tried to open a word document with a
>>picture in it and hit Control-A to select the entire word
>>document, then pasted it into the RTE. Everything pasted
>>just fine except the image. Only got a skeleton box
>>instead. The users are really going to want this
>>Copy/Paste to work with the graphics.
>>2. Upon right-clicking the RTE and selecting "Insert File"
>>, I was able to open that very same document, and it DID
>>display the picture properly. I was able to click save,
>>and it seems to have saved it properly to the database. I
>>ran an SQL statement to look at the DATALENGTH(txt_rtf),
>>and it reported 476312 bytes, so I think the entire thing
>>did save to SQL Server. However, when I open up the window
>>again to try and re-load the document from SQL Server, it
>>just does not display anything. No error message either.
>>3. The statements above that read
>>rte_1.SelectText(0,0,0,0) do not seem to be working, as
>>the entire document remains selected even after the script
>>runs. 4. I've turned on the toolbar, but I don't see any
>>Font Color Picker in the toolbar at the top.
>>Any help would be much appreciated. I'm excited about this
>>new RTE control, but want to make sure I'm taking the
>>right approach to doing this.
>>Thanks!
>> =Steve=

--

Join the Advanced GUI Development project on CodeXchange
https://advanced-gui-development.codexchange.sybase.com/


"Mike Niemann" <mniemann Posted on 2007-03-16 16:40:24.0Z
From: "Mike Niemann" <mniemann@nospam_oowidgets.com>
Newsgroups: sybase.public.powerbuilder.objects
References: <45f860be.352f.1681692777@sybase.com> <45f86338.3567.1681692777@sybase.com>
Subject: Re: Rich Text Edit Issues (several)...
Lines: 120
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 167.83.101.24
X-Original-NNTP-Posting-Host: 167.83.101.24
Message-ID: <45fac878$1@forums-1-dub>
Date: 16 Mar 2007 08:40:24 -0800
X-Trace: forums-1-dub 1174063224 167.83.101.24 (16 Mar 2007 08:40:24 -0800)
X-Original-Trace: 16 Mar 2007 08:40:24 -0800, 167.83.101.24
X-Authenticated-User: pb110beta
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9277
Article PK: 736436

Steve,

The simple thing to do would be to edit the source for the datawindow, and
set the column width to 100000... or what works for you.

Brad's suggestion is a better solution, but not without potential challenges
as well.

Regards,
Mike Niemann, PBBrowser Author

<Steve> wrote in message news:45f86338.3567.1681692777@sybase.com...
> OK, a little more investigation reveals more info.
> I went ahead and put some error checking into the OPEN event
> as follows:
> STRING ls_RTF
> INT li_Result
> dw_1.SetTransObject(SQLConn)
> li_Result = dw_1.Retrieve(1)
> IF (li_Result < 1) THEN
> MessageBox("Error return " + STRING(li_Result) + "
> retrieving datawindow row 1.","Hey...",StopSign!)
> RETURN
> END IF
> rte_1.SetRedraw(FALSE)
> ls_RTF = dw_1.Object.txt_rtf[1]
> rte_1.SelectTextAll()
> rte_1.Clear()
> rte_1.PasteRTF(ls_RTF)
> rte_1.SelectText(0,0,0,0)
> rte_1.SetRedraw(TRUE)
>
> The Retrieve() method is returning 1 (no error happening
> there). However, when I step through the code in the
> debugger and inspect the contents of ls_RTF that is fetched
> out of the datawindow, the entire RTF text was not present.
> I went ahead and copied it to the clipboard and pasted the
> partial RTF text into my UltraEdit editor and saved the
> file. Guess what the size of the file is? Sure enough, 32K.
> So the issue of PowerBuilder assigning the char(32766) size
> for the TXT_RTF column is killing this whole thing, I think.
> Any ideas?
> =Steve=
>
>> I'm developing a prototype Rich Text Editor window that
>> will let the users enter rich text and save it to our SQL
>> Server 2005 database.
>> First I created a new table called RTF_TEST with id_record
>> (int) as the primary key, and TXT_RTF (text) as the
>> unlimited column to store the RTF text in the db. I also
>> created record number 1 (id_record = 1) with a blank
>> TXT_RTF value.
>> Next, I created a normal Free-Form datawindow against this
>> table in PB 10.5.1. However, I noticed that the TXT_RTF
>> column got typed as char(32766) in the datawindow. I did
>> at least change the "Limit" to 0 (unlimited), but I don't
>> think it helped with the issues below.
>> Next, I placed an RTE control on the window, and coded the
>> "OPEN" even for the window as follows:
>> STRING ls_RTF
>> dw_1.SetTransObject(SQLConn)
>> dw_1.Retrieve(1)
>> rte_1.SetRedraw(FALSE)
>> ls_RTF = dw_1.Object.txt_rtf[1]
>> rte_1.SelectTextAll()
>> rte_1.Clear()
>> rte_1.PasteRTF(ls_RTF)
>> rte_1.SelectText(0,0,0,0)
>> rte_1.SetRedraw(TRUE)
>>
>> Next, the LoseFocus event for the RTE...
>> STRING ls_RTF
>> GraphicObject objControl
>> objControl = GetFocus()
>> IF (NOT ISVALID(objControl)) THEN
>> RETURN 0
>> END IF
>> IF (TypeOf(objControl) = RichTextEdit!) THEN
>> RETURN 0
>> END IF
>> // Prevent screen flicker...
>> rte_1.SetRedraw(FALSE)
>> rte_1.SelectTextAll()
>> ls_RTF = rte_1.CopyRTF()
>> dw_1.Object.txt_rtf[1] = ls_RTF
>> rte_1.SelectText(0,0,0,0)
>> rte_1.SetRedraw(TRUE)
>>
>> And finally, I created a Save button with the following
>> code:
>> dw_1.Update()
>>
>> What happens is as follows:
>> 1. At first, I tried to open a word document with a
>> picture in it and hit Control-A to select the entire word
>> document, then pasted it into the RTE. Everything pasted
>> just fine except the image. Only got a skeleton box
>> instead. The users are really going to want this
>> Copy/Paste to work with the graphics.
>> 2. Upon right-clicking the RTE and selecting "Insert File"
>> , I was able to open that very same document, and it DID
>> display the picture properly. I was able to click save,
>> and it seems to have saved it properly to the database. I
>> ran an SQL statement to look at the DATALENGTH(txt_rtf),
>> and it reported 476312 bytes, so I think the entire thing
>> did save to SQL Server. However, when I open up the window
>> again to try and re-load the document from SQL Server, it
>> just does not display anything. No error message either.
>> 3. The statements above that read
>> rte_1.SelectText(0,0,0,0) do not seem to be working, as
>> the entire document remains selected even after the script
>> runs. 4. I've turned on the toolbar, but I don't see any
>> Font Color Picker in the toolbar at the top.
>> Any help would be much appreciated. I'm excited about this
>> new RTE control, but want to make sure I'm taking the
>> right approach to doing this.
>> Thanks!
>> =Steve=