Jump to content

Recommended Posts

Posted

Well, since you asked:

  • Ability to color or otherwise format the text in individual cells (I think I read somewhere you said you weren't going to do that, and I respect that)
  • Any way to put checkboxes arbitrarily in a column instead of just the beginning of the row (somehow I think that's out of the scope of this UDF though)
  • Any way to "check all", "uncheck all" and "invert" checked status of all rows' checkboxes (user can do this themselves, but it might be neater from within the UDF?)

But really, no.  It serves my purposes as-is.

Posted (edited)

WORKS PERFECTLY!

 

Err... maybe there is a small flaw.

I ran into a problem with my code whereby if I was trying to edit the VERY LAST cell (ie. bottom row, right-most column) I got an error.  I then went with the basic example you provided with the beta and changed the code to change your "subitem 4-1" and I got the error again.

Edited by LondonNDIB
  • Moderators
Posted (edited)

LondonNDIB,

Not the correct solution - as the internal array stored by the UDF adds a count in the [0][0] element, I need to add 1 to the specified row in line 1126. It helps knowing how the UDF works! :P

In fact the example I posted shows the problem and I should have seen it earlier - we ask to change 3-1 and in fact it is 2-1 that is changed. :blush:

Try this version:

<snip>

and this example:

#include <GUIConstantsEx.au3>

#include "GUIListViewEx_Mod.au3"

Opt("MouseCoordMode", 0) ; Just to show that this still works

$hGUI = GUICreate("Test", 500, 500)

$cLV = GUICtrlCreateListView("Col 1         |Col 2         ", 10, 10, 480, 300)
;_GUICtrlListView_SetExtendedListViewStyle($cLV, BitOr($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))
For $i = 0 To 4
    GUICtrlCreateListViewItem("Item " & $i & "|SubItem " & $i & "-1", $cLV)
Next
; Read content
$aArray = _GUIListViewEx_ReadToArray($cLV)
; Initiate ListView
$iLVIndex = _GUIListViewEx_Init($cLV, $aArray, 0, Default, 0, 2)

$cButton_1 = GUICtrlCreateButton("Change Data", 10, 350, 80, 30)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            $aArray = _GUIListViewEx_ReturnArray($iLVIndex)
            _ArrayDisplay($aArray, "Original", Default, 8)
            $aArray = _GUIListViewEx_ChangeItem($iLVIndex, 2, 0, "New 2-0")
            $aArray = _GUIListViewEx_ChangeItem($iLVIndex, 4, 1, "New 4-1")
            _ArrayDisplay($aArray, "Changed", Default, 8)
    EndSwitch
WEnd
M23

Edit:

I have just seen your wish list - I am afraid they are all outside the scope of this UDF, which is quite complicated enough already. Sorry. :(>

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

 

Posted

No, I didn't suspect it would be the correct solution.  Just a hack to get me by.

Your fix fixed it (of course), ty!

Re: wishlist... can't blame a guy for trying, right?

Posted (edited)

Ok, me again (won't this guy go away?).

With this new change function... any chance it can also work with the checkboxes?  Ie. programically check/uncheck?

Perhaps adding a  

$iCheck = 0

 parameter in the function call.  $iCol would be ignored, of course.  Then just check the status of $aCheck_Array at that row and invert it (or, if you want, have a "set" "unset" and "invert" as the possible values of $vValue).  Sounds easy to me but I've already proven how little I know!

Edited by LondonNDIB
  • Moderators
Posted

LondonNDIB,

Just use the existing _GUICtrlListView_SetItemChecked function - no need for the UDF to do anything. ;)

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

 

Posted (edited)

Right, sure... if you want to be all SIMPLE about it :)   (lol, sometimes I forget the basics).

 

 

Although...  hmm... now I notice that the the _GUIListViewEx_ChangeItem function destroys check selections.  Can they be preserved?

 

 

edit:

 

Would this be right? Found this line:

Local $aCheck_Array[UBound($aData_Array)]
and add to it like so:

 

Local $aCheck_Array[UBound($aData_Array)]
        For $i = 1 To UBound($aCheck_Array) - 1
        $aCheck_Array[$i] = _GUICtrlListView_GetItemChecked($hGLVEx_SrcHandle, $i - 1)
    Next
Edited by LondonNDIB
  • Moderators
Posted (edited)

LondonNDIB,

Some people are never satisfied - working on it... ;)

M23

Edit:

Try this function:

Func _GUIListViewEx_ChangeItem($iLV_Index, $iRow, $iCol, $vValue)

    ; Activate the ListView
    _GUIListViewEx_SetActive($iLV_Index)
    If @error Then
        Return SetError(1, 0, "")
    EndIf
    ; Check ListView is editable
    If $aGLVEx_Data[$iLV_Index][7] = "" Then
        Return SetError(2, 0, "")
    EndIf
    ; Check row and col values
    Local $iMax = _GUICtrlListView_GetItemCount($hGLVEx_SrcHandle)
    If $iRow < 0 Or $iRow > $iMax - 1 Then
        Return SetError(3, 0, "")
    EndIf
    $iMax = _GUICtrlListView_GetColumnCount($hGLVEx_SrcHandle)
    If $iCol < 0 Or $iCol > $iMax - 1 Then
        Return SetError(4, 0, "")
    EndIf
    ; Load array
    Local $aData_Array = $aGLVEx_Data[$iLV_Index][2]
    ; Create checkbox array
    Local $aCheck_Array = _GUIListViewEx_ReturnArray($iLV_Index, 1)
    If Not BitAnd($aGLVEx_Data[$iLV_Index][3], 1) Then
        _ArrayInsert($aCheck_Array, 0, $aData_Array[0][0])
    EndIf
    ; Change item in array
    $aData_Array[$iRow + 1][$iCol] = $vValue
    ; Store modified array
    $aGLVEx_Data[$iLV_Index][2] = $aData_Array
    ; Rewrite ListView
    _GUIListViewEx_ReWriteLV($hGLVEx_SrcHandle, $aData_Array, $aCheck_Array, $iLV_Index)
    ; Return changed array
    Return _GUIListViewEx_ReturnArray($iLV_Index)

EndFunc   ;==>_GUIListViewEx_ChangeItem
Edited by Melba23

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

 

Posted

Should this code in the UDF inside function _GUIListViewEx_EditHeader...

; Check ListView is editable
If $aGLVEx_Data[$iLV_Index][7] = "" Then
    Return SetError(2, 0, $aRet)
EndIf

...be the following to allow header edits to be blocked?

; Check ListView is editable
If $aGLVEx_Data[$iLV_Index][7] = "" or $aGLVEx_Data[$iLV_Index][8] = "" Then 
    Return SetError(2, 0, $aRet)
EndIf

I noticed that passing values to _GUIListViewEx_Init that didn't contain 8 still allowed headers to be edited and this seems to have fixed it for me.

  • Moderators
Posted

EpsilonZero,

It is just a simple typo - it should read $aGLVEx_Data[$iLV_Index][8] - thanks for the report, I will fix it in the release coming soon. :thumbsup:

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

 

Posted

I have a need for using both edit boxes and combo boxes, but didn't see a way to do it (it may just be me). 

With small modifications in _GUIListViewEx_EditProcess, I got it working for me:

I changed this...

; And then for this column
Local $sCombo_Data = $aComboData_Array[$aLocation[1]]
If $sCombo_Data Then

to this...

; And then for this column
Local $sCombo_Data = $aComboData_Array[$aLocation[1]]
If $sCombo_Data and $sCombo_Data<>'|' Then

and this...

Else
    ; No combo data available
    Return

to this...

Else
    ; No combo data available
    ;Return

I also duplicated the mouse movements from

; Create temporary combo - get handle, set font size, give keyboard focus
...
Local $aMPos = MouseGetPos()
MouseMove($aMPos[0], $aMPos[1] + 20, 0)
Sleep(10)
MouseMove($aMPos[0], $aMPos[1], 0)

...under the following Else to make the edit box outline appear.

Now, I just call _GUIListViewEx_Init with 32 in $iAdded always and call _GUIListViewEx_ComboData with an empty string for $vData for columns that I want to use as an edit box.  I don't know if anyone else will find this useful or if I just didn't pay enough attention to get this working without changing things.

  • Moderators
Posted (edited)

EpsilonZero,

At first glance I can see a possible problem with that, but let me take a look at how both edits and combos might be available at the same time. No promises, mind. ;)

