Jump to content

Help on GUICtrllistview


Syed23
 Share

Recommended Posts

Here is my another question. i wanted to create a GUICreatectrllistview with editable option where i can edit the data. i hope if i understand correctly we can do with this style"$LVS_EDITLABELS" but i don't know i was unable to edit the shells? :graduated: am i doing any mistake ?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListviewConstants.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
 Local $listview, $button, $item1, $item2, $item3, $input1, $msg
 GUICreate("listview items", 220, 250, 100, 200, -1, $LVS_EDITLABELS)
 GUISetBkColor(0x00E0FFFF)  ; will change background color
 $listview = GUICtrlCreateListView("col1  |col2|col3  ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
 $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
 $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview)
 $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
 $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
 $input1 = GUICtrlCreateInput("", 20, 200, 150)
 GUICtrlSetState(-1, $GUI_DROPACCEPTED)   ; to allow drag and dropping
 GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
 GUISetState()
 GUICtrlSetData($item2, "ITEM1")
 GUICtrlSetData($item3, "||COL33")
 GUICtrlDelete($item1)
 Do
  $msg = GUIGetMsg()
  Select
   Case $msg = $button
    MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
   Case $msg = $listview
    MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
  EndSelect
 Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

May be am i missing something ?

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Take a look at this thread. or perhaps this if you want something more complicated. ;)

Come back if you still have difficulties. :graduated:

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 comment
Share on other sites

why the below example is not working? i know i am doing the mistake but failing to find .. :graduated:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
; Set flag to indicate double click in ListView
Global $fDblClk = False
$GUI = GUICreate(" Administrator", 580, 600, -1, -1) ; trying the make the GUI to appear on the center of the monitor
GUISetBkColor(0x00E0FFFF)
$Show = GUICtrlCreateButton("Edit", 460, 240, 90, 60)
$Exit = GUICtrlCreateButton("Exit", 460, 460, 90, 60)
$ListView = GUICtrlCreateListView("S.NO|MAchine Account|Platofrm|Operating System|Space Allocated", 5, 10, 430, 580)
GUICtrlCreateListViewItem("TEST|TEST1",-1)
_GUICtrlListView_SetColumnWidth($ListView, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView, 1, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($ListView, 2, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($ListView, 3, $LVSCW_AUTOSIZE_USEHEADER)
  _GUICtrlListView_SetColumnWidth($ListView, 4, $LVSCW_AUTOSIZE_USEHEADER)
GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
$GUIshow = GUISetState()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
Do
    $msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Or $msg = $Exit Then
  Exit
EndIf
   If $fDblClk Then
        $fDblClk = False
        If Not IsHWnd($ListView) Then $ListView = GUICtrlGetHandle($ListView)
        $iSelected = _GUICtrlListView_GetSelectedIndices($ListView)
        If $iSelected <> "" Then _GUICtrlListView_EditLabel($ListView, $iSelected)
    EndIf
 
 
Until $msg = $GUI_EVENT_CLOSE
 
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $ListView
    If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView)
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_DBLCLK
                    $fDblClk = True
                Case $LVN_BEGINLABELEDITW
                    Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
                    Return False
                Case $LVN_ENDLABELEDITW
                    Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
                    Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", _
                        DllStructGetData($tInfo, "Text"))
                    Local $sNewText = DllStructGetData($tBuffer, "Text")
                    If StringLen($sNewText) Then Return True
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Note:

will be able to edit the blank shells as well ?

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Do not get discouraged - this not easy stuff to understand. :)

Here is a modified script which does work and lets you edit any of the items in a row: :graduated:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Constants.au3>
#Include <GuiEdit.au3>

Global $fDblClk = False, $hEdit, $hDC, $hBrush, $aHit

$GUI = GUICreate(" Administrator", 580, 600, -1, -1) ; trying the make the GUI to appear on the center of the monitor
GUISetBkColor(0x00E0FFFF)

$Show = GUICtrlCreateButton("Edit", 460, 240, 90, 60)
$Exit = GUICtrlCreateButton("Exit", 460, 460, 90, 60)
$ListView = _GUICtrlListView_Create($GUI, "S.NO|MAchine Account|Platofrm|Operating System|Space Allocated", 5, 10, 430, 580)
$iIndex = _GUICtrlListView_AddItem($ListView, "TEST")
_GUICtrlListView_AddSubItem($ListView, $iIndex, "TEST1", 1)

