![]() |
#1 |
Junior Member
Join Date: Jul 2006
Posts: 30
|
RichEdit with nsDialogs?
I can't seem to figure out how to add a RichEdit control with nsDialogs. I've tried
PHP Code:
|
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
RICHEDIT_CLASS is not the real name, try "RICHEDIT" or "RichEdit20A"
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Jul 2006
Posts: 30
|
Thanks, RichEdit20A worked.
|
![]() |
![]() |
![]() |
#4 |
Member
Join Date: Sep 2003
Posts: 53
|
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. |
![]() |
![]() |
![]() |
#5 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#6 |
Member
Join Date: Sep 2003
Posts: 53
|
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... |
![]() |
![]() |
![]() |
#7 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
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 ![]() IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#8 |
Member
Join Date: Sep 2003
Posts: 53
|
![]()
Thanks again! I'll give it a go....
![]() |
![]() |
![]() |
![]() |
#9 |
Junior Member
Join Date: Jul 2006
Posts: 30
|
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:
Last edited by vbguy; 11th March 2008 at 13:15. |
![]() |
![]() |
![]() |
#10 |
Member
Join Date: Sep 2003
Posts: 53
|
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. |
![]() |
![]() |
![]() |
#11 |
Junior Member
Join Date: Jul 2006
Posts: 30
|
You need to replace the hwnd to point to your added text box (or rich text box):
PHP Code:
PHP Code:
|
![]() |
![]() |
![]() |
#12 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
vbguy: you can't use WM_SETTEXT, it seems to work for some simple rtf files, but not everything
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#13 |
Member
Join Date: Sep 2003
Posts: 53
|
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? ![]() |
![]() |
![]() |
![]() |
#14 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
no, can't make it work, I end up with the same problem as WM_SETTEXT, the file will not load 100%
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#15 | |
Junior Member
Join Date: Jul 2006
Posts: 30
|
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? Last edited by vbguy; 11th March 2008 at 22:15. |
|
![]() |
![]() |
![]() |
#16 |
Member
Join Date: Sep 2003
Posts: 53
|
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: |
![]() |
![]() |
![]() |
#17 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
that changes nothing, thats only the length, even a rtf file less than 300bytes will not load, atleast not for me
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#18 |
Member
Join Date: Sep 2003
Posts: 53
|
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.
|
![]() |
![]() |
![]() |
#19 | |
Junior Member
Join Date: Jul 2006
Posts: 30
|
Quote:
Thanks, bradharding, for finding that flag. |
|
![]() |
![]() |
![]() |
#20 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
|
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 IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#21 | |
Junior Member
Join Date: Jul 2006
Posts: 30
|
Quote:
|
|
![]() |
![]() |
![]() |
#22 |
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
You should.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
![]() |
![]() |
![]() |
#23 | |
Junior Member
Join Date: Jul 2006
Posts: 30
|
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? |
|
![]() |
![]() |
![]() |
#24 |
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
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. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
![]() |
![]() |
![]() |
#25 |
Junior Member
Join Date: May 2009
Posts: 14
|
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! |
![]() |
![]() |
![]() |
#26 |
Junior Member
Join Date: May 2009
Posts: 14
|
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? |
![]() |
![]() |
![]() |
#27 |
Junior Member
Join Date: May 2009
Posts: 14
|
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 ![]() |
![]() |
![]() |
![]() |
#28 |
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
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* |
![]() |
![]() |
![]() |
#29 |
Junior Member
Join Date: May 2009
Posts: 14
|
I've found more easy way (see my next post) to fix probkem with RTF.
But thanks anyway ![]() |
![]() |
![]() |
![]() |
#30 |
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
I know - it's just there for completeness sake and for those who can't, or don't want to, rely on plugins
![]() |
![]() |
![]() |
![]() |
#31 |
Junior Member
Join Date: Jul 2013
Posts: 1
|
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 |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|