Jump to content

GUIListViewEx Integration


Recommended Posts

  • Moderators

error471,

And what exactly you expect me to do about it with nothing more than:

Quote

When I load a lvs-file with _GUIListViewEx_LoadListView the saved colors are not loaded

as a guide?

At a minimum I will need the saved data/colour file, the ListView creation code and the _GUILIstViewEx_Init line in order to do any sensible testing - all I can say at the moment is "It works for me"!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Replies 147
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

error471, As I explained above, I will not be adding such functionality to the UDF itself (it is already complex enough) but I believe it will be possible to use it along with some custom code to

mLipok, Very interesting, it errors in the LH ListView, but not in the RH one - Sherlock Holmes mode now activated! M23 Edit: Found it - I was not forcing the correct colour array to be

error471, Thanks, I will look into that. [Works for me as long as the empty ListView has the correct number of columns] [Now it works for all column values] That should not be too diffic

Posted Images

@Melba23:

Excuse my late reply and insufficient problem description. Here is a stripped off example of my script, which reproduces the error:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>

#include "GUIListViewEx_Mod.au3"


#Region ### START Koda GUI section ###
$Form1 = GUICreate("Example", 970, 554, 192, 124,  $WS_MAXIMIZEBOX+$WS_MINIMIZEBOX+$WS_SIZEBOX)
$cLoad = GUICtrlCreateButton("Load", 6, 496, 60, 25)
$cReDraw = GUICtrlCreateButton("ReDraw", 72, 496, 60, 25)

