Announcement

Collapse
No announcement yet.

How to create user defined directory page?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create user defined directory page?

    !insertmacro MUI_PAGE_DIRECTORY

    In the code can be used to display the built-in directory page.

    Is possible to create user defined page directory? because i need to call many times this page.

    How to create user defined page directory?

  • #2
    You can probably just use multiple built-in directory pages. Simply insert the macro multiple times. You can customize each page using these defines:
    MUI_DIRECTORYPAGE_TEXT_TOP text
    MUI_DIRECTORYPAGE_TEXT_DESTINATION
    MUI_DIRECTORYPAGE_VARIABLE

    See the MUI2 readme: http://nsis.sourceforge.net/Docs/Mod...02/Readme.html

    Comment


    • #3
      Thanks MSG.
      I have tried following way to create directory page manually.

      !define MUI_PAGE_CUSTOMFUNCTION_PRE MyDir
      !define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectory
      !insertmacro MUI_PAGE_DIRECTORY


      Function MyDir
      ${DriveSpace} "C:\" "/D=F /S=G" $R0
      ${If} $R0 <= 2
      MessageBox MB_OK "Going to display"
      call ShowDirectoryPage
      ${EndIf}
      Function ShowDirectory
      FindWindow $0 "#32770" "" $HWNDPARENT
      GetDlgItem $1 $0 1020 ; IDC_SELDIRTEXT
      StrCpy $2 "$(SelDirText)"
      SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
      GetDlgItem $1 $0 1006
      StrCpy $2 "$(IntroText)"
      SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
      GetDlgItem $1 $HWNDPARENT 1037
      StrCpy $2 "$(DirText)"
      SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
      GetDlgItem $1 $HWNDPARENT 1038
      StrCpy $2 "$(DirSubText)"
      SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
      GetDlgItem $1 $0 1023 ; IDC_SPACEREQUIRED
      System::Call 'user32.dll::ShowWindow(i, i) v($1, 0)'
      GetDlgItem $1 $0 1024 ; IDC_SPACEAVAILABLE
      System::Call 'user32.dll::ShowWindow(i, i) v($1, 0)'
      FunctionEnd


      but in the ShowDirectory function didnot display directory page.Also i got warning messages for this function.

      Comment


      • #4
        You're missing a FunctionEnd after MyDir

        Comment


        • #5
          oh sorry.Its my mistake i didnot copy the code properly.

          define MUI_PAGE_CUSTOMFUNCTION_PRE MyDir
          !define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectory
          !insertmacro MUI_PAGE_DIRECTORY


          Function MyDir
          ${DriveSpace} "C:\" "/D=F /S=G" $R0
          ${If} $R0 <= 2
          MessageBox MB_OK "Going to display"
          call ShowDirectoryPage
          ${EndIf}
          FunctionEnd

          Function ShowDirectory
          FindWindow $0 "#32770" "" $HWNDPARENT
          GetDlgItem $1 $0 1020 ; IDC_SELDIRTEXT
          StrCpy $2 "$(SelDirText)"
          SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
          GetDlgItem $1 $0 1006
          StrCpy $2 "$(IntroText)"
          SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
          GetDlgItem $1 $HWNDPARENT 1037
          StrCpy $2 "$(DirText)"
          SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
          GetDlgItem $1 $HWNDPARENT 1038
          StrCpy $2 "$(DirSubText)"
          SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
          GetDlgItem $1 $0 1023 ; IDC_SPACEREQUIRED
          System::Call 'user32.dll::ShowWindow(i, i) v($1, 0)'
          GetDlgItem $1 $0 1024 ; IDC_SPACEAVAILABLE
          System::Call 'user32.dll::ShowWindow(i, i) v($1, 0)'
          FunctionEnd


          Following warnings displayed

          LangString "SelDirText" is not set in language table of language English
          LangString "IntroText" is not set in language table of language English
          LangString "DirText" is not set in language table of language English
          LangString "DirSubText" is not set in language table of language English
          Last edited by ilaiyaraja; 29 August 2013, 09:49.

          Comment


          • #6
            You need to !insertmacro MUI_LANGUAGE "English" after all (un)page macros are inserted.

            Comment


            • #7
              I have already included this macro after all page macros are inserted.
              !insertmacro MUI_LANGUAGE English

              Is there need to insert before this page ShowDirectory load?

              Comment


              • #8
                Maybe it is easier to create custom directory page (few labels, edit box and button with nsDialogs::SelectFolder function) with nsDialogs?

                It can be shown many times with appropriate parameters without using a lot of code.
                Cool looking installers with custom design: www.graphical-installer.com
                Create Setup Pages easily: www.install-designer.com
                Build installers in Visual Studio 2005-2022: www.visual-installer.com
                or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com

                Comment

                Working...
                X
                😀
                🥰
                🤢
                😎
                😡
                👍
                👎