diff --git a/Contrib/nsDialogs/Readme.html b/Contrib/nsDialogs/Readme.html index a0dafc19..0dabfb81 100644 --- a/Contrib/nsDialogs/Readme.html +++ b/Contrib/nsDialogs/Readme.html @@ -63,6 +63,11 @@ blockquote pre { background-color: #fcfcfc; font-family: monospace; } NSD_Edit_SetReadOnly, NSD_Edit_SetCueBannerText +
nsDialogs::OnNotify control_HWND function_address
Sets a notification callback function for the given control. Whenever the control receives the WM_NOTIFY message, the function will be called and the control's HWND, notification code and a pointer to the MNHDR structure will be waiting on its stack.
+Sets a notification callback function for the given control. Whenever the control receives the WM_NOTIFY message, the function will be called and the control's HWND, notification code and a pointer to the NMHDR structure will be waiting on its stack.
Use GetFunctionAddress to get the address of the desired callback function.
Returns nothing.
@@ -611,6 +616,16 @@ SectionEnd${NSD_Edit_SetCueBannerText} control_HWND displaywhenfocused text
Set a text hint displayed when the control is empty. The text is only visible on WinXP and later. Requires XPStyle on.
+${NSD_RichEd_SetTextLimit} control_HWND limit
Sets the input length limit.
+ +${NSD_RichEd_SetEventMask} control_HWND eventmask
${NSD_RichEd_SetCustomBackgroundColor} control_HWND COLORREF
${NSD_GetState} control_HWND $output_variable
Retrieves the state of a check box or a radio button control. Possible outputs are ${BST_CHECKED} and ${BST_UNCHECKED}.
diff --git a/Contrib/nsDialogs/example.nsi b/Contrib/nsDialogs/example.nsi index 51600745..b2259cbf 100644 --- a/Contrib/nsDialogs/example.nsi +++ b/Contrib/nsDialogs/example.nsi @@ -1,5 +1,6 @@ !include nsDialogs.nsh !include LogicLib.nsh +!include Util.nsh ; IntPtrOp !include WinCore.nsh ; MAKELONG Name "nsDialogs Example" @@ -16,6 +17,7 @@ Page license Page custom nsDialogsPage Page custom LBPage Page custom RangesPage +Page custom NotifyPage !pragma warning disable 8000 ; "Page instfiles not used, no sections will be executed!" Var BUTTON @@ -171,5 +173,38 @@ Function RangesTimer FunctionEnd +Function NotifyPage + !insertmacro BeginControlsTestPage "WM_NOTIFY" + + ${NSD_CreateRichEdit} 1 1 -2 -2 "" + Pop $9 + ${NSD_OnNotify} $9 OnNotify + ${NSD_RichEd_SetEventMask} $9 ${ENM_LINK} + SendMessage $9 ${EM_AUTOURLDETECT} 1 0 + ${NSD_SetText} $9 "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard http://nsis.sf.net\par {\b Click the link}...} " + + nsDialogs::Show +FunctionEnd + +Function OnNotify + Pop $1 ; HWND + Pop $2 ; Code + Pop $3 ; NMHDR* + ${IfThen} $2 <> ${EN_LINK} ${|} Return ${|} + System::Call '*$3(p,p,p,p.r2,p,p,i.r4,i.r5)' ; Extract from ENLINK* + ${IfThen} $2 <> ${WM_LBUTTONDOWN} ${|} Return ${|} + IntOp $2 $5 - $4 + System::Call '*(ir4,ir5,l,&t$2,i)p.r2' ; Create TEXTRANGE and a text buffer + ${If} $2 P<> 0 + ${IntPtrOp} $3 $2 + 16 ; Find buffer + System::Call '*$2(i,i,p$3)' ; Set buffer in TEXTRANGE + SendMessage $1 ${EM_GETTEXTRANGE} "" $2 $4 + ${If} $4 <> 0 + System::Call 'SHELL32::ShellExecute(p$hWndParent, p0, pr3, p0, p0, i 1)' + ${EndIf} + System::Free $2 + ${EndIf} +FunctionEnd + Section SectionEnd diff --git a/Contrib/nsDialogs/nsDialogs.nsh b/Contrib/nsDialogs/nsDialogs.nsh index 11c7cca8..0d8e679e 100644 --- a/Contrib/nsDialogs/nsDialogs.nsh +++ b/Contrib/nsDialogs/nsDialogs.nsh @@ -533,6 +533,9 @@ IntOp ${RET} ${RET} & ${BIT} ### RichEdit ### +!define NSD_RichEd_SetTextLimit `${__NSD_MkCtlCmd_LP} EM_EXLIMITTEXT 0 ` +!define NSD_RichEd_GetEventMask `${__NSD_MkCtlCmd_RV} EM_GETEVENTMASK 0 0 ` +!define NSD_RichEd_SetEventMask `${__NSD_MkCtlCmd_LP} EM_SETEVENTMASK 0 ` ; LP:ENM_* !define NSD_RichEd_SetSystemBackgroundColor `${__NSD_MkCtlCmd} EM_SETBKGNDCOLOR 1 0 ` ; COLOR_WINDOW !define NSD_RichEd_SetCustomBackgroundColor `${__NSD_MkCtlCmd_LP} EM_SETBKGNDCOLOR 0 ` ; LP:COLORREF !define NSD_RichEd_SetHideSelection `${__NSD_MkCtlCmd_WP} EM_HIDESELECTION 0 ` ; WP(BOOL):HideSelWithoutFocus (Toggles ES_NOHIDESEL & TXTBIT_HIDESELECTION) diff --git a/Include/WinMessages.nsh b/Include/WinMessages.nsh index b0069990..8ee5d41e 100644 --- a/Include/WinMessages.nsh +++ b/Include/WinMessages.nsh @@ -226,16 +226,34 @@ TVM Tree-view control !define /math EM_EXGETSEL ${WM_USER} + 52 !define /math EM_EXLIMITTEXT ${WM_USER} + 53 !define /math EM_EXLINEFROMCHAR ${WM_USER} + 54 +!define /math EM_GETEVENTMASK ${WM_USER} + 59 !define /math EM_GETOLEINTERFACE ${WM_USER} + 60 !define /math EM_HIDESELECTION ${WM_USER} + 63 !define /math EM_SETBKGNDCOLOR ${WM_USER} + 67 +!define /math EM_SETEVENTMASK ${WM_USER} + 69 !define /math EM_STREAMIN ${WM_USER} + 73 !define /math EM_STREAMOUT ${WM_USER} + 74 +!define /math EM_GETTEXTRANGE ${WM_USER} + 75 !define /math EM_SETOPTIONS ${WM_USER} + 77 !define /math EM_GETOPTIONS ${WM_USER} + 78 !define /math EM_SETUNDOLIMIT ${WM_USER} + 82 ; v2+ !define /math EM_AUTOURLDETECT ${WM_USER} + 91 -!define /math EM_SETFONTSIZE ${WM_USER} + 223 ; v3+ +!define /math EM_SETEDITSTYLE ${WM_USER} + 204 ; v3+ +!define /math EM_SETFONTSIZE ${WM_USER} + 223 + +!define EN_MSGFILTER 0x0700 +!define EN_SELCHANGE 0x0702 +!define EN_LINK 0x070b + +!define ENM_NONE 0x00000000 +!define ENM_CHANGE 0x00000001 +!define ENM_UPDATE 0x00000002 +!define ENM_SCROLL 0x00000004 +!define ENM_SCROLLEVENTS 0x00000008 +!define ENM_KEYEVENTS 0x00010000 +!define ENM_MOUSEEVENTS 0x00020000 +!define ENM_SELCHANGE 0x00080000 +!define ENM_LINK 0x04000000 ; v2+ #Listbox Messages# !define LB_ADDFILE 0x0196