$ExitButton = GUICtrlCreateButton("Exit", 886, 496, 77, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


;===============GUIListViewEx====================

$cLV_1 = GUICtrlCreateListView("Please load file.", 6, 6, 964, 483, $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
; Create array
Global $aLVArray_1[1][1]


; Initiate ListView - edit on click in call columns - user colours
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 1, 0, True, 2 + 8 + 16 + 32, "*")


_GUIListViewEx_MsgRegister()


GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $ExitButton
            Exit
        Case $cLoad
            $sLoadFile = FileOpenDialog("Choose file", @ScriptDir, "LVS-File (*.lvs)", $FD_FILEMUSTEXIST)
            _GUIListViewEx_LoadListView($iLVIndex_1, $sLoadFile)
        Case $cReDraw
            _GUIListViewEx_BlockReDraw($iLVIndex_1, False)
    EndSwitch
    ; Allow edit on double click
    $aRet = _GUIListViewEx_EditOnClick()
WEnd

 

The lvs-database is attached. Thanks for your awesomesupport.

2016_11_02_22_48_54_colors.lvs

Link to post
Share on other sites
  • Moderators

error471,

I see the problem - in trying to speed up the UDF for you I unfortunately short-circuited one of the existing "tricks" I was using. I had already realised that there was likely to be a problem so I have already coded a solution - when I test it on your file I get the colours loaded without problem. There was another bug which was highlighted in the main UDF thread which I have also fixed. Here are the 2 fixes for short term use:

; This replaces the final lines of the _GUIListViewEx_LoadListView function

    ; Reset colours if required
    If $aGLVEx_Data[$iIndex][18] Then
        ; Load colour
        _GUIListViewEx_LoadColour($iIndex, $aColour)
        If Not @error Then
            ; Force redraw if colour used or single cell selection
            If $aGLVEx_Data[$iIndex][18] Or $aGLVEx_Data[$iIndex][21] Then
                ; Force reload of redraw colour array
                $aGLVEx_Data[0][14] = 0
                ; If Loop No Redraw flag set
                If $aGLVEx_Data[0][15] Then
                    ; Redraw ListView
                    _WinAPI_RedrawWindow($aGLVEx_Data[$iIndex][0])
                EndIf
            EndIf
        EndIf
    EndIf

    Return 1

; This replaces the equivalent lines in the _GUIListViewEx_SetColour function

    ; Check position exists in ListView
    If $iRow < 0 Or $iCol < 0 Or $iRow > UBound($aColArray) - 2 Or $iCol > UBound($aColArray, 2) - 1 Then
        Return SetError(4, 0, 0)
    EndIf
    ; Current colour

But I have been working over the weekend at trying to get "single cell selection" working - you asked for that some time ago - and I think I am very nearly there. I intend running some final tests this evening and I should be able to let you have a copy of the new code tomorrow. Basically you can ask the UDF to only highlight a specific cell rather then the whole row, although this means that you can only ever have a single item selected (which should not be  problem for your project). I have also added a function allowing you to define the colours used to display the selected cell (so that it will stand out from any preset user colours) and any uncoloured cells (at present they are hard coded to black on white).

I hope I have whetted your appetite - please be patient until tomorrow.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

The mentioned loading error belongs to the past now, thank you. Unfortunately the redrawing slowed down the loading process for large databases, as I attached above. In my project I am going to have a treeview linked to several lvs-files for a simple switching from one database to the other. That will be a bit slow. I think I have to be ok with that.

The upcoming improvements sound promising. Can't wait to see them...

Link to post
Share on other sites
  • Moderators

error471,

Quote

That will be a bit slow. I think I have to be ok with that

I fear that may be the case for the size of ListViews you are contemplating/ But remember that using a splash screen or marquee progress will at least let the user know something is happening.

Quote

Can't wait to see them...

I hope you think them worth the wait when you do....

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

error471,

Quote

In my project I am going to have a treeview linked to several lvs-files

I have only just really registered this comment. You might find my ChooseFileFolder UDF of interest - let me know if you need any advice on how to get it properly set up for your requirements.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

ChooseFileFolder UDF seems to be very interesting. I have already created a solution in the past minutes using your ListFiles_ToTreeView function and a function that reads the full path of a treeview item and if exists can be used to save or load the assigned database file.

But nevertheless I have a question concerning the treeview linked to GUIListViewEx:

Actually Load/Save is triggered by clicking their buttons. Is there a way to detect a change in the ListView to trigger a saving? And the other way round: Is there a way to load the related lvs-file when I click a different child-item in the treeview itself? Both functions together would act as autosave and autoload.

Edited by error471
Link to post
Share on other sites
  • Moderators

error471,

As promised, a new version with "single cell selection" - I have modified the colour example from the main UDF to show it in action on both ListViews ($iAdded set + 512) . You will see the new _GUIListViewEx_SetDefColours function to set the required colours - the RH ListView has a fetching pink field and its items have the same coloured background by default. Using the relevant buttons you can reset the colour of selected single cell in the RH ListView to orange or reset it to the standard blue - note the LH ListView is unaffected.

 

Now to the questions you asked:

  • Is there a way to detect a change in the ListView to trigger a saving?

You can detect a change in content post double-click editing using the _GUIListViewEx_EditOnClick function - if there is an array returned then there has been a change and a save can be performed. If you use a context menu to change colour, then you can force a save after having used the menu. If you use a button to trigger the colour change after selecting options from a list then you can call a save at that point.  I have simulated this functionality by adding MsgBox lines to the example script below:

Any other cases where you feel you need to trigger a save?

  • Is there a way to load the related lvs-file when I click a different child-item in the treeview itself?

If the ChooseFileFolder dialog is set for a single return, then double clicking the selected item (or single-clicking and using the select button) will force a return with the path of that item - that would be the trigger for the load:

#include <MsgBoxConstants.au3>

#include "ChooseFileFolder.au3"

Local $sRet, $aRet
Global $sRootFolder = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", Default, -1))
; Register handlers
$sRet = _CFF_RegMsg()
If Not $sRet Then
    MsgBox(16, "Failure!", "Handler not registered")
    Exit
EndIf

; Pick a single *.au3 or *.chm file from within the AutoIt installation folders
; All folders are displayed whether they contain files or not
; Use either the "Select" button or a double click - only files can be selected
; Note that passing a filename highlights that file in the tree
$sRet = _CFF_Choose("Ex 2: Choose a file (default highlight)", 300, 500, -1, -1, $sRootFolder & "autoit.chm", "*.au3;*.chm")
If $sRet Then
    MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "Load", "Selected:" & @CRLF & @CRLF & $sRet)
Else
    MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "Oops", "No Selection")
EndIf

And before you ask, I am not modifying the ChooseFileFolder UDF to allow for single click selection, nor making the buttons optional - you will have to make do with the current behaviour.

M23

Edited by Melba23
Beta code removed

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

error471,

How do you perceive disabling single clicks within the ChooseFileFolder treeview as being "a quick & clean solution"?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

