![]() |
RichEdit with nsDialogs?
I can't seem to figure out how to add a RichEdit control with nsDialogs. I've tried
PHP Code:
|
RICHEDIT_CLASS is not the real name, try "RICHEDIT" or "RichEdit20A"
|
Thanks, RichEdit20A worked.
|
Hi!
Now that I know how to create a richedit control using nsDialogs - thanks for that - how would I go about loading an .rtf file into the control using the system plugin? Thanks in advance. Brad. |
|
Thanks for your response, Anders.
The thread you've linked to though has example code that, as best as I can tell, only streams text into the control. Is there any [easy] way to load an actual Rich Text File into the control? I've tried googling for a Windows API command that can do it, but with no luck... |
its the same message (http://msdn2.microsoft.com/en-us/lib...02(VS.85).aspx )
just use SF_RTF (2) and easy? there is no such thing when the system plugin is involved ;) |
Thanks again! I'll give it a go.... :D
|
I just use this to load the RTF data. The article states '.txt' files, but RTF are just text files with funky formatting.
http://nsis.sourceforge.net/External_License_file Also, if you want a thin border on the RichEdit box, just use the WS_EX_STATICEDGE flag instead of __NSD_Text_EXSTYLE. Here's the full code I use: PHP Code:
|
Thanks for your help, vbguy! Here's my code:
code: Unfortunately, it doesn't display all of the RTF file. I'm guessing this is because of the value that GetFileSize returns, and the additional bytes used for the formatting of the RTF file. I tried using EM_STREAMIN as Anders suggested, but I'm completely lost with that bit of code.... Any further ideas? Brad. |
You need to replace the hwnd to point to your added text box (or rich text box):
PHP Code:
PHP Code:
|
vbguy: you can't use WM_SETTEXT, it seems to work for some simple rtf files, but not everything
|
Thanks for your help guys.
Anders, any chance you could give us some example code that streams an .rtf file into a richtext control using EM_STREAMIN? Please? Before I lose any more hair? :eek: |
no, can't make it work, I end up with the same problem as WM_SETTEXT, the file will not load 100%
|
Quote:
Edit: Where in the MUI2 code is the RTF data loaded for the standard license page? Is it done using a C/C++ plugin, or is the file loaded using NSIS code? Couldn't we just hijack the default code and apply it to the newly created RichEdit box? |
Fixed! It's always something simple that's causing the problem isn't it?
All you have to do is use EM_EXLIMITTEXT to set the size of the rich text control! code: |
1 Attachment(s)
that changes nothing, thats only the length, even a rtf file less than 300bytes will not load, atleast not for me
|
That's strange. The RTF file I'm using is about 58Kb. Without sending that EM_EXLIMITTEXT message, it wouldn't display the last quarter of the file. With the message, it displays it fine.
|
Quote:
Thanks, bradharding, for finding that flag. |
alright, I think this works
code: the code is a little bit longer than the WM_SETTEXT code, but it does not alloc the whole file at once, and does not know or care about the filesize at all |
Quote:
|
You should.
|
Quote:
Also, I think the community would benefit by having all the RichEdit particulars figured out in the nsDialogs.nsh. I didn't mean to belittle your work. If you were implying that I should do the work, then I would be glad to. I have just a couple of questions, though: 1. On what version of nsDialogs.nsh do I base my work? The latest svn version, or the latest "stable" version? 2. In what form do I post the results? A patch file or the full file? 3. Where do I post the results? Here, or is there another NSIS developer forum? |
I misread it as "maybe I should submit it for inclusion" and wanted to encourage you to do so by letting you know I will include it in the next version.
If you wish to make the change and submit it, you should base your work on the latest nsDialogs.nsh from Subversion. But even if you don't, this is not a fundamental change, so a patch for 2.35's version won't be hard to apply. The best way is to submit a patch to patch tracker, but a full file would work as well. |
I made a test file:
PHP Code:
Also, anybody say how can I show custom text in RichEdit without using RTF file? Thanks in advance! |
Okay, I find a way to display RTF with aforementioned code. But now I got another problem: if I go back to page with custom RTF, then nothing is shown is RichEdit. I've found, that
PHP Code:
Can anybody help me to solve this issue? |
I've found an other way to solve my problem
PHP Code:
Here is link to the plugin: http://nsis.sourceforge.net/CustomLicense_plug-in ;) |
for what it's worth - I think the actual problem is that callback1 rolls over to callback2 the next time your page is generated.
I'm not sure if there's an appropriate method to prevent that, but you can always make the "callback1" check more dynamic by Pop'ing it into a var first, then Push'ing it back onto the stack, and then compare against that var. Here's a function + macro + define (I'll post to wiki after review from smarter people): code: Usage is pretty simple. Presuming you have the above saved in "LoadRTF.nsh": code: *crosses fingers* |
I've found more easy way (see my next post) to fix probkem with RTF.
But thanks anyway :) |
I know - it's just there for completeness sake and for those who can't, or don't want to, rely on plugins :)
|
Show Rich text in control
I want to show some rich text in a Label that does not come from any file. Soemthing like
This is bold and this is in italics and this is underlined. The text gets generated dynamically at run time, so i cant use multiple controls. Kindly suggest how can I achieve this thanks for your help |
| All times are GMT. The time now is 18:01. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.