Old 3rd February 2019, 20:30   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Remove the style added to the textbox

i create a textbox and AddStyle just input number

HTML Code:
!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?
r2du-soft is online now   Reply With Quote
Old 4th February 2019, 11:39   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,013
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th February 2019, 13:54   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Quote:
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 ??
r2du-soft is online now   Reply With Quote
Old 4th February 2019, 14:15   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,013
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).

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th February 2019, 00:00   #5
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Quote:
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!
HTML Code:
!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

HTML Code:
!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
r2du-soft is online now   Reply With Quote
Old 5th February 2019, 16:51   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,013
I said you had to use both ~ and &.

PHP Code:

!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 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump