Sorting Components: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (free memory) |
No edit summary |
||
Line 1: | Line 1: | ||
{{PageAuthor|KiCHiK}} | |||
The following script shows how to sort components in the components page under a certain group. It was written for [http://forums.winamp.com/showthread.php?s=&threadid=227483 theAdib in the forums]. His intention was to keep sections sorted for all available languages.<highlight-nsis>!define TVGN_ROOT 0 | The following script shows how to sort components in the components page under a certain group. It was written for [http://forums.winamp.com/showthread.php?s=&threadid=227483 theAdib in the forums]. His intention was to keep sections sorted for all available languages.<highlight-nsis>!define TVGN_ROOT 0 | ||
!define TVGN_NEXT 1 | !define TVGN_NEXT 1 |
Revision as of 14:03, 3 October 2005
Author: KiCHiK (talk, contrib) |
The following script shows how to sort components in the components page under a certain group. It was written for theAdib in the forums. His intention was to keep sections sorted for all available languages.
!define TVGN_ROOT 0 !define TVGN_NEXT 1 !define TVGN_NEXTVISIBLE 6 !define TVIF_TEXT 1 !define TVM_GETNEXTITEM 4362 !define TVM_GETITEM 4364 !define TVM_SORTCHILDREN 4371 !define TVITEM '(i, i, i, i, i, i, i, i, i, i)' Page components "" compShow Page instfiles XPStyle on Name "test" OutFile "test.exe" Section ztest SectionEnd SectionGroup /e test Section c SectionEnd Section b SectionEnd Section a SectionEnd SectionGroupEnd Function compShow FindWindow $0 "#32770" "" $HWNDPARENT GetDlgItem $0 $0 1032 SendMessage $0 ${TVM_GETNEXTITEM} ${TVGN_ROOT} 0 $1 System::Alloc ${NSIS_MAX_STRLEN} Pop $2 System::Call '*${TVITEM}(${TVIF_TEXT}, r1,,, r2, ${NSIS_MAX_STRLEN},,,,) i .r3' loop: SendMessage $0 ${TVM_GETITEM} 0 $3 System::Call '*$2(&t${NSIS_MAX_STRLEN} .r4)' StrCmp $4 "test" 0 +2 ### CHANGE ME Goto found SendMessage $0 ${TVM_GETNEXTITEM} ${TVGN_NEXTVISIBLE} $1 $1 StrCmp $1 loop done found: SendMessage $0 ${TVM_SORTCHILDREN} 0 $1 # recursive - SendMessage $0 ${TVM_SORTCHILDREN} 1 $1 done: System::Free $2 System::Free $3 FunctionEnd