Skip to content
⌘ NSIS Forum Archive

Using ES_READONLY with NSD_AddStyle

2 posts

jpderuiter#

Using ES_READONLY with NSD_AddStyle

Hi,

I would like to create a read-only textbox.
To do so I tried the following code
${NSD_CreateText} <Coordinates> "Default"
Pop $EditBox
${NSD_AddStyle} $EditBox ${ES_READONLY}
But this doesn't work.
Although most of the ES_ styles can't be added after creating the control, the ES_READONLY style can.
(Adding the ES_READONLY style in the create macro does work)
Any idea why the ES_READONLY style does not work with NSD_AddStyle?

Regards,
Jan Pieter
jpderuiter#
Oops, I was a little to quick.

As stated on:
http://msdn.microsoft.com/en-us/library/bb775464(VS.85).aspx
the Readonly style can only be set by a SendMessage EM_SETREADONLY after creation.

So I have to use the following:
${NSD_CreateText} <Coordinates> "Default"
Pop $EditBox
SendMessage $EditBox ${EM_SETREADONLY} 1 0
Thanks anyway.
Jan Pieter