Hi,
I have a text field. I would like to add red border to the text control. Can we use {SS_BLACKRECT} with some other color though the fault is black. Is there any other method?
${NSD_CreateText} 0 20u 144u 12u $R0
Pop $TxtGD
${NSD_AddStyle} $TxtGD ${SS_BLACKRECT}
How to put red border around textbox in NSIS
3 posts
SS_BLACKRECT is a Static control style.
Windows does not allow you to modify the border colors of standard controls, you would need a custom plug-in.
You can put another control behind it though:
Windows does not allow you to modify the border colors of standard controls, you would need a custom plug-in.
You can put another control behind it though:
!include nsDialogs.nshIf you want to mark invalid input I would maybe use a red exclamation triangle icon instead...
Function MyCustomPageCreate
nsDialogs::Create 1044
Pop $0
${NSD_CreateText} 1u 20u 144u 12u "something"
Pop $1
${NSD_CreateLabel} 0u 19u 146u 14u ""
Pop $2
SetCtlColors $2 ff0000 ff0000
; If the above control is not accurate enough you can set the exact pixel size:
System::Call 'USER32::GetWindowRect(p$1, @r3)' ; NSIS 3+
System::Call '*$3(i.r4, i.r5, i.r6, i.r7)'
IntOp $6 $6 - $4
IntOp $7 $7 - $5
System::Call 'USER32::MapWindowPoints(p0, p$hwndParent, p$3, i 1)i.r9'
System::Call '*$3(i.r4, i.r5)'
!define PXBORDERSIZE 1
!define /math PXBORDERSIZEDOUBLE ${PXBORDERSIZE} * 2
IntOp $4 $4 - ${PXBORDERSIZE}
IntOp $5 $5 - ${PXBORDERSIZE}
IntOp $6 $6 + ${PXBORDERSIZEDOUBLE}
IntOp $7 $7 + ${PXBORDERSIZEDOUBLE}
System::Call 'USER32::SetWindowPos(p$2, p0, i $4, i $5, i $6, i $7, i 0x14)'
nsDialogs::Show
FunctionEnd
Hi,
I tried an alternative solution by having a label at the same position with red color filled. And enabling/disabling the same based on my condition.
Thanks
I tried an alternative solution by having a label at the same position with red color filled. And enabling/disabling the same based on my condition.
Thanks