LurchMan Posted June 2, 2009 Share Posted June 2, 2009 (edited) I'm not exactly the greatest with GUI's but i started tinkering around with this idea, and I was wondering if there was a way to combine a tree view and and a list view so that I could have a tree view in the first column and data in 2 more columns. It doesn't have to be done any certain way as long as it looks good, and when you scroll down through the data everything will still line up correctly by each row. All ideas suggestions welcome! Thanks Lurch Edit: Spelling Edited June 2, 2009 by LurchMan Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2009 Moderators Share Posted June 4, 2009 LurchMan,This is far from perfect, but it does synchronise the TreeView and ListView scrolling.Elements that certainly need to improve: more rapid "following" by the other control (perhaps by using GUIRegisterMsg?); getting the line spacing/font size right so that the horizontal alignment is correct.However, it gives you something to start your project - and it might just spur others into producing something better. ;-)expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #include <GuiListView.au3> #include <Misc.au3> Global Const $iMax = 40 $hGUI = GUICreate("Synchro Pair", 195, 140, -1, -1) $hTreeView = GUICtrlCreateTreeView(10, 5, 85, 120, -1, $WS_EX_CLIENTEDGE) Global $aTV_Items[$iMax] _GUICtrlTreeView_BeginUpdate($hTreeView) For $i = 0 To $iMax - 1 $aTV_Items[$i] = _GUICtrlTreeView_Add($hTreeView, 0, $i + 1) Next _GUICtrlTreeView_EndUpdate($hTreeView) $hListView = GUICtrlCreateListView(" ", 100, 5, 85, 120, $LVS_NOCOLUMNHEADER) For $i = 1 To $iMax GUICtrlCreateListViewItem($i, $hListView) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN While _IsPressed(01) Sleep(10) WEnd $aInfo = GUIGetCursorInfo($hGUI) $hTV_Top = _GUICtrlTreeView_GetFirstVisible($hTreeView) $iTV_TopIndex = _ArraySearch($aTV_Items, $hTV_Top) If _GUICtrlListView_GetTopIndex($hListView) > $iTV_TopIndex Then If $aInfo[4] = $hListView Then $iTV_BotIndex = _GUICtrlListView_GetTopIndex($hListView) + 5 If $iTV_BotIndex > $iMax - 1 Then $iTV_BotIndex = $iMax - 1 _GUICtrlTreeView_EnsureVisible($hTreeView, $aTV_Items[$iTV_BotIndex]) ElseIf $aInfo[4] = $hTreeView Then _GUICtrlListView_EnsureVisible($hListView, $iTV_TopIndex) EndIf ElseIf $iTV_TopIndex > _GUICtrlListView_GetTopIndex($hListView) Then If $aInfo[4] = $hListView Then _GUICtrlTreeView_EnsureVisible($hTreeView, $aTV_Items[_GUICtrlListView_GetTopIndex($hListView)]) ElseIf $aInfo[4] = $hTreeView Then $iLV_BotIndex = $iTV_TopIndex + 5 If $iLV_BotIndex > $iMax - 1 Then $iLV_BotIndex = $iMax - 1 _GUICtrlListView_EnsureVisible($hListView, $iLV_BotIndex) EndIf EndIf EndSwitch WEndI look forward to seeing the finished article. Have fun. :-)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: Spoiler 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 Link to comment Share on other sites More sharing options...
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