The problem in your suggested solution is (if I understood correctly), that if one accidentaly changes the selected child in the treeview, autosave would overwrite the wrong lvs-file. If only doubleclicks would be able to change the selected item/child within a treeview, there would be no problem. That would be an easy and clean workaround in my eyes. Please correct me if I'm wrong.

Link to post
Share on other sites
  • Moderators

error471,

I do not see it working like that. I would expect the user to decide on a filename for saving or loading by double clicking the treeview in a temporary dialog - all saves would then be to that file until the user changes the selection. As I would expect the saves to be to the same file as was chosen for loading, the filename would be pre-determined - all that would remain to add would be a "Save As" option to allow for a new filename to be used.

Do you see the treeview as being a permanent part of the GUI rather than a dialog?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

I am aware that most users will need a FileOpen- and SaveDialogue. But I want get rid of unnecessary user interaction. In my special case, I need GUIListViewEx to be a permanent part of the GUI. The treeview has 4-5 parents with each 5-6 childs. Every child is directly related to a lvs-file, which means manual loading or saving is not only unnecessary, but also timewasting and a probable source for user errors. A TreeView with disabled singleclick is (just in my case) the best solution I can imagine actually.

Link to post
Share on other sites
  • Moderators

error471,

Quote

In my special case, I need GUIListViewEx to be a permanent part of the GUI

Do you mean you want the TreeView to be part of the GUI? And that as soon as a file is selected it will be loaded into the ListView - while all saves will be to the selected file in the TreeView? If so then I think you are just asking for data corruption. At least a double click is a deliberate action and not a misplaced "open this branch of the tree" click. I would strongly suggest rethinking your strategy here and making the choice of both loading and saving files subject to user confirmation (at least confirming for the first time when saving although it could be automatic after that).

I will see if I can come up with some form of example this afternoon to show you what I mean.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
1 hour ago, Melba23 said:

Do you mean you want the TreeView to be part of the GUI? And that as soon as a file is selected it will be loaded into the ListView - while all saves will be to the selected file in the TreeView? If so then I think you are just asking for data corruption.

Yes, that's what I meant. I was in a hurry when I wrote the last posts. Thank you for translating me. 

In my actual development version of my project I have a load/save button, which is related to the actual selected treeview item, but it is error-prone: If I select a TreeView-item and press load, the correct lvs is loaded. After making some changes and pressing save-button the lvs is saved according to the actual selected TreeView item. So far so good. Here is the problem: If someone accidentally clicks a different TreeView-item while using the program and then presses save, the wrong lvs-file will be overwritten. Therefore I am looking for a solution that eradicates this error. Autosave and autoload are another wish to get rid of manually loading/saving the lvs. I want to keep everything as simple as possible... Your suggestion - manual loading and/but automatic saving - comes very close to that. It will probably be sufficient.

7 hours ago, Melba23 said:

As promised, a new version with "single cell selection" - I have modified the colour example from the main UDF to show it in action on both ListViews ($iAdded set + 512) .

Single cell selection is a very useful improvement. it works fine thank you. I am really afraid to annoy you with my ideas and requests, but may I can ask you if the ListView is capable to have a cell selection as in Excel (see picture)? Please don't get me wrong, this is no request or a wish. Just a question out of curiosity.

cell.png

Link to post
Share on other sites
  • Moderators

error471,

I quite understand your problem - here is my quick and dirty example of how you might structure the load/save code:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Global $aTVItem[7] = [6]

Global $sCurrentLoadFile = "", $sCurrentSaveFile = "", $fSaveCheck = True

$hGUI = GUICreate("Test", 500, 300)
GUISetBkColor(0xC4C4C4)

$cTV = GUICtrlCreateTreeView(10, 10, 230, 250)

; Simulate loading TreeView
Local $cMain = GUICtrlCreateTreeViewItem("Folder A", $cTV)
$aTvItem[1] = GUICtrlCreateTreeViewItem("File A1", $cMain)
$aTvItem[2] = GUICtrlCreateTreeViewItem("File A2", $cMain)
$aTvItem[3] = GUICtrlCreateTreeViewItem("File A3", $cMain)
$cMain = GUICtrlCreateTreeViewItem("Folder B", $cTV)
$aTvItem[4] = GUICtrlCreateTreeViewItem("File B1", $cMain)
$aTvItem[5] = GUICtrlCreateTreeViewItem("File B2", $cMain)
$aTvItem[6] = GUICtrlCreateTreeViewItem("File B3", $cMain)
$cNewFolder = GUICtrlCreateTreeViewItem("Folder New", $cTV)

