HolmesShelock Posted December 30, 2014 Posted December 30, 2014 _GUICtrlListView_JustifyColumn() justifies column header and text of a ListView in the same way. But, is there any means to achieve different alignment, e.g. "Centered" for header and "Right" for text? [size="2"][font="arial, verdana, tahoma, sans-serif"]ProtectData - A Data Protection software for floppies[/font][/size] [size="2"][hr][/size][size="2"]Sessionchange - A Windows service capable of tracking session change events[/size][size="2"][b][/b][/size]
Moderators Melba23 Posted December 30, 2014 Moderators Posted December 30, 2014 HolmesShelock,A bit long-winded, but it does what you want - and as you can see you can still click on the header to sort if required: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $aTitles[3] = ["Col 0", "Col 1", "Col 2"] Global $vSortSense_Full = True, $vSortSense_Item = True $hGUI = GUICreate("Test", 500, 500) $cLV_Full = GUICtrlCreateListView("", 10, 10, 480, 200) $hLV_Full = GUICtrlGetHandle($cLV_Full) $cLv_Header = GUICtrlCreateListView("", 10, 250, 480, 25) $cLV_Items = GUICtrlCreateListView("", 10, 275, 480, 175, $LVS_NOCOLUMNHEADER) $hLV_Header = GUICtrlGetHandle($cLv_Header) $hLV_Items = GUICtrlGetHandle($cLV_Items) For $i = 0 To 2 _GUICtrlListView_AddColumn($cLV_Full, $aTitles[$i], 150) _GUICtrlListView_AddColumn($cLv_Header, $aTitles[$i], 150, 1) _GUICtrlListView_AddColumn($cLV_Items, $aTitles[$i], 150, 2) Next For $i = 0 To 4 $sData = "" For $j = 0 To 2 $sData &= "Item " & $i & "-" & Random(0, 100, 1) & "|" Next StringTrimRight($sData, 1) GUICtrlCreateListViewItem($sData, $cLV_Full) GUICtrlCreateListViewItem($sData, $cLV_Items) Next GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $iCode = DllStructGetData($tNMHDR, "Code") Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) Switch $hWndFrom Case $hLV_Full _GUICtrlListView_SimpleSort($hLV_Full, $vSortSense_Full, DllStructGetData($tInfo, "SubItem")) Case $hLV_Header _GUICtrlListView_SimpleSort($hLV_Items, $vSortSense_Item, DllStructGetData($tInfo, "SubItem") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFYAny use? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
HolmesShelock Posted December 30, 2014 Author Posted December 30, 2014 On 12/30/2014 at 9:48 AM, Melba23 said: Any use? Typo detected _GUICtrlListView_SimpleSort($hLV_Items, $vSortSense_Item, DllStructGetData($tInfo, "SubItem") should be _GUICtrlListView_SimpleSort($hLV_Items, $vSortSense_Item, DllStructGetData($tInfo, "SubItem")) And did you try resizing the columns of teh table below? Scrollbar appears in the header itself! [size="2"][font="arial, verdana, tahoma, sans-serif"]ProtectData - A Data Protection software for floppies[/font][/size] [size="2"][hr][/size][size="2"]Sessionchange - A Windows service capable of tracking session change events[/size][size="2"][b][/b][/size]
Moderators Melba23 Posted December 31, 2014 Moderators Posted December 31, 2014 HolmesShelock, Quote Any use?Obviously not. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now