_GUICtrlListView_SetColumnWidth($ListView, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView, 1, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($ListView, 2, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($ListView, 3, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($ListView, 4, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetExtendedListViewStyle($ListView, $LVS_EX_GRIDLINES)

$GUIshow = GUISetState()

GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")                       ; For doubleclick on ListView
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")                     ; For end of ListView edit

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $Exit
            Exit
    EndSwitch

    ; If a ListView was double clicked
    If $fDblClk Then
        $aHit = _GUICtrlListView_SubItemHitTest($ListView)
        If $aHit[0] <> -1 Then
            _Start_ItemEdit()
        EndIf
        $fDblClk = False
    EndIf

WEnd

Func _Start_ItemEdit()

    ; Prevent resizing of columns
    ControlDisable($GUI, "", HWnd(_GUICtrlListView_GetHeader($ListView)))
    ; Get current text
    $sItemOrgText = _GUICtrlListView_GetItemText($ListView, $aHit[0], $aHit[1])
    ; Get size of edit box
    Local $aRect = _GUICtrlListView_GetSubItemRect($ListView, $aHit[0], $aHit[1])
    Local $iEdit_Width = _GUICtrlListView_GetColumnWidth($ListView, $aHit[1]) - 7
    Local $iEdit_Height = $aRect[3] - $aRect[1]
    ; Get position of ListView within client area
    Local $aPos = WinGetPos($ListView)
    Local $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData($tPoint, "X", $aPos[0])
    DllStructSetData($tPoint, "Y", $aPos[1])
    _WinAPI_ScreenToClient($GUI, $tPoint)
    Local $iEdit_X = DllStructGetData($tPoint, "X") + $aRect[0] + 6
    Local $iEdit_Y = DllStructGetData($tPoint, "Y") + $aRect[1]
    ; Create ListView edit control - credit to smashly for this code
    $hEdit = _GUICtrlEdit_Create($GUI, $sItemOrgText, $iEdit_X, $iEdit_Y, $iEdit_Width, $iEdit_Height, BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT))
    _GUICtrlEdit_SetSel($hEdit, 0, -1)
    _WinAPI_SetFocus($hEdit)
    ; Prevent overwrite of edit rectangle
    $hDC = _WinAPI_GetWindowDC($hEdit)
    $hBrush = _WinAPI_CreateSolidBrush(0)
    Local $stRect = DllStructCreate("int;int;int;int")
    DllStructSetData($stRect, 1, $iEdit_Width)
    DllStructSetData($stRect, 2, 0)
    DllStructSetData($stRect, 3, 0)
    DllStructSetData($stRect, 4, $iEdit_Height)
    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
    ; Set HotKey to close edit
    HotKeySet("{ENTER}", "_End_SubItemEdit")

EndFunc

Func _End_SubItemEdit()

    $sItemNewText = _GUICtrlEdit_GetText($hEdit)
    _GUICtrlListView_SetItemText($ListView, $aHit[0], $sItemNewText, $aHit[1])
    ; Free edit rectangle
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC($hEdit, $hDC)
    _WinAPI_DestroyWindow($hEdit)
    ; Clear HotKey
    HotKeySet("{ENTER}")
    ; Re-enable resizing of columns
    ControlEnable($GUI, "", HWnd(_GUICtrlListView_GetHeader($ListView)))

EndFunc

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")
    ; Check if a ListView has sent the message
    If $hWndFrom = $ListView Then
        Switch $iCode
            Case $NM_DBLCLK
                ; Set flag
                $fDblClk = True
        EndSwitch
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc

Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)

    #forceref $hWnd, $Msg, $wParam

    Local $iCode = BitShift($wParam, 16)
    Switch $lParam
        Case $hEdit
            Switch $iCode
                Case $EN_KILLFOCUS
                    _End_SubItemEdit()
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Look through it and try to understand it - you know you can ask questions if you need to. ;)

will be able to edit the blank shells as well?

No, you can only edit existing items as you need to click on them to start the edit process. Just add additional empty rows if you need them. ;)

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 comment
Share on other sites

Hi Melba23,

I have one quick question on ListViewitem. I have created hyperlink on ListViewItem. i am able to delete the hyperlink which is created as last entry.. but i wanted to delete all the hyperlinks what i have created in that column. For that i need to get the count how many shells have entered with hyperlink and then i need to delete that. could you please help me to get the count? how to delete that particular shell ?

Here is the screenshot how it will look like

Edited: IF you want i will upload my sample script!

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Dog eaten your Help file? ;)

If you have a hyperlink in each row then you just need to count the rows:

_GUICtrlListView_GetItemCount

And to delete an item:

_GUICtrlListView_DeleteItem

You can find these functions as easily as I can - spend some time looking before asking uestions. :graduated:

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 comment
Share on other sites

I thought i will get this reply. :graduated: sorry for not updated that i have given all the try with that? i have tried the _GUICtrlListView_DeleteAllItems($ListView) and i thought it will delete the entire data of the Listview but it is unable to delete the Hyperlinks column... thats why i posted..

Note:

This Hyperlinks created with MrCreatoR's _ListViewSysLink UDF.. in that he is using the below function to create the hyperlink...