$cLV = GUICtrlCreateLabel("Simulated ListView", 260, 10, 230, 250)
GUICtrlSetBkColor($cLV, 0xFEFEFE)

$cNew = GUICtrlCreateButton("New Save File", 160, 265, 80, 30)
$cSave = GUICtrlCreateButton("Sim Save", 260, 265, 80, 30)
$cExit = GUICtrlCreateButton("Exit", 410, 265, 80, 30)

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE, $cExit
            Exit

        Case $cSave
            If $fSaveCheck Then
                Switch MsgBox($MB_SYSTEMMODAL + $MB_OKCANCEL, "Saving", "Do you want to save: " & $sCurrentSaveFile)
                    Case $IDOK
                        ConsoleWrite("Saving to: " & $sCurrentSaveFile & @CRLF)
                        $fSaveCheck = False
                    Case $IDCANCEL
                        ContinueCase
                EndSwitch
            Else
                ConsoleWrite("Saving to: " & $sCurrentSaveFile & @CRLF)
            EndIf

        Case $cNew
            $sNewFile = InputBox("New File", "Enter a new file name")
            If $sNewFile Then
                $sCurrentSaveFile = $sNewFile
                Switch MsgBox($MB_SYSTEMMODAL + $MB_OKCANCEL, "Saving", "Do you want to save: " & $sCurrentSaveFile)
                    Case $IDOK
                        ConsoleWrite("Saving to: " & $sCurrentSaveFile & @CRLF)
                        $fSaveCheck = False

                        ReDim $aTvItem[UBound($aTVItem) + 1]
                        $aTVItem[0] += 1
                        $aTvItem[$aTVItem[0]] = GUICtrlCreateTreeViewItem($sNewFile, $cNewFolder)

                EndSwitch
            EndIf

        Case Else
            For $i = 1 To $aTVItem[0]
                If $iMsg = $aTVItem[$i] Then
                    $sSelFile = GUICtrlRead($aTVItem[$i], 1)
                    If MsgBox($MB_SYSTEMMODAL + $MB_OKCANCEL, "Loading", "Do you want to load: " & $sSelFile) = $IDOK Then
                        ; Simulate loading file
                        GUICtrlSetData($cLV, "Now loaded with: " & $sSelFile)
                        $sCurrentLoadFile = $sSelFile
                        $sCurrentSaveFile = $sSelFile
                        $fSaveCheck = True
                        ExitLoop
                    EndIf
                EndIf
            Next
    EndSwitch

WEnd

When you simulate a save by pressing the "Sim Save" button, you will see the file into which you are saving appear in the SciTE console. Loading is as simple as selecting an item in the TreeView - saving is automatically set to that file with a check the first time. The "New Save File" button allows you to save under new name with a similar check the first time. I hope it is clear and reasonably idiot proof - although idiots are very inventive at times!

If you are asking for additional highlights in the column header and the (non-existent) row number then the answer is a very firm "No". However, I did notice with the huge file you posted above that it was difficult to remember which row was which when scrolled to the right - I seem to remember having written a script a while ago which had the first column in a separate ListView with the 2 scrolling together vertically. I will see if I can find and adapt it to this case.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

error471,

Try this with modified version of your "Loader" script one of your big files such as the one you posted earlier:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include "GUIListViewEx_Mod_Cell.au3"

Global $iDeltaY

$Form1 = GUICreate("Example", 970, 554, 192, 124, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX))

$cLoad = GUICtrlCreateButton("Load", 6, 496, 60, 25)
$ExitButton = GUICtrlCreateButton("Exit", 886, 496, 77, 25)

$cLV_1 = GUICtrlCreateListView("Please load file.", 106, 6, 864, 200, $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))

; Initiate ListView - edit on click in call columns - user colours
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 1, 0, True, 2 + 8 + 16 + 32, "*")

_GUIListViewEx_MsgRegister()

GUISetState()

