Menu

#170 More nsDialogs macros

closed-accepted
Plugin (47)
5
2008-03-29
2008-02-23
Anonymous
No

Since some new macros have been added to nsDialogs recently, might I suggest a few more that would help in tidying up scripts a bit:

!define GWL_STYLE -16
!macro _NSD_AddStyle CONTROL STYLE
System::Call "user32::GetWindowLong(i ${CONTROL}, i ${GWL_STYLE}) i .R0"
System::Call "user32::SetWindowLong(i ${CONTROL}, i ${GWL_STYLE}, i $R0|${STYLE})"
!macroend
!define NSD_AddStyle "!insertmacro _NSD_AddStyle"

!define GWL_EXSTYLE -20
!macro _NSD_AddExStyle CONTROL EXSTYLE
System::Call "user32::GetWindowLong(i ${CONTROL}, i ${GWL_EXSTYLE}) i .R0"
System::Call "user32::SetWindowLong(i ${CONTROL}, i ${GWL_EXSTYLE}, i $R0|${EXSTYLE})"
!macroend
!define NSD_AddExStyle "!insertmacro _NSD_AddExStyle"

!macro _NSD_AddString CONTROL STRING
SendMessage ${CONTROL} ${CB_ADDSTRING} 0 "STR:${STRING}"
!macroend
!define NSD_AddString "!insertmacro _NSD_AddString"

!macro _NSD_SelectString CONTROL STRING
SendMessage ${CONTROL} ${CB_SELECTSTRING} 0 "STR:${STRING}"
!macroend
!define NSD_SelectString "!insertmacro _NSD_SelectString"

!macro _NSD_SetTextLimit CONTROL LIMIT
SendMessage ${CONTROL} ${EM_SETLIMITTEXT} ${LIMIT} 0
!macroend
!define NSD_SetTextLimit "!insertmacro _NSD_SetTextLimit"

Regards,
Brad
bradharding@digitalcola.com

Discussion

  • Amir Szekely

    Amir Szekely - 2008-02-24
    • labels: 492405 -->
    • milestone: 105206 -->
     
  • Amir Szekely

    Amir Szekely - 2008-03-29

    Logged In: YES
    user_id=584402
    Originator: NO

    Thanks, added.

    For faster inclusion in the future, you should also patch the documentation, make sure the macros keep register values (addstyle overrides $R0) and also make sure the names are clear enough. AddString only works for combo boxes, but there's the same action for list boxes. I've renamed it to CB_AddString.

     
  • Amir Szekely

    Amir Szekely - 2008-03-29
    • labels: --> Plugin
    • assigned_to: nobody --> kichik
    • status: open --> closed-accepted
     

Log in to post a comment.