Header file for Listview: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
Line 6: Line 6:


<attach>ListView.zip</attach>
<attach>ListView.zip</attach>
== Example 1 ==
<highlight-nsis>
/* Listview styles are defined in header file */
!include "MUI2.nsh"
!include "ListView.nsh"
Name "List View Example"
OutFile ListView.exe
Page custom CreatePage
!insertmacro MUI_LANGUAGE "English"
Function CreatePage
    !insertmacro MUI_HEADER_TEXT "List view" "A listview control created by nsDialogs"
    nsDialogs::Create 1018
    Pop $0
    ${If} $0 == error
        Abort
    ${EndIf}
    ${NSD_CreateListView} 0u 0u 300u 140u "Listview"
    Pop $1
    ${NSD_LV_InsertColumn} $1 0 200 "column 0"
    ${NSD_LV_InsertColumn} $1 1 100 "column 1"
    ${NSD_LV_InsertColumn} $1 2 100 "column 2"
    ${NSD_LV_InsertItem} $1 0 'Item 0'
    ${NSD_LV_SetSubItem} $1 0 1 'Subitem 0_1'
    ${NSD_LV_SetSubItem} $1 0 2 'Subitem 0_2'
    ${NSD_LV_InsertItem} $1 1 'Item 1'
    ${NSD_LV_SetSubItem} $1 1 2 'Subitem 1_2'
    ${NSD_LV_InsertItem} $1 2 'Item 2'
    ${NSD_LV_SetSubItem} $1 2 1 'Subitem 2_1'
    nsDialogs::Show
FunctionEnd
Section -Main
SectionEnd
</highlight-nsis>
<attach>asdffff.zip</attach>

Revision as of 05:10, 2 July 2010

Header file for creating Listview control

In an NSIS forum dreams8, a member named "gfm688" write a header file to create and handle a listview control with the report view. This header file midified one by me, and I add some new macro commands.

See the attachment for details, 8 examples included.

ListView.zip (328 KB)

Example 1

/* Listview styles are defined in header file */
!include "MUI2.nsh"
!include "ListView.nsh"
 
Name "List View Example"
OutFile ListView.exe
 
Page custom CreatePage
!insertmacro MUI_LANGUAGE "English"
 
Function CreatePage
 
    !insertmacro MUI_HEADER_TEXT "List view" "A listview control created by nsDialogs"
 
    nsDialogs::Create 1018
    Pop $0
    ${If} $0 == error
        Abort
    ${EndIf}
 
    ${NSD_CreateListView} 0u 0u 300u 140u "Listview"
    Pop $1
    ${NSD_LV_InsertColumn} $1 0 200 "column 0"
    ${NSD_LV_InsertColumn} $1 1 100 "column 1"
    ${NSD_LV_InsertColumn} $1 2 100 "column 2"
    ${NSD_LV_InsertItem} $1 0 'Item 0'
    ${NSD_LV_SetSubItem} $1 0 1 'Subitem 0_1'
    ${NSD_LV_SetSubItem} $1 0 2 'Subitem 0_2'
    ${NSD_LV_InsertItem} $1 1 'Item 1'
    ${NSD_LV_SetSubItem} $1 1 2 'Subitem 1_2'
    ${NSD_LV_InsertItem} $1 2 'Item 2'
    ${NSD_LV_SetSubItem} $1 2 1 'Subitem 2_1'
 
    nsDialogs::Show

FunctionEnd
 
Section -Main
 
SectionEnd

asdffff.zip not found