Rich Text Box Control....

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by LJ.

Is there a way to create a box, like this message box, then select some text in the box and apply a font or color to it? Then, if I save the contents of the box to a file, I would expect to see RTF code like: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\fswiss\fcharset0 MS Sans Serif;}{\f2\fnil\fcharset0 MS Sans Serif;}{\f3\fnil Surfer;}}
{\colortbl ;\red0\green0\blue0;\red128\green0\blue128;}
in the file if I opened it with Notepad.

Is there a Rich Text Box control in Pure Basic or plans for one?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

Go to Paul's PB resources site and you will find there El_Choni`s excellent library for using RichEdit in PB

http://www.reelmediaproductions.com/pb/asmlibrary.html

Take a look at the site because there are a lot of great libraries, snippets, addons, etc. Its a MUST for every PB coder.

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by LJ.

Hi Ricardo. Thanks for the links. I downloaded the RichEdit program by El_Choni, installed it in the correct folder. However, when I try to run the example, I get the following error:
INIFilename()is not a function, an array, or a linked list.

The error in the program is on this line:
If INIFilename(".\PureRichEdit.ini") = 0

Any suggestions?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

Maybe this is another library, search it in the same resources site and download it or just comment that line, the richedit libb dosent need the ini to work, maybe just El Choni's example use it but for the use of richedit its not necessary.


Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Correct, the example uses the good old Mr. Skunk INI library (available, IIRC, from Paul's site: http://www.reelmediaproductions.com/pb). This has been changed for future releases. Anyway, I don't know if there'll be future releases: it seems that, at last, PB will have native implementation for rich text: AFAIK, it's planned after scroll bars in someone's todo list. Scrollbars are piece of cake, so I guess PB 3.7/4.0 will have an RTF box.

Just wait'n'see... (like me)

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by LJ.

Thanks Ricardo, thanks El_Choni. The RTF program .exe that came with El_Choni's example created a new seperate floating RTF box when I clicked on File, New. I'm using Windows XP. That sounds great that a future release of Pure Basic will have the RTF box, I will get in line to wait. Thanks again.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.
The RTF program .exe that came with El_Choni's example created a new seperate floating RTF box when I clicked on File, New.
A floating RTF box! I wasn't aware of that 'feature' XD. Anyway, I can't reproduce that behaviour here (XP too). If you need any help using the library, or the API related functions while we wait for a native implementation, just ask.

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by LJ.

Hi El_Choni: Okay, I will show you how to duplicate the floating window error. First, run the .exe file you included in the zip package called PureRichEdit.exe

Now type in the RichEdit box, "this is a test", press ENTER

Next, apply a font and color to the word test. Any font size and any color it doesn't matter.

Next, click on File, select Save As...
You can make any final name with a ".rtf" at the end. But notice first bug, no .rtf type, only .txt. So ignore file type field and in the name of the file put: delete.rtf

Now after .rtf file is saved, select File, New.

BOOM, BUG! Floating rtf window pops up seperate from main window blocking everything.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

You're right: it happens even using only the Font dialog (without typing or saving anything), and I've seen some other bugs in the file. Tha fact is that both the library and the example file have changed a lot since that version (in my computer), and I haven't updated it because there are still some function missing. I don't know if I'll be able to finish it before next PB release, but I'll try.

Thanks for the bug report.

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by LJ.

Thank you El_Choni and that's an awesome RTF library you wrote.
Post Reply