M23

Edited by Melba23
Typo

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

 

  • Moderators
Posted (edited)

EpsilonZero,

I have implemented your "edit & combo" idea slightly differently. Setting the ListView "$iAdded" parameter to editable (2) will give you an edit on doubleclick unless you have set that column to use combos via a _GUIListViewEx_ComboData call. Now the whole thing is automatic and there is no need for a specific "combo" flag. ;)

Please test this Beta version and let me know if it works for you:

<snip>

Comments from others also welcome as always. :)

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

 

Posted

The change works great and is intuitive.  :thumbsup: 

I had to add in the mouse movement to make the line edge of the edit box appear.  I don't know if that is just XP or just me. 

One other change I made was commenting out one line at the end of  _GUIListViewEx_EditProcess.

ReDim $aEdited[$aEdited[0][0] + 1][2]

I use the column that is being truncated to restore the original entry value if the new entry doesn't meet requirements (e.g. syntax).

Thanks for the updates!

  • Moderators
Posted (edited)

EpsilonZero,

Glad you like it - and thanks for the idea. :)

 

I don't know if that is just XP or just me

I get the edit box to appear without the mouse movement - and no-one else has ever mentioned it - so I think it is just you. :P

 

to restore the original entry value if the new entry doesn't meet requirements

Have you looked at the change I made in response to LondonNDIB's >feature request above? He wanted to do much the same thing, so I provided a function (_GUIListViewEx_ChangeItem) which can programatically change the ListView content. His idea was to look at the content before edit and then replace the original after edit if there was a syntax problem. Doing the same sort of thing would prevent you having to modify the actual UDF - which is always a bit delicate. ;)

M23

Edited by Melba23
Typo

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

 

  • Moderators
Posted (edited)

EpsilonZero,

After looking more closely at your final suggestion I think it is an excellent one and I will expand on it by returning both the original and modified item values in that array - that way syntax checking will be really easy. :thumbsup:

M23

Edit: And done (for header edits also). :)

<snip>

Edited by Melba23
Removed Beta code

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

 

Posted

The new changes work as advertised.  :thumbsup:

I don't know what is causing my edit box drawing issue, but that's the only thing I have modified now aside from adding on per-line colorization of the listviews, though I will need to add a date input in addition to the existing edit and combo boxes in the near future. 

Thanks again!

  • Moderators
Posted (edited)

[NEW VERSION] - 7 Jan 14

Added: New function (_GUIListViewEx_ChangeItem) to allow ListView items to be changed programmatically.

Changed:

- No requirement to initialise combos when editing - using _GUIListViewEx_ComboData forces the defined column to use combos.

- Return arrays after item or header edit now contain both original and new content to allow for checking and possible replacement (using the new function ;))

Fixed: UDF will now run correctly regardless of whatever MouseCoordMode is set.

Thanks to LondonNDIB and EpsilonZero for the reports/suggestions. :thumbsup:

New UDF in first post. :)

M23

Edited by Melba23
Fixed BB codes

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

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...