RichText control default style (remove scrollbar)

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!

Pages

Anonymous user
RichText control default style (remove scrollbar)

Hi,

I'm trying to create a richtext control without horizontal scroll bar. With your software it's possible to add styles (and ex-styles) to a control, just ticking checkboxes (which translate to ${NSD_AddStyle} or ${NSD_AddExStyle} commands), but I can't figure out how to remove default styles like "WS_HSCROLL". Actually I'm editing the resulting nsdinc file but every time I need to modify something in the page, I have to remember to manually edit the nsdinc file. :-(

Any help?

Thanks

Posts: 1972
Joined: March 25, 2012 - 01:19
Thanks for pointing out this

Thanks for pointing out this bug.

In fact the first script line of each control (the one containing nsDialogs::CreateControl command) should contain only the styles selected through property, and the corresponding property should have a proper default.
This way the subsequent ${NSD_AddStyle} and ${NSD_AddExStyle} commands become unuseful.

Actually the CreateControl line has its styles hardcoded...
I need to remember why I implemented it like this, maybe some styles can't be set during control creation and must be changed later?

Meanwhile you can try to put this code into ControlCustomScript property of RichText control, editing to your needs:

 

System::Call "user32::SetWindowLong(i $hCtl_Form1_RichText1, i ${GWL_STYLE}, i ${WS_VISIBLE}|${WS_CHILD}|.....)"

This will be preserved on save.

Anonymous user
Another bug

Hello,

I've been unable to remove scrollbar using ControlCustomScript . I replaced $hCtl_Form1_RichText1 with the correct variable name, and defined the style, but nothing seems to happen...

By the way, I discovered a bug. It seems you are defining this control's position and size in pixels instead of "u"s. When my installer is run on a computer with big fonts, the control appears at a different postion.

Thanks for your help and happy holidays!

Posts: 1972
Joined: March 25, 2012 - 01:19
I'll take a look at it when I

I'll take a look at it when I came back home from holidays.

Thanks

Posts: 1972
Joined: March 25, 2012 - 01:19
Bugs

Could you send me a short compilable sample? I mean both *.nsdinc and *.nsddef files.

As for the pixel issue, I just tested latest version and it works on my side.

Please double check the CoordinateSystem property of both the control and dialog.
You should set DialogUnits to the dialog and Inherit to the control.

Anonymous user
bugs are gone?

It's very strange. Two days ago, a team mate and myself created two new pages, and in both cases, the horizontal bar is gone, and the position and size are defined in DialogUnits. ¿? ¿? ¿?

It happened in two different computers (in two different cities). We thought maybe some automatic update had fixed the issues, but software version still is 1.1.1. so we don't understand what happened.

Posts: 1972
Joined: March 25, 2012 - 01:19
Feel free to send me a sample

Feel free to send me a sample if the bug reappears (hope it doesn't... ;) )

Anonymous user
I found it... it was my fault

Hello,

I opened one of our custo pages with the "bug" and it happens they aren't using a "RichEdit20A" control, but an "EDIT" multiline control. I don't know why we are using that control instead of RichEdit20A. Probably a former team mate created it by hand and told nothing about...Obviously, this control isn't supported by your software, and that's why moving or resizing it didn't work well.

...sorry for the inconvenience.

...maybe could be interesting to implement this control?

http://nsis.sourceforge.net/NsDialogs_FAQ#How_to_create_a_multi-line_edit_.28text.29_control

http://nsis.sourceforge.net/NsDialogs_CreateTextMultiline

Really, the control I would like to be implemented is SetImageOLE:

http://nsis.sourceforge.net/NsDialogs_SetImageOLE

;-)

Thanks again for your support!

Posts: 1972
Joined: March 25, 2012 - 01:19
Can be done

> ...maybe could be interesting to implement this control?
It seems the same as setting the Textbox's Multiline property to True? Am I missing something?

> Really, the control I would like to be implemented is SetImageOLE:
By reading the link you provided, I see it only requires to include some lines to the generated script.
It could easily be done with the already available features:

  • this must be added to your main script (or else to the HeaderCustomScript property of the dialog)
    !include 'nsdialogs_setimageole.nsh'
  • add a new variable definition (say $image) to the HeaderCustomScriptdialog property
  • add a bitmap control to dialog
  • this must be added to ControlCustomScript bitmap control property, changing $0 and $1 to the proper variables
    ${NSD_SetImageOLE}$hCtl_Form1_Bitmap1 "http://nsis.sourceforge.net/mediawiki/skins/nsis/logo.gif" $image
  • free the $image resource when not needed anymore
    ${NSD_FreeImageOLE} $image
Anonymous user
Maybe there is a bug after all?

OK, I think I found the bug:

  1. Create a textbox. Generated code uses  ${NSD_CreateText} to create the control. Everything is right.
  2. Set this controls's multiline to true.  The control in now created with nsDialogs::CreateControl EDIT and position and size are calculated in pixels instead of DisplayUnits...and includes horizontal scroll bar...

I was unable to remove the horizontal scroll bar using the method you told me before Christmas. Maybe you could change default style to not include horizontal scroll bar? In our case, we are using this control to show a license text, so we set it as readonly, and manually edit the generated code, and remove these styles: ${WS_HSCROLL} ${ES_AUTOHSCROLL}  ${ES_WANTRETURN}. Maybe you can use different default styles when the control is set readonly? I'm not sure if it's a good approach.

Thanks for the SetImageOLE tip. It seems I'm not exploting the ControlCustomScript potential. :-)

Pages