Sorting Components: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
(I placed it in Tutorials, reason I was looking for this but couldnt find in the tutorial list) |
||
Line 67: | Line 67: | ||
FunctionEnd</highlight-nsis> | FunctionEnd</highlight-nsis> | ||
[[Category:Tutorials]] | |||
[[Category:Code Examples]] | [[Category:Code Examples]] | ||
[[Category:System Plugin Examples]] | [[Category:System Plugin Examples]] |
Revision as of 12:08, 29 October 2009
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