cancel
Showing results for 
Search instead for 
Did you mean: 

rte_1.insertdocument() returning -1 after 2nd call

Former Member
0 Kudos
72

Hi everyone,

in my application i have a window with a rich text edit control.

This window can be opened for different object id's, every id with a unique rtf-file, saved locally.

If the local rtf-file does not exist while opening, i wanted to insert a default.rtf into the rte control.

This works well for 2 calls, but opening the window for the third object, insertdocument() always returns -1.

It doesent matter which object it is, it's always the third time i open the window with the rte-control.

I searched the web for several hours, without noticing any problem like this.

Perhaps some of you guys can provide help.

Thx and please excuse my engish

The Code looks like this:

open event of window:

IF FileExists("Standard.rtf") then

    

     rte_1.insertdocument("Standard.rtf", FALSE)

END IF

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Chris;

  Can you tell us ....

1) What version and build of PB you are using?

2) What version and build of MS-Windows you are using?

Regards ... Chris

Former Member
0 Kudos

I'm Sorry, forgot most relevant data!

Using PB 10.5

Error occurs with office 2000 and 2003, where the only versions I tried.

Greets Chris

Former Member
0 Kudos

That could be a hard one to diagnose because:

1) PB 10.5 is long ago EOL'ed. I only use PB v12.1 or higher these days.

2) If you are on W7, PB only attained certification for that O/S in version 11.5.1.

3) In version 11.5.0 of PB it introduced a new/enhanced RTF object.

You did not mention your O/S ... am I to assume its XP?

former_member190719
Active Contributor
0 Kudos

>>3) In version 11.5.0 of PB it introduced a new/enhanced RTF object.

Actually, it was 10.5.  It's the one he's using.

Former Member
0 Kudos

Hi Bruce;

  Thanks ... yes, could have been 10.5 for that control initially. I seem to remember though that the RTE control was enhanced further in the PB 11.x realm. I was going to suggest that Chris upload a simple example application that fails - but, since all this software is passé for me I could not begin to test the code in earnest. Of course, this forum does not support attachments either which makes helping people even more cumbersome compared to the old new groups. 

Regards ... Chris

former_member190719
Active Contributor
0 Kudos

The only rich text functionality added in 11.5 was the introduction of the rich text edit style in the datawindow.  There were no significant changes for the rich text control.

StackOverflow doesn't support attachments either, intentionally, and it works quite well.

Former Member
0 Kudos

FWIW: Between each RTE document do you use the CLEARALL command?

FYI: Having Windows Animation ON can effect the RTE control.

Former Member
0 Kudos

Hey guys, thx for your answers.

I'm sorry for a big mistake i did, wrote my last reply on my way home and already switched my brain off it seems.

I'm currently working with Powerbuilder 11.2 Build 8949!

I'm sorry for the misinformation.

@Chris: I looked for the ClearAll command, but could not find it. Do you mean the ClearAll function for RichtTextEdit-Controls? Because this one was first introduced in PB 12...

Thanks for your engagement so far!

Greets from Germany

Chris

EDIT:

it seems like i fixed the issue by giving the full path, for example rte_1.insertdocument("P:\Standard.rtf", FALSE).

atm still testing if it really works, even when deployed.

Greets Chris

2nd EDIT:

Application works fine now. I'm giving the full path through my .ini-File to be able to easily change if needed.

But still i can't figure out, why it won't work correctly using the "standard" application path.

Am i missing some special properties to be set?

Greets Chris

Message was edited by: Christopher Habermann

Former Member
0 Kudos

Excellent news!

Yes, I was going to recommend that you check your path assignments as well. I just completed a new system that uses the RTE control to load OCR'ed text to process. The new application does this repetitively on 51M images => OCR and is working flawlessly - but use absolute paths.

You are correct <my bad> the ClearAll ( ) method was added in PB after 11.2. I am not sure if it was 11.5.0 or 12.0 - but I use that in my PB 12.1 based OCR applications. That is why I was stressing to Bruce that although the RTE control was updated in PB 10.x - there were key upgrades and enhancements after that PB version as well.

BTW: The RTE control is *not* from Sybase and is a 3rd party control that has been integrated into PB via the IDE's own wrapper.

former_member190719
Active Contributor
0 Kudos

ClearAll was added in 12.0:

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00357.1200/html/newfeat/B...

There are upgrades and enhancements in each release.  However, what you said was that: "version 11.5.0 of PB it introduced a new/enhanced RTF object."  The new control was added in 10.5.  Your reference to 11.5 was either a typo or a mistake.

arnd_schmidt
Active Contributor
0 Kudos

Hi Christopher,

your code was indeed misleading.

Does the FileExists ()  returned true and only insertdocument failed?

My bet is that between the first and the second fileexists()/insertdocument() your app changes the current directory.

If you do not give an absolute path to a file, it's relative to the current directory.

AFAIK something like a saveas() or a fileopen() can have the side effect of changing the current directory.

Former Member
0 Kudos

Hi Arnd,

you are absolutely right.

It seems like my problem was calling the saveas() after the insertdocument(), so the current directory really changed and the rtf-document was not found anymore.

Thanks for your answer.