2017-11-21 1 views
0

Ich versuche, Windows Installer mit Radiobuttons Seite zu erstellen, wo die Schaltflächen Laufzeit von gefundenen Dateien Pfad erstellt werden. Aber nur der erste Dateipfad wird nur zum Erstellen von Radiobuttons verwendet. Wenn ich MessageBox-Zeile auskommentiere, wird der Pfad aller Dateien angezeigt. Könnte mir bitte jemand helfen?NSIS Runtime nicht erstellt Schaltflächen

Dank

Function getButtons 
    nsDialogs::Create 1018 
    Pop $dialog 
    ${NSD_CreateGroupBox} 0 0 100% 100% "These DLLs were found installed" 
    # get available plugins 
    ${locate::Open} "$dllDir" `/F=1 /D=0 /M=*.dll /B=1` $0 
    StrCmp $0 0 0 loop 
    MessageBox MB_OK "Error! No DLL files found..., $dllDir" IDOK close 

    loop: 
    # counter for y value 
    StrCpy $R1 10 
    # find possible plugins for installation 
    ${Do} 
    ${locate::Find} $0 $1 $2 $3 $4 $5 $6 
    ${If} $1 == "" 
     ${ExitDo} 
    ${EndIf} 
    ;MessageBox MB_OK "Path=$1" IDOK 
    # calculate radiobutton y value 
    IntOp $R1 $R1 + 20 
    ${NSD_CreateRadioButton} 20 $R1 100% 50% "$1" 
    Pop $hwnd 
    nsDialogs::SetUserData $hwnd "$1" 
    ${NSD_OnClick} $hwnd RadioClick 
    ${Loop} 
    close: 
    ${locate::Close} $0 
    ${locate::Unload} 
    nsDialogs::Show 
FunctionEnd 

Antwort

0

Die Kontrollen sind alle da, sie sind einfach nicht sichtbar, weil Sie die Höhe auf 50% und die Funksteuerungen sind nicht transparent festgelegt haben.

Sie könnten sie transparent machen:

${NSD_CreateRadioButton} 20 $R1 100% 50% "$1" 
Pop $hwnd 
SetCtlColors $hwnd SYSCLR:8 Transparent ; NSIS 3.1+ 
${NSD_AddExStyle} $hwnd ${WS_EX_TRANSPARENT} ; https://blogs.msdn.microsoft.com/oldnewthing/20121217-00/?p=5823 

aber die Dokumentation NSIS warnt dagegen:

Warnung: Einstellung der Hintergrundfarbe von Kontrollkästchen, um transparent funktionieren nicht richtig, bei der Verwendung von XPStyle on. Der Hintergrund kann bei Verwendung bestimmter Windows-Designs vollständig schwarz statt transparent sein.

Es ist besser, Ihre Kontrollen richtig in erster Linie nur Größe:

!include nsDialogs.nsh 

Page Custom getButtons 
Page InstFiles 

var hwnd 

Function getButtons 
nsDialogs::Create 1018 
Pop $0 

${NSD_CreateGroupBox} 0 0 100% 100% "These DLLs were found installed" 
Pop $0 

StrCpy $R1 0 ; Measured in dialog units, not pixels 
FindFirst $0 $1 "$sysdir\sh*.dll" 
loop: 
    StrCmp $1 "" end 
    IntOp $R1 $R1 + 12 
    ${NSD_CreateRadioButton} 5u $R1u -20 12u "$1" 
    Pop $hwnd 
    nsDialogs::SetUserData $hwnd "$1" 
    ${NSD_OnClick} $hwnd RadioClick 
    FindNext $0 $1 
    Goto loop 
end: 
FindClose $0 

nsDialogs::Show 
FunctionEnd 

Wenn Sie nicht wissen, wie viele Dateien gibt es dann ist es besser, ein Listenfeld zu verwenden, so dass Sie don‘ Im Dialogfeld ist kein Speicherplatz mehr verfügbar.

+0

Danke, es funktioniert jetzt gut! –