ArrayDisplayInternals_En.au3 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. #include-once
  2. #include "AutoItConstants.au3"
  3. #include "MsgBoxConstants.au3"
  4. #include "StringConstants.au3"
  5. ; #INDEX# =======================================================================================================================
  6. ; Title .........: Internal UDF Library for AutoIt3 _ArrayDisplay() and _DebugArray()
  7. ; AutoIt Version : 3.3.14.5
  8. ; Description ...: Internal functions for the Array.au3 and Debug.au3
  9. ; Author(s) .....: Melba23, jpm
  10. ; ===============================================================================================================================
  11. #Region Global Variables and Constants
  12. ; #VARIABLES# ===================================================================================================================
  13. ; for use with the sort call back functions
  14. Global Const $_ARRAYCONSTANT_SORTINFOSIZE = 11
  15. Global $__g_aArrayDisplay_SortInfo[$_ARRAYCONSTANT_SORTINFOSIZE]
  16. ; ===============================================================================================================================
  17. ; #CONSTANTS# ===================================================================================================================
  18. Global Const $ARRAYDISPLAY_COLALIGNLEFT = 0 ; (default) Column text alignment - left
  19. Global Const $ARRAYDISPLAY_TRANSPOSE = 1 ; Transposes the array (2D only)
  20. Global Const $ARRAYDISPLAY_COLALIGNRIGHT = 2 ; Column text alignment - right
  21. Global Const $ARRAYDISPLAY_COLALIGNCENTER = 4 ; Column text alignment - center
  22. Global Const $ARRAYDISPLAY_VERBOSE = 8 ; Verbose - display MsgBox on error and splash screens during processing of large arrays
  23. Global Const $ARRAYDISPLAY_NOROW = 64 ; No 'Row' column displayed
  24. Global Const $_ARRAYCONSTANT_tagHDITEM = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State"
  25. Global Const $_ARRAYCONSTANT_tagLVITEM = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & _
  26. "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct"
  27. ; ===============================================================================================================================
  28. #EndRegion Global Variables and Constants
  29. #Region Functions list
  30. ; #CURRENT# =====================================================================================================================
  31. ; ===============================================================================================================================
  32. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  33. ; __ArrayDisplay_Share
  34. ; __ArrayDisplay_RegisterSortCallBack
  35. ; __ArrayDisplay_SortCallBack
  36. ; __ArrayDisplay_SortItems
  37. ; __ArrayDisplay_AddItem
  38. ; __ArrayDisplay_AddSubItem
  39. ; __ArrayDisplay_GetColumnCount
  40. ; __ArrayDisplay_GetHeader
  41. ; __ArrayDisplay_GetItem
  42. ; __ArrayDisplay_GetItemCount
  43. ; __ArrayDisplay_GetItemFormat
  44. ; __ArrayDisplay_GetItemText
  45. ; __ArrayDisplay_GetItemTextString
  46. ; __ArrayDisplay_SetItemFormat
  47. ; ===============================================================================================================================
  48. #EndRegion Functions list
  49. Func __ArrayDisplay_Share(Const ByRef $aArray, $sTitle = Default, $sArrayRange = Default, $iFlags = Default, $vUser_Separator = Default, $sHeader = Default, $iMax_ColWidth = Default, $hUser_Function = Default, $bDebug = True)
  50. Local $vTmp, $sMsgBoxTitle = (($bDebug) ? ("DebugArray") : ("ArrayDisplay"))
  51. ; Default values
  52. If $sTitle = Default Then $sTitle = $sMsgBoxTitle
  53. If $sArrayRange = Default Then $sArrayRange = ""
  54. If $iFlags = Default Then $iFlags = 0
  55. If $vUser_Separator = Default Then $vUser_Separator = ""
  56. If $sHeader = Default Then $sHeader = ""
  57. If $iMax_ColWidth = Default Then $iMax_ColWidth = 350
  58. If $hUser_Function = Default Then $hUser_Function = 0
  59. ; Check for transpose, column align, verbosity and "Row" column visibility
  60. Local $iTranspose = BitAND($iFlags, $ARRAYDISPLAY_TRANSPOSE)
  61. Local $iColAlign = BitAND($iFlags, 6) ; 0 = Left (default); 2 = Right; 4 = Center
  62. Local $iVerbose = BitAND($iFlags, $ARRAYDISPLAY_VERBOSE)
  63. Local $iNoRow = BitAND($iFlags, $ARRAYDISPLAY_NOROW)
  64. ; Set lower button border
  65. Local $iButtonBorder = (($bDebug) ? (40) : (20))
  66. ; Check valid array
  67. Local $sMsg = "", $iRet = 1
  68. If IsArray($aArray) Then
  69. ; Dimension checking
  70. Local $iDimension = UBound($aArray, $UBOUND_DIMENSIONS), $iRowCount = UBound($aArray, $UBOUND_ROWS), $iColCount = UBound($aArray, $UBOUND_COLUMNS)
  71. If $iDimension > 2 Then
  72. $sMsg = "Larger than 2D array passed to function"
  73. $iRet = 2
  74. EndIf
  75. If $iDimension = 1 Then
  76. $iTranspose = 0
  77. EndIf
  78. Else
  79. $sMsg = "No array variable passed to function"
  80. EndIf
  81. If $sMsg Then
  82. If $iVerbose And MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR + $MB_YESNO, _
  83. $sMsgBoxTitle & " Error: " & $sTitle, $sMsg & @CRLF & @CRLF & "Exit the script?") = $IDYES Then
  84. Exit
  85. Else
  86. Return SetError($iRet, 0, 0)
  87. EndIf
  88. EndIf
  89. ; Determine copy separator
  90. Local $iCW_ColWidth = Number($vUser_Separator)
  91. ; Get current separator character
  92. Local $sCurr_Separator = Opt("GUIDataSeparatorChar")
  93. ; Set default user separator if required
  94. If $vUser_Separator = "" Then $vUser_Separator = $sCurr_Separator
  95. ; Declare variables
  96. Local $iItem_Start = 0, $iItem_End = $iRowCount - 1, $iSubItem_Start = 0, $iSubItem_End = (($iDimension = 2) ? ($iColCount - 1) : (0))
  97. ; Flag to determine if range set
  98. Local $bRange_Flag = False, $avRangeSplit
  99. ; Check for range settings
  100. If $sArrayRange Then
  101. ; Split into separate dimension sections
  102. Local $aArray_Range = StringRegExp($sArrayRange & "||", "(?U)(.*)\|", 3)
  103. ; Dimension 1
  104. If $aArray_Range[0] Then
  105. $avRangeSplit = StringSplit($aArray_Range[0], ":")
  106. If @error Then
  107. $iItem_End = Number($avRangeSplit[1])
  108. Else
  109. $iItem_Start = Number($avRangeSplit[1])
  110. If $avRangeSplit[2] <> "" Then
  111. $iItem_End = Number($avRangeSplit[2])
  112. EndIf
  113. EndIf
  114. EndIf
  115. ; Check row bounds
  116. If $iItem_Start < 0 Then $iItem_Start = 0
  117. If $iItem_End > $iRowCount - 1 Then $iItem_End = $iRowCount - 1
  118. If $iItem_Start > $iItem_End Then
  119. $vTmp = $iItem_Start
  120. $iItem_Start = $iItem_End
  121. $iItem_End = $vTmp
  122. EndIf
  123. ; Check if range set
  124. If $iItem_Start <> 0 Or $iItem_End <> $iRowCount - 1 Then $bRange_Flag = True
  125. ; Dimension 2
  126. If $iDimension = 2 And $aArray_Range[1] Then
  127. $avRangeSplit = StringSplit($aArray_Range[1], ":")
  128. If @error Then
  129. $iSubItem_End = Number($avRangeSplit[1])
  130. Else
  131. $iSubItem_Start = Number($avRangeSplit[1])
  132. If $avRangeSplit[2] <> "" Then
  133. $iSubItem_End = Number($avRangeSplit[2])
  134. EndIf
  135. EndIf
  136. ; Check column bounds
  137. If $iSubItem_Start > $iSubItem_End Then
  138. $vTmp = $iSubItem_Start
  139. $iSubItem_Start = $iSubItem_End
  140. $iSubItem_End = $vTmp
  141. EndIf
  142. If $iSubItem_Start < 0 Then $iSubItem_Start = 0
  143. If $iSubItem_End > $iColCount - 1 Then $iSubItem_End = $iColCount - 1
  144. ; Check if range set
  145. If $iSubItem_Start <> 0 Or $iSubItem_End <> $iColCount - 1 Then $bRange_Flag = True
  146. EndIf
  147. EndIf
  148. ; Create data display
  149. Local $sDisplayData = "[" & $iRowCount & "]"
  150. If $iDimension = 2 Then
  151. $sDisplayData &= " [" & $iColCount & "]"
  152. EndIf
  153. ; Create tooltip data
  154. Local $sTipData = ""
  155. If $bRange_Flag Then
  156. If $sTipData Then $sTipData &= " - "
  157. $sTipData &= "Range set"
  158. EndIf
  159. If $iTranspose Then
  160. If $sTipData Then $sTipData &= " - "
  161. $sTipData &= "Transposed"
  162. EndIf
  163. ; Split custom header on separator
  164. Local $asHeader = StringSplit($sHeader, $sCurr_Separator, $STR_NOCOUNT) ; No count element
  165. If UBound($asHeader) = 0 Then Local $asHeader[1] = [""]
  166. $sHeader = "Row"
  167. Local $iIndex = $iSubItem_Start
  168. If $iTranspose Then
  169. ; All default headers
  170. $sHeader = "Col"
  171. For $j = $iItem_Start To $iItem_End
  172. $sHeader &= $sCurr_Separator & "Row " & $j
  173. Next
  174. Else
  175. ; Create custom header with available items
  176. If $asHeader[0] Then
  177. ; Set as many as available
  178. For $iIndex = $iSubItem_Start To $iSubItem_End
  179. ; Check custom header available
  180. If $iIndex >= UBound($asHeader) Then ExitLoop
  181. $sHeader &= $sCurr_Separator & $asHeader[$iIndex]
  182. Next
  183. EndIf
  184. ; Add default headers to fill to end
  185. For $j = $iIndex To $iSubItem_End
  186. $sHeader &= $sCurr_Separator & "Col " & $j
  187. Next
  188. EndIf
  189. ; Remove "Row" header if not needed
  190. If $iNoRow Then $sHeader = StringTrimLeft($sHeader, 4)
  191. ; Display splash dialog if required
  192. If $iVerbose And ($iItem_End - $iItem_Start + 1) * ($iSubItem_End - $iSubItem_Start + 1) > 10000 Then
  193. SplashTextOn($sMsgBoxTitle, "Preparing display" & @CRLF & @CRLF & "Please be patient", 300, 100)
  194. EndIf
  195. ; GUI Constants
  196. Local Const $_ARRAYCONSTANT_GUI_DOCKBOTTOM = 64
  197. Local Const $_ARRAYCONSTANT_GUI_DOCKBORDERS = 102
  198. Local Const $_ARRAYCONSTANT_GUI_DOCKHEIGHT = 512
  199. Local Const $_ARRAYCONSTANT_GUI_DOCKLEFT = 2
  200. Local Const $_ARRAYCONSTANT_GUI_DOCKRIGHT = 4
  201. Local Const $_ARRAYCONSTANT_GUI_DOCKHCENTER = 8
  202. Local Const $_ARRAYCONSTANT_GUI_EVENT_CLOSE = -3
  203. Local Const $_ARRAYCONSTANT_GUI_FOCUS = 256
  204. Local Const $_ARRAYCONSTANT_SS_CENTER = 0x1
  205. Local Const $_ARRAYCONSTANT_SS_CENTERIMAGE = 0x0200
  206. Local Const $_ARRAYCONSTANT_LVM_GETITEMCOUNT = (0x1000 + 4)
  207. Local Const $_ARRAYCONSTANT_LVM_GETITEMRECT = (0x1000 + 14)
  208. Local Const $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH = (0x1000 + 29)
  209. Local Const $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH = (0x1000 + 30)
  210. Local Const $_ARRAYCONSTANT_LVM_GETITEMSTATE = (0x1000 + 44)
  211. Local Const $_ARRAYCONSTANT_LVM_GETSELECTEDCOUNT = (0x1000 + 50)
  212. Local Const $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE = (0x1000 + 54)
  213. Local Const $_ARRAYCONSTANT_LVS_EX_GRIDLINES = 0x1
  214. Local Const $_ARRAYCONSTANT_LVIS_SELECTED = 0x0002
  215. Local Const $_ARRAYCONSTANT_LVS_SHOWSELALWAYS = 0x8
  216. Local Const $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT = 0x20
  217. Local Const $_ARRAYCONSTANT_WS_EX_CLIENTEDGE = 0x0200
  218. Local Const $_ARRAYCONSTANT_WS_MAXIMIZEBOX = 0x00010000
  219. Local Const $_ARRAYCONSTANT_WS_MINIMIZEBOX = 0x00020000
  220. Local Const $_ARRAYCONSTANT_WS_SIZEBOX = 0x00040000
  221. Local Const $_ARRAYCONSTANT_WM_SETREDRAW = 11
  222. Local Const $_ARRAYCONSTANT_LVSCW_AUTOSIZE = -1
  223. Local Const $_ARRAYCONSTANT_LVSCW_AUTOSIZE_USEHEADER = -2
  224. ; Set coord mode 1
  225. Local $iCoordMode = Opt("GUICoordMode", 1)
  226. ; Create GUI
  227. Local $iOrgWidth = 210, $iHeight = 200, $iMinSize = 250
  228. Local $hGUI = GUICreate($sTitle, $iOrgWidth, $iHeight, Default, Default, BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX))
  229. Local $aiGUISize = WinGetClientSize($hGUI)
  230. Local $iButtonWidth_1 = $aiGUISize[0] / 2
  231. Local $iButtonWidth_2 = $aiGUISize[0] / 3
  232. ; Create ListView
  233. Local $idListView = GUICtrlCreateListView($sHeader, 0, 0, $aiGUISize[0], $aiGUISize[1] - $iButtonBorder, $_ARRAYCONSTANT_LVS_SHOWSELALWAYS)
  234. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_GRIDLINES, $_ARRAYCONSTANT_LVS_EX_GRIDLINES)
  235. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT)
  236. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE)
  237. Local $idCopy_ID = 9999, $idCopy_Data = 99999, $idData_Label = 99999, $idUser_Func = 99999, $idExit_Script = 99999
  238. If $bDebug Then
  239. ; Create buttons
  240. $idCopy_ID = GUICtrlCreateButton("Copy Data && Hdr/Row", 0, $aiGUISize[1] - $iButtonBorder, $iButtonWidth_1, 20)
  241. $idCopy_Data = GUICtrlCreateButton("Copy Data Only", $iButtonWidth_1, $aiGUISize[1] - $iButtonBorder, $iButtonWidth_1, 20)
  242. Local $iButtonWidth_Var = $iButtonWidth_1
  243. Local $iOffset = $iButtonWidth_1
  244. If IsFunc($hUser_Function) Then
  245. ; Create UserFunc button if function passed
  246. $idUser_Func = GUICtrlCreateButton("Run User Func", $iButtonWidth_2, $aiGUISize[1] - 20, $iButtonWidth_2, 20)
  247. $iButtonWidth_Var = $iButtonWidth_2
  248. $iOffset = $iButtonWidth_2 * 2
  249. EndIf
  250. ; Create Exit button and data label
  251. $idExit_Script = GUICtrlCreateButton("Exit Script", $iOffset, $aiGUISize[1] - 20, $iButtonWidth_Var, 20)
  252. $idData_Label = GUICtrlCreateLabel($sDisplayData, 0, $aiGUISize[1] - 20, $iButtonWidth_Var, 18, BitOR($_ARRAYCONSTANT_SS_CENTER, $_ARRAYCONSTANT_SS_CENTERIMAGE))
  253. Else
  254. $idData_Label = GUICtrlCreateLabel($sDisplayData, 0, $aiGUISize[1] - 20, $aiGUISize[0], 18, BitOR($_ARRAYCONSTANT_SS_CENTER, $_ARRAYCONSTANT_SS_CENTERIMAGE))
  255. EndIf
  256. ; Change label colour and create tooltip if required
  257. Select
  258. Case $iTranspose Or $bRange_Flag
  259. GUICtrlSetColor($idData_Label, 0xFF0000)
  260. GUICtrlSetTip($idData_Label, $sTipData)
  261. EndSelect
  262. ; Set resizing
  263. GUICtrlSetResizing($idListView, $_ARRAYCONSTANT_GUI_DOCKBORDERS)
  264. GUICtrlSetResizing($idCopy_ID, $_ARRAYCONSTANT_GUI_DOCKLEFT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
  265. GUICtrlSetResizing($idCopy_Data, $_ARRAYCONSTANT_GUI_DOCKRIGHT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
  266. GUICtrlSetResizing($idData_Label, $_ARRAYCONSTANT_GUI_DOCKLEFT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
  267. GUICtrlSetResizing($idUser_Func, $_ARRAYCONSTANT_GUI_DOCKHCENTER + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
  268. GUICtrlSetResizing($idExit_Script, $_ARRAYCONSTANT_GUI_DOCKRIGHT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
  269. ; Start ListView update
  270. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_WM_SETREDRAW, 0, 0)
  271. ; Fill listview
  272. Local $iRowIndex, $iColFill
  273. If $iTranspose Then
  274. For $i = $iSubItem_Start To $iSubItem_End
  275. ; Create ListView item
  276. $iRowIndex = __ArrayDisplay_AddItem($idListView, "NULL")
  277. ; Add row number if required and determine start column for data
  278. If $iNoRow Then
  279. $iColFill = 0
  280. Else
  281. __ArrayDisplay_AddSubItem($idListView, $iRowIndex, "Col " & $i, 0)
  282. $iColFill = 1
  283. EndIf
  284. ; Fill row with data
  285. For $j = $iItem_Start To $iItem_End
  286. If $iDimension = 2 Then
  287. $vTmp = $aArray[$j][$i]
  288. Else
  289. $vTmp = $aArray[$j]
  290. EndIf
  291. Switch VarGetType($vTmp)
  292. Case "Array"
  293. __ArrayDisplay_AddSubItem($idListView, $iRowIndex, "{Array}", $iColFill)
  294. Case Else
  295. __ArrayDisplay_AddSubItem($idListView, $iRowIndex, $vTmp, $iColFill)
  296. EndSwitch
  297. $iColFill += 1
  298. Next
  299. Next
  300. Else
  301. For $i = $iItem_Start To $iItem_End
  302. ; Create ListView item
  303. $iRowIndex = __ArrayDisplay_AddItem($idListView, "NULL")
  304. ; Add row number if required and determine start column for data
  305. If $iNoRow Then
  306. $iColFill = 0
  307. Else
  308. __ArrayDisplay_AddSubItem($idListView, $iRowIndex, "Row " & $i, 0)
  309. $iColFill = 1
  310. EndIf
  311. ; Fill row with data
  312. For $j = $iSubItem_Start To $iSubItem_End
  313. If $iDimension = 2 Then
  314. $vTmp = $aArray[$i][$j]
  315. Else
  316. $vTmp = $aArray[$i]
  317. EndIf
  318. Switch VarGetType($vTmp)
  319. Case "Array"
  320. __ArrayDisplay_AddSubItem($idListView, $iRowIndex, "{Array}", $iColFill)
  321. Case Else
  322. __ArrayDisplay_AddSubItem($idListView, $iRowIndex, $vTmp, $iColFill)
  323. EndSwitch
  324. $iColFill += 1
  325. Next
  326. Next
  327. EndIf
  328. ; Align columns if required - $iColAlign = 2 for Right and 4 for Center
  329. If $iColAlign Then
  330. ; Loop through columns
  331. For $i = 0 To $iColFill - 1
  332. __ArrayDisplay_JustifyColumn($idListView, $i, $iColAlign / 2)
  333. Next
  334. EndIf
  335. ; End ListView update
  336. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_WM_SETREDRAW, 1, 0)
  337. ; Allow for borders with and without vertical scrollbar
  338. Local $iBorder = (($iRowIndex > 19) ? (65) : (45))
  339. ; Adjust dialog width
  340. Local $iWidth = $iBorder, $iColWidth = 0, $aiColWidth[$iColFill], $iMin_ColWidth = 55
  341. ; Get required column widths to fit items
  342. For $i = 0 To UBound($aiColWidth) - 1
  343. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH, $i, $_ARRAYCONSTANT_LVSCW_AUTOSIZE)
  344. $iColWidth = GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH, $i, 0)
  345. ; Check width of header if set
  346. If $sHeader <> "" Then
  347. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH, $i, $_ARRAYCONSTANT_LVSCW_AUTOSIZE_USEHEADER)
  348. Local $iColWidthHeader = GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH, $i, 0)
  349. ; Set minimum if required
  350. If $iColWidth < $iMin_ColWidth And $iColWidthHeader < $iMin_ColWidth Then
  351. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH, $i, $iMin_ColWidth)
  352. $iColWidth = $iMin_ColWidth
  353. ElseIf $iColWidthHeader < $iColWidth Then
  354. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH, $i, $iColWidth)
  355. Else
  356. $iColWidth = $iColWidthHeader
  357. EndIf
  358. Else
  359. ; Set minimum if required
  360. If $iColWidth < $iMin_ColWidth Then
  361. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH, $i, $iMin_ColWidth)
  362. $iColWidth = $iMin_ColWidth
  363. EndIf
  364. EndIf
  365. ; Add to total width
  366. $iWidth += $iColWidth
  367. ; Store value
  368. $aiColWidth[$i] = $iColWidth
  369. Next
  370. ; Now check max size
  371. If $iWidth > @DesktopWidth - 100 Then
  372. ; Apply max col width limit to reduce width
  373. $iWidth = $iBorder
  374. For $i = 0 To UBound($aiColWidth) - 1
  375. If $aiColWidth[$i] > $iMax_ColWidth Then
  376. ; Reset width
  377. GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH, $i, $iMax_ColWidth)
  378. $iWidth += $iMax_ColWidth
  379. Else
  380. ; Retain width
  381. $iWidth += $aiColWidth[$i]
  382. EndIf
  383. Next
  384. EndIf
  385. ; Check max/min width
  386. If $iWidth > @DesktopWidth - 100 Then
  387. $iWidth = @DesktopWidth - 100
  388. ElseIf $iWidth < $iMinSize Then
  389. $iWidth = $iMinSize
  390. EndIf
  391. ; Get row height
  392. Local $tRECT = DllStructCreate("struct; long Left;long Top;long Right;long Bottom; endstruct") ; $tagRECT
  393. DllCall("user32.dll", "struct*", "SendMessageW", "hwnd", GUICtrlGetHandle($idListView), "uint", $_ARRAYCONSTANT_LVM_GETITEMRECT, "wparam", 0, "struct*", $tRECT)
  394. ; Set required GUI height
  395. Local $aiWin_Pos = WinGetPos($hGUI)
  396. Local $aiLV_Pos = ControlGetPos($hGUI, "", $idListView)
  397. $iHeight = (($iRowIndex + 4) * (DllStructGetData($tRECT, "Bottom") - DllStructGetData($tRECT, "Top"))) + $aiWin_Pos[3] - $aiLV_Pos[3]
  398. ; Check min/max height
  399. If $iHeight > @DesktopHeight - 100 Then
  400. $iHeight = @DesktopHeight - 100
  401. ElseIf $iHeight < $iMinSize Then
  402. $iHeight = $iMinSize
  403. EndIf
  404. If $iVerbose Then SplashOff()
  405. ; Display and resize dialog
  406. GUISetState(@SW_HIDE, $hGUI)
  407. WinMove($hGUI, "", (@DesktopWidth - $iWidth) / 2, (@DesktopHeight - $iHeight) / 2, $iWidth, $iHeight)
  408. GUISetState(@SW_SHOW, $hGUI)
  409. ; Switch to GetMessage mode
  410. Local $iOnEventMode = Opt("GUIOnEventMode", 0), $iMsg
  411. __ArrayDisplay_RegisterSortCallBack($idListView, 2, True, "__ArrayDisplay_SortCallBack")
  412. While 1
  413. $iMsg = GUIGetMsg() ; Variable needed to check which "Copy" button was pressed
  414. Switch $iMsg
  415. Case $_ARRAYCONSTANT_GUI_EVENT_CLOSE
  416. ExitLoop
  417. Case $idCopy_ID, $idCopy_Data
  418. ; Count selected rows
  419. Local $iSel_Count = GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETSELECTEDCOUNT, 0, 0)
  420. ; Display splash dialog if required
  421. If $iVerbose And (Not $iSel_Count) And ($iItem_End - $iItem_Start) * ($iSubItem_End - $iSubItem_Start) > 10000 Then
  422. SplashTextOn($sMsgBoxTitle, "Copying data" & @CRLF & @CRLF & "Please be patient", 300, 100)
  423. EndIf
  424. ; Generate clipboard text
  425. Local $sClip = "", $sItem, $aSplit
  426. ; Add items
  427. For $i = 0 To GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETITEMCOUNT, 0, 0) - 1
  428. ; Skip if copying selected rows and item not selected
  429. If $iSel_Count And Not (GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETITEMSTATE, $i, $_ARRAYCONSTANT_LVIS_SELECTED) <> 0) Then
  430. ContinueLoop
  431. EndIf
  432. $sItem = __ArrayDisplay_GetItemTextString($idListView, $i)
  433. If $iMsg = $idCopy_ID And $iNoRow Then
  434. ; Add row data
  435. $sItem = "Row " & ($i + (($iTranspose) ? ($iSubItem_Start) : ($iItem_Start))) & $sCurr_Separator & $sItem
  436. EndIf
  437. If $iMsg = $idCopy_Data And Not $iNoRow Then
  438. ; Remove Row data
  439. $sItem = StringRegExpReplace($sItem, "^Row\s\d+\|(.*)$", "$1")
  440. EndIf
  441. If $iCW_ColWidth Then
  442. ; Expand columns
  443. $aSplit = StringSplit($sItem, $sCurr_Separator)
  444. $sItem = ""
  445. For $j = 1 To $aSplit[0]
  446. $sItem &= StringFormat("%-" & $iCW_ColWidth + 1 & "s", StringLeft($aSplit[$j], $iCW_ColWidth))
  447. Next
  448. Else
  449. ; Use defined separator
  450. $sItem = StringReplace($sItem, $sCurr_Separator, $vUser_Separator)
  451. EndIf
  452. $sClip &= $sItem & @CRLF
  453. Next
  454. $sItem = $sHeader
  455. ; Add header line if required
  456. If $iMsg = $idCopy_ID Then
  457. $sItem = $sHeader
  458. If $iNoRow Then
  459. ; Add "Row" to header
  460. $sItem = "Row|" & $sItem
  461. EndIf
  462. If $iCW_ColWidth Then
  463. $aSplit = StringSplit($sItem, $sCurr_Separator)
  464. $sItem = ""
  465. For $j = 1 To $aSplit[0]
  466. $sItem &= StringFormat("%-" & $iCW_ColWidth + 1 & "s", StringLeft($aSplit[$j], $iCW_ColWidth))
  467. Next
  468. Else
  469. $sItem = StringReplace($sItem, $sCurr_Separator, $vUser_Separator)
  470. EndIf
  471. $sClip = $sItem & @CRLF & $sClip
  472. EndIf
  473. ;Send to clipboard
  474. ClipPut($sClip)
  475. ; Remove splash if used
  476. SplashOff()
  477. ; Refocus ListView
  478. GUICtrlSetState($idListView, $_ARRAYCONSTANT_GUI_FOCUS)
  479. Case $idListView
  480. ; Kick off the sort callback
  481. __ArrayDisplay_SortItems($idListView, GUICtrlGetState($idListView))
  482. Case $idUser_Func
  483. ; Get selected indices
  484. Local $aiSelItems[1] = [0]
  485. For $i = 0 To GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETITEMCOUNT, 0, 0) - 1
  486. If (GUICtrlSendMsg($idListView, $_ARRAYCONSTANT_LVM_GETITEMSTATE, $i, $_ARRAYCONSTANT_LVIS_SELECTED) <> 0) Then
  487. $aiSelItems[0] += 1
  488. ReDim $aiSelItems[$aiSelItems[0] + 1]
  489. $aiSelItems[$aiSelItems[0]] = $i + $iItem_Start
  490. EndIf
  491. Next
  492. ; Pass array and selection to user function
  493. $hUser_Function($aArray, $aiSelItems)
  494. GUICtrlSetState($idListView, $_ARRAYCONSTANT_GUI_FOCUS)
  495. Case $idExit_Script
  496. ; Clear up
  497. GUIDelete($hGUI)
  498. Exit
  499. EndSwitch
  500. WEnd
  501. ; Clear up
  502. GUIDelete($hGUI)
  503. Opt("GUICoordMode", $iCoordMode) ; Reset original Coord mode
  504. Opt("GUIOnEventMode", $iOnEventMode) ; Reset original GUI mode
  505. ;~ Opt("GUIDataSeparatorChar", $sCurr_Separator) ; Reset original separator
  506. Return 1
  507. EndFunc ;==>__ArrayDisplay_Share
  508. ; #DUPLICATED Functions to avoid big #include <GuiListView.au3># ================================================================
  509. ; Functions have been simplified (unicode inprocess) according to __ArrayDisplay_Share() needs
  510. Func __ArrayDisplay_RegisterSortCallBack($hWnd, $vCompareType = 2, $bArrows = True, $sSort_Callback = "__ArrayDisplay_SortCallBack")
  511. #Au3Stripper_Ignore_Funcs=$sSort_Callback
  512. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  513. ;~ Local Const $LVM_GETHEADER = (0x1000 + 31) ; 0x101F
  514. Local $hHeader = HWnd(GUICtrlSendMsg($hWnd, 0x101F, 0, 0))
  515. $__g_aArrayDisplay_SortInfo[1] = $hWnd ; Handle of listview
  516. $__g_aArrayDisplay_SortInfo[2] = DllCallbackRegister($sSort_Callback, "int", "int;int;hwnd") ; Handle of callback
  517. $__g_aArrayDisplay_SortInfo[3] = -1 ; $nColumn
  518. $__g_aArrayDisplay_SortInfo[4] = -1 ; nCurCol
  519. $__g_aArrayDisplay_SortInfo[5] = 1 ; $nSortDir
  520. $__g_aArrayDisplay_SortInfo[6] = -1 ; $nCol
  521. $__g_aArrayDisplay_SortInfo[7] = 0 ; $bSet
  522. $__g_aArrayDisplay_SortInfo[8] = $vCompareType ; Treat as Strings, Numbers or use Windows API to compare
  523. $__g_aArrayDisplay_SortInfo[9] = $bArrows ; Use arrows in the header of the columns?
  524. $__g_aArrayDisplay_SortInfo[10] = $hHeader ; Handle to the Header
  525. Return $__g_aArrayDisplay_SortInfo[2] <> 0
  526. EndFunc ;==>__ArrayDisplay_RegisterSortCallBack
  527. #Au3Stripper_Ignore_Funcs=__ArrayDisplay_SortCallBack
  528. Func __ArrayDisplay_SortCallBack($nItem1, $nItem2, $hWnd)
  529. ; Switch the sorting direction
  530. If $__g_aArrayDisplay_SortInfo[3] = $__g_aArrayDisplay_SortInfo[4] Then ; $nColumn = nCurCol ?
  531. If Not $__g_aArrayDisplay_SortInfo[7] Then ; $bSet
  532. $__g_aArrayDisplay_SortInfo[5] *= -1 ; $nSortDir
  533. $__g_aArrayDisplay_SortInfo[7] = 1 ; $bSet
  534. EndIf
  535. Else
  536. $__g_aArrayDisplay_SortInfo[7] = 1 ; $bSet
  537. EndIf
  538. $__g_aArrayDisplay_SortInfo[6] = $__g_aArrayDisplay_SortInfo[3] ; $nCol = $nColumn
  539. Local $sVal1 = __ArrayDisplay_GetItemText($hWnd, $nItem1, $__g_aArrayDisplay_SortInfo[3])
  540. Local $sVal2 = __ArrayDisplay_GetItemText($hWnd, $nItem2, $__g_aArrayDisplay_SortInfo[3])
  541. If $__g_aArrayDisplay_SortInfo[8] = 1 Then
  542. ; force Treat as Number if possible
  543. If (StringIsFloat($sVal1) Or StringIsInt($sVal1)) Then $sVal1 = Number($sVal1)
  544. If (StringIsFloat($sVal2) Or StringIsInt($sVal2)) Then $sVal2 = Number($sVal2)
  545. EndIf
  546. Local $nResult
  547. If $__g_aArrayDisplay_SortInfo[8] < 2 Then
  548. ; Treat as String or Number
  549. $nResult = 0 ; No change of item1 and item2 positions
  550. If $sVal1 < $sVal2 Then
  551. $nResult = -1 ; Put item2 before item1
  552. ElseIf $sVal1 > $sVal2 Then
  553. $nResult = 1 ; Put item2 behind item1
  554. EndIf
  555. Else
  556. ; Use API handling
  557. $nResult = DllCall('shlwapi.dll', 'int', 'StrCmpLogicalW', 'wstr', $sVal1, 'wstr', $sVal2)[0]
  558. EndIf
  559. $nResult = $nResult * $__g_aArrayDisplay_SortInfo[5] ; $nSortDir
  560. Return $nResult
  561. EndFunc ;==>__ArrayDisplay_SortCallBack
  562. Func __ArrayDisplay_SortItems($hWnd, $iCol)
  563. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  564. Local $pFunction = DllCallbackGetPtr($__g_aArrayDisplay_SortInfo[2]) ; get pointer to call back
  565. $__g_aArrayDisplay_SortInfo[3] = $iCol ; $nColumn = column clicked
  566. $__g_aArrayDisplay_SortInfo[7] = 0 ; $bSet
  567. $__g_aArrayDisplay_SortInfo[4] = $__g_aArrayDisplay_SortInfo[6] ; nCurCol = $nCol
  568. ;~ Local Const $LVM_SORTITEMSEX = ($LVM_FIRST + 81) ; 0x1000 + 81
  569. Local $aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x1051, "hwnd", $hWnd, "ptr", $pFunction)
  570. If $aResult[0] <> 0 Then
  571. If $__g_aArrayDisplay_SortInfo[9] Then ; Use arrow in header
  572. Local $hHeader = $__g_aArrayDisplay_SortInfo[10], $iFormat
  573. For $x = 0 To __ArrayDisplay_GetItemCount($hHeader) - 1
  574. $iFormat = __ArrayDisplay_GetItemFormat($hHeader, $x)
  575. If BitAND($iFormat, 0x00000200) Then ; $HDF_SORTDOWN
  576. __ArrayDisplay_SetItemFormat($hHeader, $x, BitXOR($iFormat, 0x00000200))
  577. ElseIf BitAND($iFormat, 0x00000400) Then ; $HDF_SORTUP
  578. __ArrayDisplay_SetItemFormat($hHeader, $x, BitXOR($iFormat, 0x00000400))
  579. EndIf
  580. Next
  581. $iFormat = __ArrayDisplay_GetItemFormat($hHeader, $iCol)
  582. If $__g_aArrayDisplay_SortInfo[5] = 1 Then ; ascending
  583. __ArrayDisplay_SetItemFormat($hHeader, $iCol, BitOR($iFormat, 0x00000400))
  584. Else ; descending
  585. __ArrayDisplay_SetItemFormat($hHeader, $iCol, BitOR($iFormat, 0x00000200))
  586. EndIf
  587. EndIf
  588. Return True
  589. EndIf
  590. Return False
  591. EndFunc ;==>__ArrayDisplay_SortItems
  592. Func __ArrayDisplay_AddItem($hWnd, $sText)
  593. Local $tItem = DllStructCreate($_ARRAYCONSTANT_tagLVITEM)
  594. DllStructSetData($tItem, "Param", 0)
  595. Local $iBuffer = StringLen($sText) + 1
  596. Local $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  597. $iBuffer *= 2
  598. DllStructSetData($tBuffer, "Text", $sText)
  599. DllStructSetData($tItem, "Text", DllStructGetPtr($tBuffer))
  600. DllStructSetData($tItem, "TextMax", $iBuffer)
  601. ;~ Local Const $LVIF_PARAM = 0x00000004
  602. ;~ Local Const $LVIF_TEXT = 0x00000001
  603. Local $iMask = 0x00000005 ; LVIF_TEXT + $LVIF_PARAM
  604. DllStructSetData($tItem, "Mask", $iMask)
  605. DllStructSetData($tItem, "Item", 999999999) ; add item
  606. DllStructSetData($tItem, "Image", -1) ; no image
  607. Local $pItem = DllStructGetPtr($tItem)
  608. ;~ Local Const $_ARRAYCONSTANTS_LVM_INSERTITEMW = (0x1000 + 77) ; 0x104D
  609. Local $iRet = GUICtrlSendMsg($hWnd, 0x104D, 0, $pItem)
  610. Return $iRet
  611. EndFunc ;==>__ArrayDisplay_AddItem
  612. Func __ArrayDisplay_AddSubItem($hWnd, $iIndex, $sText, $iSubItem)
  613. Local $iBuffer = StringLen($sText) + 1
  614. Local $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  615. $iBuffer *= 2
  616. Local $pBuffer = DllStructGetPtr($tBuffer)
  617. Local $tItem = DllStructCreate($_ARRAYCONSTANT_tagLVITEM)
  618. ;~ Local Const $LVIF_TEXT = 0x00000001
  619. Local $iMask = 0x00000001 ; $LVIF_TEXT
  620. DllStructSetData($tBuffer, "Text", $sText)
  621. DllStructSetData($tItem, "Mask", $iMask) ; just text
  622. DllStructSetData($tItem, "Item", $iIndex)
  623. DllStructSetData($tItem, "SubItem", $iSubItem)
  624. DllStructSetData($tItem, "Image", -1) ; no image
  625. Local $pItem = DllStructGetPtr($tItem)
  626. DllStructSetData($tItem, "Text", $pBuffer)
  627. ;~ Local Const $_ARRAYCONSTANTS_LVM_SETITEMW = (0x1000 + 76) ; 0x104C
  628. Local $iRet = GUICtrlSendMsg($hWnd, 0x104C, 0, $pItem)
  629. Return $iRet <> 0
  630. EndFunc ;==>__ArrayDisplay_AddSubItem
  631. Func __ArrayDisplay_GetColumnCount($hWnd)
  632. ;~ Local Const $LVM_GETHEADER = (0x1000 + 31) ; 0x101F
  633. Local $hHeader = HWnd(GUICtrlSendMsg($hWnd, 0x101F, 0, 0))
  634. Return __ArrayDisplay_GetItemCount($hHeader)
  635. EndFunc ;==>__ArrayDisplay_GetColumnCount
  636. Func __ArrayDisplay_GetHeader($hWnd)
  637. ;~ Local Const $LVM_GETHEADER = (0x1000 + 31) ; 0x101F
  638. Return HWnd(GUICtrlSendMsg($hWnd, 0x101F, 0, 0))
  639. EndFunc ;==>__ArrayDisplay_GetHeader
  640. Func __ArrayDisplay_GetItem($hWnd, $iIndex, ByRef $tItem)
  641. ;Global Const $HDM_GETITEMW = $HDM_FIRST + 11 ; 0x1200 + 11
  642. Local $aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x120B, "wparam", $iIndex, "struct*", $tItem)
  643. Return $aResult[0] <> 0
  644. EndFunc ;==>__ArrayDisplay_GetItem
  645. Func __ArrayDisplay_GetItemCount($hWnd)
  646. ;Local Const $HDM_GETITEMCOUNT = 0x1200
  647. Local $aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x1200, "wparam", 0, "lparam", 0)
  648. Return $aResult[0]
  649. EndFunc ;==>__ArrayDisplayr_GetItemCount
  650. Func __ArrayDisplay_GetItemFormat($hWnd, $iIndex)
  651. Local $tItem = DllStructCreate($_ARRAYCONSTANT_tagHDITEM)
  652. DllStructSetData($tItem, "Mask", 0x00000004) ; $HDI_FORMAT
  653. __ArrayDisplay_GetItem($hWnd, $iIndex, $tItem)
  654. Return DllStructGetData($tItem, "Fmt")
  655. EndFunc ;==>__ArrayDisplay_GetItemFormat
  656. Func __ArrayDisplay_GetItemText($hWnd, $iIndex, $iSubItem = 0)
  657. Local $tBuffer = DllStructCreate("wchar Text[4096]")
  658. Local $pBuffer = DllStructGetPtr($tBuffer)
  659. Local $tItem = DllStructCreate($_ARRAYCONSTANT_tagLVITEM)
  660. DllStructSetData($tItem, "SubItem", $iSubItem)
  661. DllStructSetData($tItem, "TextMax", 4096)
  662. DllStructSetData($tItem, "Text", $pBuffer)
  663. ;Global Const $LVM_GETITEMTEXTW = (0x1000 + 115) ; 0X1073
  664. If IsHWnd($hWnd) Then
  665. DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x1073, "wparam", $iIndex, "struct*", $tItem)
  666. Else
  667. Local $pItem = DllStructGetPtr($tItem)
  668. GUICtrlSendMsg($hWnd, 0x1073, $iIndex, $pItem)
  669. EndIf
  670. Return DllStructGetData($tBuffer, "Text")
  671. EndFunc ;==>__ArrayDisplay_GetItemText
  672. Func __ArrayDisplay_GetItemTextString($hWnd, $iItem)
  673. Local $sRow = "", $sSeparatorChar = Opt('GUIDataSeparatorChar')
  674. Local $iSelected = $iItem ; get row
  675. For $x = 0 To __ArrayDisplay_GetColumnCount($hWnd) - 1
  676. $sRow &= __ArrayDisplay_GetItemText($hWnd, $iSelected, $x) & $sSeparatorChar
  677. Next
  678. Return StringTrimRight($sRow, 1)
  679. EndFunc ;==>__ArrayDisplay_GetItemTextString
  680. Func __ArrayDisplay_JustifyColumn($idListView, $iIndex, $iAlign = -1)
  681. ;Local $aAlign[3] = [$LVCFMT_LEFT, $LVCFMT_RIGHT, $LVCFMT_CENTER]
  682. Local $tColumn = DllStructCreate("uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal") ; $tagLVCOLUMN
  683. If $iAlign < 0 Or $iAlign > 2 Then $iAlign = 0
  684. DllStructSetData($tColumn, "Mask", 0x01) ; $LVCF_FMT
  685. DllStructSetData($tColumn, "Fmt", $iAlign)
  686. Local $pColumn = DllStructGetPtr($tColumn)
  687. Local $iRet = GUICtrlSendMsg($idListView, 0x1060 , $iIndex, $pColumn) ; $_ARRAYCONSTANT_LVM_SETCOLUMNW
  688. Return $iRet <> 0
  689. EndFunc ;==>__ArrayDisplay_JustifyColumn
  690. Func __ArrayDisplay_SetItemFormat($hWnd, $iIndex, $iFormat)
  691. Local $tItem = DllStructCreate($_ARRAYCONSTANT_tagHDITEM)
  692. DllStructSetData($tItem, "Mask", 0x00000004) ; $HDI_FORMAT
  693. DllStructSetData($tItem, "Fmt", $iFormat)
  694. ;Global Const $HDM_SETITEMW = $HDM_FIRST + 12 ; 0x1200 + 12
  695. Local $aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x120C, "wparam", $iIndex, "struct*", $tItem)
  696. Return $aResult[0] <> 0
  697. EndFunc ;==>__ArrayDisplay_SetItemFormat
  698. ; ===============================================================================================================================