TextBox Styles (numeric, uppercase and lowercase): Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Updated author and download links, and changed format of some pages.) |
||
Line 64: | Line 64: | ||
</highlight-nsis> | </highlight-nsis> | ||
Page author: dselkirk | Page author: [[User:dselkirk|dselkirk]] |
Revision as of 12:39, 23 April 2005
Description
Requires: System plugin.
Change how your textbox behaves by applying different styles. This works with standard and IO dialogs.
The Script
name "TextBox Styles" outfile "test.exe" Page custom test !define NUMERIC 0x2000 !define LOWERCASE 0x10 !define UPPERCASE 0x8 !macro STYLE HWND STYLE ;retrieve current style System::Call 'user32::GetWindowLongA(i ${HWND},i -16) i .r1' ;append provided style IntOp $1 $1 | ${STYLE} ;apply new style System::Call 'user32::SetWindowLongA(i ${HWND},i -16,i r1) n' !macroend ;EXAMPLE !macro ADDFIELD TYPE LEFT RIGHT TOP BOTTOM TEXT Push $R0 ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Settings" "NumFields" IntOp $R0 $R0 + 1 WriteINIStr "$PLUGINSDIR\test.ini" "Settings" "NumFields" $R0 WriteINIStr "$PLUGINSDIR\test.ini" "Field $R0" "Type" "${TYPE}" WriteINIStr "$PLUGINSDIR\test.ini" "Field $R0" "Left" ${LEFT} WriteINIStr "$PLUGINSDIR\test.ini" "Field $R0" "Right" ${RIGHT} WriteINIStr "$PLUGINSDIR\test.ini" "Field $R0" "Top" ${TOP} WriteINIStr "$PLUGINSDIR\test.ini" "Field $R0" "Bottom" ${BOTTOM} WriteINIStr "$PLUGINSDIR\test.ini" "Field $R0" "Text" "${TEXT}" Pop $R0 !macroend Function test InitPluginsDir !insertmacro ADDFIELD "Label" 0 35 0 12 "Numeric" !insertmacro ADDFIELD "Text" 40 100 0 12 "" !insertmacro ADDFIELD "Label" 0 35 20 32 "Lowercase" !insertmacro ADDFIELD "Text" 40 100 20 32 "" !insertmacro ADDFIELD "Label" 0 35 40 52 "Uppercase" !insertmacro ADDFIELD "Text" 40 100 40 52 "" InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\test.ini" Pop $R0 GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1 !insertmacro STYLE $R1 ${NUMERIC} GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1 !insertmacro STYLE $R1 ${LOWERCASE} GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1 !insertmacro STYLE $R1 ${UPPERCASE} InstallOptions::show Pop $R0 FunctionEnd Section "" SectionEnd
Page author: dselkirk