$hGUI_Child = GUICreate("", 100, 200, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
$cLV_Header = GUICtrlCreateListView("Name", 0, 0, 117, 200, $LVS_SINGLESEL)
_GUICtrlListView_SetColumnWidth($cLV_Header, 0, 100)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $ExitButton
            Exit
        Case $cLoad
            $sLoadFile = FileOpenDialog("Choose file", @ScriptDir, "LVS-File (*.lvs)", $FD_FILEMUSTEXIST)
            _GUIListViewEx_LoadListView($iLVIndex_1, $sLoadFile)
            If Not $iDeltaY Then
                Global $aRect = _GUICtrlListView_GetItemRect($cLV_1, 0)
                $iDeltaY = $aRect[3] - $aRect[1]
            EndIf
            _GUICtrlListView_DeleteAllItems($cLV_Header)
            For $i = 0 To _GUICtrlListView_GetItemCount($cLV_1) - 1
                GUICtrlCreateListViewItem(_GUICtrlListView_GetItemText($cLV_1, $i), $cLV_Header)
            Next
    EndSwitch
    ; Allow edit on double click
    $aRet = _GUIListViewEx_EditOnClick()
    ; Follow scroll
    _ScrollFollow()
WEnd

Func _ScrollFollow()
    Local $iLines = _GUICtrlListView_GetTopIndex($cLV_1) - _GUICtrlListView_GetTopIndex($cLV_Header)
    If $iLines Then
        _GUICtrlListView_Scroll($cLV_Header, 0, $iLines * $iDeltaY)
    EndIf
EndFunc

It looks pretty good to me.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
1 hour ago, Melba23 said:

I quite understand your problem - here is my quick and dirty example of how you might structure the load/save code:

This is very interesting. I will implement this into my project.

42 minutes ago, Melba23 said:

Try this with modified version of your "Loader" script one of your big files such as the one you posted earlier:

This a good idea, too, but I think a tooltip showing the column[0][$i] value on mouseover is more elegant. I already tried to implement Zednas and PhoenixXL examples (https://www.autoitscript.com/forum/topic/149251-listviewitems-and-tooltips/) into my project, but I initially failed and worked on totally different problems.

Edited by error471
Link to post
Share on other sites
41 minutes ago, error471 said:

This is very interesting. I will implement this into my project.

More difficult then I thought. The array $aTVItem is the problem. Since I am using ListFiles_ToTreeView() to create the treeview items, the items don't have a variable.

Due to that difficulty I changed my actual save function. Accidental overwriting is not possible anymore. In fact, I can live with that solution, although your example script is a bit more userfriendly.

Link to post
Share on other sites
  • Moderators

error471,

Quote

 I think a tooltip showing the column[0][$i] value on mouseover is more elegant

How about if you get the value on a single click? I have modified the _GUIListViewEx_ToolTipInit function to show either the current cell contents (designed for columns that are too narrow to display all content) or the 0 cell. Try this new UDF with this example:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include "GUIListViewEx_Mod_Cell.au3"

$Form1 = GUICreate("Example", 970, 554, 192, 124, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX))

$cLoad = GUICtrlCreateButton("Load", 6, 496, 60, 25)
$ExitButton = GUICtrlCreateButton("Exit", 886, 496, 77, 25)

$cLV_1 = GUICtrlCreateListView("Please load file.", 6, 6, 964, 200, $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))

; Initiate ListView - edit on click in call columns - user colours
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, "", 1, 0, True, 2 + 8 + 16 + 32, "*")

 _GUIListViewEx_ToolTipInit($iLVIndex_1, "*", 1000, 2) ; Mode 2 = show first cell <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

_GUIListViewEx_MsgRegister()

GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $ExitButton
            Exit
        Case $cLoad
            $sLoadFile = FileOpenDialog("Choose file", @ScriptDir, "LVS-File (*.lvs)", $FD_FILEMUSTEXIST)
            _GUIListViewEx_LoadListView($iLVIndex_1, $sLoadFile)
    EndSwitch
    ; Allow edit on double click
    $aRet = _GUIListViewEx_EditOnClick()
    ; Show tooltips
    _GUIListViewEx_ToolTipShow() ; Add this to the idle loop <<<<<<<<<<<<<<<<<<<<
WEnd

And here is the modified UDF: 

Let me know what you think.

M23

Edited by Melba23
Beta code removed

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...