Func _GUICtrlListView_SysLinkCreate($hWnd, $sTitle, $sLink, $iItemIndex, $iSubItemIndex=0, $sLnkID="", $iFillItemText=1)
If $hWnd = -1 Then $hWnd = $hLastSysLink
If $iFillItemText = 1 Then _GUICtrlListView_SetItemText($hWnd, $iItemIndex, $sTitle, $iSubItemIndex)
;Local $nBkColor = _WinAPI_GetSysColor($COLOR_3DFACE)
;GUICtrlSetBkColor($hWnd, $nBkColor)
If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
Local $aRect = _GUICtrlListView_GetSubItemRect($hWnd, $iItemIndex, $iSubItemIndex)
If $iSetFirstSubItem And $iSubItemIndex = 0 Then $aRect = _GUICtrlListView_GetItemRect($hWnd, $iItemIndex, 2)
Local $sTextFormat = StringFormat('<a href="%s" ID="%s">%s</a>', $sLink, $sLnkID, $sTitle)
    $aSysLink[0][0] += 1
    ReDim $aSysLink[$aSysLink[0][0] + 1][4]
$aSysLink[$aSysLink[0][0]][0] = _WinAPI_CreateWindowEx($WS_EX_TOPMOST, $WC_LINK, $sTextFormat, _
  BitOR($WS_POPUP, $WS_VISIBLE, $WS_CHILD), $aRect[0], $aRect[1], $aRect[2] - $aRect[0], $aRect[3] - $aRect[1], $hWnd)
DllCall("user32.dll", "int", "SetParent", "hwnd", $aSysLink[$aSysLink[0][0]][0], "hwnd", $hWnd)
_GUICtrlListView_SysLinkSetLinkInfo($aSysLink[$aSysLink[0][0]][0], $sLink, $sLnkID)
    $aSysLink[$aSysLink[0][0]][1] = $iItemIndex
    $aSysLink[$aSysLink[0][0]][2] = $iSubItemIndex
    $aSysLink[$aSysLink[0][0]][3] = $hWnd
$hLastSysLink = $aSysLink[$aSysLink[0][0]][0]
    Return $hLastSysLink
EndFunc

What i am thinking is the issue may be because of the function _WinAPI_CreateWindowEx to create ?

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

If you're using a NON-UDF created list view (ex. GUICtrlCreateListView instead of _GUICtrlListView_Create) you will need to pass the handle of the listview to _GUICtrlListView_DeleteAllItems and not the Control ID. Use $hListview = GUICtrlGetHandle ( $ListView), and call _GUICtrlListView_DeleteAllItems($hListView), otherwise you won't be able to delete the items in the listview correctly.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

Syed23,

This Hyperlinks created with MrCreatoR's _ListViewSysLink UDF

Then I suggest you ask him how to delete them. :graduated:

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 comment
Share on other sites

i started working with him already.. But i am waiting for his reply.. in the mean while i thought if i get any idea triggered out from any of the you experts so i can help him or bring down his difficulty thats all :graduated:

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Did you by any chance look at the _ListView_SysLink UDF before you used it? There's a _GUICtrlListView_ItemLinkDelete($hWnd) function in there that would probably do what you're looking to do.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

No it did not! The one _GUICtrlListView_ItemLinkDelete your telling was in Test version he changed the naming convention as _GUICtrlListView_SysLinkDelete in his updated release. That function deletes only the last entry which get creates. thats the reason i am trying to find solution

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

You can send the function the handle of previously created syslinks in your listview, it only DEFAULTS to the last one created. You'd need to keep track of all of the syslinks you've created, an array would be the best for this, and then loop through the array to delete them from the Listview.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi Friends,

Thanks for all your help:) i have fixed the issue! i passed all the controlID to an array and i used _WinAPI_DestroyWindow function to delete the hyperliks since he used _WinAPI_CreateWindowEx to create the hyperlink. so this helped to clear the hyperlinks :graduated:

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Hi Melba23,

In post#25 you have provided one example script rite? i added that in my code it is not working :graduated:. if i run the example alone it works fine but it is not working if i added it with my code any suggestion?

Func admin()
GUIDelete($GUI)
$GUI = GUICreate($Title&"- Administrator", 580, 600, -1, -1) ; trying the make the GUI to appear on the center of the monitor
GUISetBkColor(0x00E0FFFF)
$Show = GUICtrlCreateButton("Edit", 460, 240, 90, 60)
$Exit = GUICtrlCreateButton("Exit", 460, 460, 90, 60)
$ListView = GUICtrlCreateListView("S.NO|MAchine Account|Platofrm|Operating System|Space Allocated", 5, 10, 430, 580)
_GUICtrlListView_SetColumnWidth($ListView, 0, 50)
 _GUICtrlListView_SetColumnWidth($ListView, 1, $LVSCW_AUTOSIZE_USEHEADER)
 _GUICtrlListView_SetColumnWidth($ListView, 2, $LVSCW_AUTOSIZE_USEHEADER)
 _GUICtrlListView_SetColumnWidth($ListView, 3, $LVSCW_AUTOSIZE_USEHEADER)
  _GUICtrlListView_SetColumnWidth($ListView, 4, $LVSCW_AUTOSIZE_USEHEADER)
GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
Call("show")
$GUIshow = GUISetState()
If $GUIshow <> 0 Then
_FileWriteLog($Log,"INFO > Production Bug Tracker >" & $Title &" prompted to the user")
Else
 _FileWriteLog($Log,"ERROR > Production Bug Tracker >" & $Title &" was unable to show. Error occured = " [email="&@error"]&@error[/email])
EndIf
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")                       ; For doubleclick on ListView
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")                   ; For end of ListView edit

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $Exit
            Exit
    EndSwitch
    ; If a ListView was double clicked
    If $fDblClk Then
        $aHit = _GUICtrlListView_SubItemHitTest($ListView)
  If $aHit[0] <> -1 Then
            _Start_ItemEdit()
        EndIf
        $fDblClk = False
    EndIf
WEnd
EndFunc
Func _Start_ItemEdit()
    ; Prevent resizing of columns
    ControlDisable($GUI, "", HWnd(_GUICtrlListView_GetHeader($ListView)))
    ; Get current text
    $sItemOrgText = _GUICtrlListView_GetItemText($ListView, $aHit[0], $aHit[1])
    ; Get size of edit box
    Local $aRect = _GUICtrlListView_GetSubItemRect($ListView, $aHit[0], $aHit[1])
    Local $iEdit_Width = _GUICtrlListView_GetColumnWidth($ListView, $aHit[1]) - 7
    Local $iEdit_Height = $aRect[3] - $aRect[1]
    ; Get position of ListView within client area
    Local $aPos = WinGetPos($ListView)
    Local $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData($tPoint, "X", $aPos[0])
    DllStructSetData($tPoint, "Y", $aPos[1])
    _WinAPI_ScreenToClient($GUI, $tPoint)
    Local $iEdit_X = DllStructGetData($tPoint, "X") + $aRect[0] + 6
    Local $iEdit_Y = DllStructGetData($tPoint, "Y") + $aRect[1]
    ; Create ListView edit control - credit to smashly for this code
    $hEdit = _GUICtrlEdit_Create($GUI, $sItemOrgText, $iEdit_X, $iEdit_Y, $iEdit_Width, $iEdit_Height, BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT))
    _GUICtrlEdit_SetSel($hEdit, 0, -1)
    _WinAPI_SetFocus($hEdit)
    ; Prevent overwrite of edit rectangle
    $hDC = _WinAPI_GetWindowDC($hEdit)
    $hBrush = _WinAPI_CreateSolidBrush(0)
    Local $stRect = DllStructCreate("int;int;int;int")
    DllStructSetData($stRect, 1, $iEdit_Width)
    DllStructSetData($stRect, 2, 0)
    DllStructSetData($stRect, 3, 0)
    DllStructSetData($stRect, 4, $iEdit_Height)
    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
    ; Set HotKey to close edit
    HotKeySet("{ENTER}", "_End_SubItemEdit")
EndFunc
Func _End_SubItemEdit()
    $sItemNewText = _GUICtrlEdit_GetText($hEdit)
    _GUICtrlListView_SetItemText($ListView, $aHit[0], $sItemNewText, $aHit[1])
    ; Free edit rectangle
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC($hEdit, $hDC)
    _WinAPI_DestroyWindow($hEdit)
    ; Clear HotKey
    HotKeySet("{ENTER}")
    ; Re-enable resizing of columns
    ControlEnable($GUI, "", HWnd(_GUICtrlListView_GetHeader($ListView)))
EndFunc
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")
    ; Check if a ListView has sent the message
    If $hWndFrom = $ListView Then
        Switch $iCode
            Case $NM_CLICK
                ; Set flag
                $fDblClk = True
        EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc
Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam
    Local $iCode = BitShift($wParam, 16)
    Switch $lParam
        Case $hEdit
            Switch $iCode
                Case $EN_KILLFOCUS
                    _End_SubItemEdit()
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Note:

The Function "admin" will be called from my some other function...

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Come on, use your head - "it is not working" is not a lot of help. :graduated:

What error messages do you get? :)

For a start: you are missing the include files, the Global variable declarations and there is an extraneous EndFunc in there. ;)

Perhaps if you used Tidy and Au3Check to confirm that you had a working script before posting you might begin to find some of these things out for yourself. ;)

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 comment
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
 Share

  • Recently Browsing   0 members

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