Skip to content
⌘ NSIS Forum Archive

Remove the style added to the textbox

6 posts

r2du-soft#

Remove the style added to the textbox

i create a textbox and AddStyle just input number

!include "nsDialogs.nsh"

Page Custom pre

Var Dialog
Var TXTB_1

Function pre
	nsDialogs::Create 1018
		Pop $Dialog

	${NSD_CreateText} 0 10% 50% 8% "" ;"This is a password field"
	    Pop $TXTB_1
		${NSD_AddStyle} $TXTB_1 0x2000 ;${NUMERIC} = 0x2000 #Just Input Numbers

	nsDialogs::Show
FunctionEnd
 
Section ""
SectionEnd

now i want remove that AddStyle in Part of the program...
i searched by not found ${NSD_RemoveStyle}
How can Do it? i want restart the textbox Style and input all characters?
Anders#
Call nsDialogs::CreateControl directly for new controls. To remove a style you would have to create a new macro, look at the AddEx macro and change the IntOp.
r2du-soft#
Originally Posted by Anders View Post
Call nsDialogs::CreateControl directly for new controls. To remove a style you would have to create a new macro, look at the AddEx macro and change the IntOp.
i change the nsDialogs.nsh and create a new macro with name RemoveStyle
but when the run,that now remove the textbox style added.
To do this work must i upgrade the nsDialogs.dll ??
Anders#
It helps if you show us your macro. First it has to do ~ on the style you want to remove, then & with the existing style (read about basic bit operations if you want to understand why).
r2du-soft#
Originally Posted by Anders View Post
It helps if you show us your macro. First it has to do ~ on the style you want to remove, then & with the existing style (read about basic bit operations if you want to understand why).
i tryed,but there are mistakes
I think I did not get it right!
!define NSD_RemoveStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_STYLE} "
!macro _NSD_GWLRemoveFlags GWL HWND DATA
	System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
	System::Int64Op "${DATA}" ~
	System::Call "user32::SetWindowLong(p${HWND},p${GWL},ps)"
!macroend

!include "nsDialogs.nsh"

Page Custom pre

Var Dialog
Var TXTB_1

Function pre
	nsDialogs::Create 1018
		Pop $Dialog



	${NSD_CreateText} 0 10% 50% 8% "" ;"This is a password field"
	    Pop $TXTB_1
		${NSD_AddStyle} $TXTB_1 0x2000 ;${NUMERIC} = 0x2000 #Just Input Numbers


${NSD_RemoveStyle} $TXTB_1 0x2000 ;Remove ${NUMERIC} = 0x2000 Style



	nsDialogs::Show
FunctionEnd
 
Section ""
SectionEnd
Anders#
I said you had to use both ~ and &.

!include nsDialogs.nsh
!define /IfNDef NSD_RemoveStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_STYLE} "
!define /IfNDef NSD_RemoveExStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_EXSTYLE} "
!ifmacrondef _NSD_GWLRemoveFlags
!macro _NSD_GWLRemoveFlags GWL HWND DATA
System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
System::Int64Op "${DATA}" ~ & ; Perform ~ and set up the stack for &
System::Int64Op ; Perform &
System::Call "user32::SetWindowLong(p${HWND},i${GWL},ps)"
!macroend
!endif