Jump to content

Example script (look at screen)


Recommended Posts

  • Moderators

ZwinnyRolnik,

Your script is progressing nicely - well done. :idea:

I cannot help much more - I have reached the outer limits of my knowledge of ListViews. But I have found a couple of things for you to experiment with:

- Here is a very good UDF for colouring elements in ListViews.

- It seems multiline ListViews are not possible - but here is a workaround using ToolTips.

I hope these help you progress. :)

M23

Edit: added another topic.

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

 

Link to comment
Share on other sites

Heh :idea:

not good :) can sb help me join my script to that script from here

It's too hard for me =[ i need combo box in listview and i don't know how connect first and second script.

It's first(my)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <GUIScrollbars_Ex.au3>
#include <LV_Format_include.au3>
#include <FontConstants.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>
Global $fDblClk = False, $iItem, $iSubItem, $iGUI_Height = 500

Global $wartosc[100][100]

; 1 column
For $i = 1 To 99
    $wartosc[0][$i] = $i
Next


; 2 column
$wartosc[0][0] = ""
$wartosc[1][0] = "A"
$wartosc[1][1] = "Koszty"
$wartosc[1][2] = "Bezposrednie"
$wartosc[1][3] = "Zadanie nr 1 Zarzadzanie Projektem"
$wartosc[1][4] = "Przygotowanie materialów promocyjnych (projekt, druk) - plakaty informacyjne"
$wartosc[1][5] = "Przygotowanie materialów promocyjnych (projekt,druk) - foldery informacyjne"
$wartosc[1][6] = "Wykonanie strony internetowej projektu"
$wartosc[1][7] = "Zakup materiałów promocyjnych - ramy na plakaty"
$wartosc[1][8] = "Wynagrodzenie administratora strony www projektu (os. samozatrudniona)e"
$wartosc[1][9] = "Wynagrodzenie specjalistów ds. rekrutacji (osoby samozatrudnione); 3 dni/rekrutację x 32 rekrutacje"
$wartosc[1][10] = "Koszty podróży specjalistów ds. rekrutacji; 32 rekrutacje"
$wartosc[1][11] = "Noclegi specjalistów ds. rekrutacji; 3noclegów/rekrutację x 32 rekrutacje"
$wartosc[1][12] = "Wykonanaie nakelejek na segregatory"
$wartosc[1][13] = "Zakup materiałów promocyjnych - roll-up'y"
$wartosc[1][14] = "Wyżywienie specjalistów ds. rekrutacji; 3 dni/rekrutację x 32 rekrutacje"
$wartosc[1][15] = "Wynagrodzenie kierownika projektu (osoba samozatrudniona)"
$wartosc[1][16] = "Wynagrodzenie specjalisty ds. formalnych (umowa zlecenie)"
$wartosc[1][17] = "Wynagrodzenie specjalisty ds. organizacji (os.samozatrudniona)"
$wartosc[1][18] = "Koszty podróży specjalisty ds. organizacyjnych; 1 wizyta/województwo x 16 województw"
$wartosc[1][19] = "Noclegi specjalisty ds. organizacyjnych; 1 nocleg/wizytę x 16 wizyt"
$wartosc[1][20] = "Wyżywienie specjalisty ds. organizacyjnych; 1 dzień/wizytę x 16 wizyt"
$wartosc[1][21] = "Koszty 2 rachunków bankowych (dofinansowania i wkłądu prywatnego)"
$wartosc[1][22] = "Audyt projektu"
$wartosc[1][23] = "Zadanie nr 2 Realizacja szkoleń - Menedżerowie sieci"
$wartosc[1][24] = "Zakup usług szkoleniowych - Centrala; 2 dni/zjazd x 3 zjazdy/grupę x 1 grupa"
$wartosc[1][25] = "Wynagrodzenie opiekunów szkoleń (osoby samozatrudnione); 2 dni/zjazd x 3 zjazdy/grupę x 1 grupa"
$wartosc[1][26] = "Noclegi opiekunów szkoleń; 2 noclegi/zjazd x 3 zjazdy"
$wartosc[1][27] = "Wyżywienie opiekunów szkoleń; 2 dni/zjazd x 3 zjazdy"
$wartosc[1][28] = "Przewóz uczestników i opiekuna szkoleń; 1 przewóz/zjazd x 3 zjazdy"
$wartosc[1][29] = "Koszt wynajmu sal szkoleniowych; 2 dni/zjazd x 3 zjazdy"
$wartosc[1][30] = "Wyżywienie uczestników szkoleń; 2 dni/zjazd x 3 zjazdy/grupę x 1 grupa x 10 osób/grupę"
$wartosc[1][31] = "Noclegi uczestników szkoleń; 1 nocleg/zjazd x 3 zjazdy/grupę x 1 grupa x 10 osób/grupę"
$wartosc[1][32] = "Zadanie nr 3 Realizacja szkoleń - Trenerzy wewnętrzni"
$wartosc[1][33] = "Zakup usług szkoleniowych - warsztaty trenerskie; 2 dni/zjazd x 3 zjazdy/grupę x 1 grupa"
$wartosc[1][34] = "Wynagrodzenie opiekunów szkoleń (osoby samozatrudnione); 2 dni/zjazd x 3 zjazdy/grupę x 1 grupa"
$wartosc[1][35] = "Noclegi opiekunów szkoleń; 2 noclegi/zjazd x 3 zjazdy"
$wartosc[1][36] = "Wyżywienie opiekunów szkoleń; 2 dni/zjazd x 3 zjazdy"
$wartosc[1][37] = "Przewóz uczestników i opiekuna szkoleń; 1 przewóz/zjazd x 3 zjazdy"
$wartosc[1][38] = "Koszt wynajmu sal szkoleniowych; 2 dni/zjazd x 3 zjazdy"
$wartosc[1][39] = "Wyżywienie uczestników szkoleń; 2 dni/zjazd x 3 zjazdy/grupę x 1 grupa x 6 osób/grupę"
$wartosc[1][40] = "Noclegi uczestników szkoleń; 1 nocleg/zjazd x 3 zjazdy/grupę x 1 grupa x 6 osób/grupę"
$wartosc[1][41] = "Zadanie nr 4 Realizacja szkoleń - Menedżerowie sprzedaży"
$wartosc[1][42] = "Zakup usług szkoleniowych - menedżerowi sprzedaży; 8 dni/grupę x 32 grupy"
$wartosc[1][43] = "Wynagrodzenie uczestników szkolenia - pracowników delegowanych do udziału w szkoleniu; 68,79zł/dzień x 8dni/osobę x 220 osób"
$wartosc[1][44] = "Wynagrodzenie opiekunów szkoleń (osoby samozatrudnione); 8 dni/grupę x 32 grupy"
$wartosc[1][45] = "Koszty podróży opiekunów szkoleń; 1 wizyta/szkolenie x 8 szkoleń/grupę x 32 grupy"
$wartosc[1][46] = "Noclegi opiekunów szkoleń; 1 nocleg/szkolenie x 8 szkoleń/grupę x 32 grupy"
$wartosc[1][47] = "Wyżywienie opiekunów szkoleń; 1 dzień/szkolenie x 8 szkoleń/grupę x 32 grupy"
$wartosc[1][48] = "Koszt wynajmu sal szkoleniowych; 1 dzień/szkolenie x 8 szkoleń/grupę x 32 grupy"
$wartosc[1][49] = "Wyżywienie uczestników szkoleń; 8dni/grupę x 32 grupy x 10 osób/grupę"
$wartosc[1][50] = "Zadanie nr 5  Ewaluacja"
$wartosc[1][51] = "Zakup usług w zakresie ewaluacji (opracowanie koncepcji ewaluacji i narzędzi badawczych)"
$wartosc[1][52] = "Zakup usług w zakresie ewaluacji (realizacja badań terenowych - tajemniczy klient)"
$wartosc[1][53] = "Zakup usług w zakresie ewaluacji (opracowanie i prezentacja wyników ewaluacji)"



; 3 column
$wartosc[2][0] = "B"
$wartosc[2][1] = ""
$wartosc[2][2] = "PP"
$wartosc[2][3] = ""
For $i = 4 To 99
    $wartosc[2][$i] = "1"
Next
$wartosc[2][23] = ""
$wartosc[2][32] = ""
$wartosc[2][41] = ""


; 4 column
$wartosc[3][0] = "C"
$wartosc[3][1] = ""
$wartosc[3][2] = "UZ"
For $i = 3 To 99
    $wartosc[3][$i] = ""
Next


; 5 column
$wartosc[4][0] = "D"
$wartosc[4][1] = ""
$wartosc[4][2] = "L/P"
$wartosc[4][3] = ""
For $i = 4 To 99
    $wartosc[4][$i] = "L"
Next
$wartosc[4][23] = ""
$wartosc[4][32] = ""
$wartosc[4][41] = ""



; 6 column
$wartosc[5][0] = "E"
$wartosc[5][1] = ""
$wartosc[5][2] = "C/F"
For $i = 3 To 99
    $wartosc[5][$i] = ""
Next



; 7 column
$wartosc[6][0] = "F"
$wartosc[6][1] = ""
$wartosc[6][2] = "j.m"
$wartosc[6][3] = ""
$wartosc[6][4] = "sztuka"
$wartosc[6][5] = "sztuka"
$wartosc[6][6] = "usługa"
$wartosc[6][7] = "sztuka"
$wartosc[6][8] = "miesiąc"
$wartosc[6][9] = "dzień"
$wartosc[6][10] = "rekrutacja"
$wartosc[6][11] = "nocleg"
$wartosc[6][12] = "komplet"
$wartosc[6][13] = "sztuka"
$wartosc[6][14] = "dzień"
$wartosc[6][15] = "miesiąc"
$wartosc[6][16] = "miesiąc"
$wartosc[6][17] = "miesiąc"
$wartosc[6][18] = "wyjazd"
$wartosc[6][19] = "nocleg"
$wartosc[6][20] = "dzień"
$wartosc[6][21] = "miesiąc"
$wartosc[6][22] = "usługa"
$wartosc[6][23] = ""
$wartosc[6][24] = "dzień"
$wartosc[6][25] = "dzień"
$wartosc[6][26] = "nocleg"
$wartosc[6][27] = "dzień"
$wartosc[6][28] = "przewóz"
$wartosc[6][29] = "dzień"
$wartosc[6][30] = "osobodzień"
$wartosc[6][31] = "osobonocleg"
$wartosc[6][32] = ""
$wartosc[6][33] = "dzień"
$wartosc[6][34] = "dzień"
$wartosc[6][35] = "nocleg"
$wartosc[6][36] = "dzień"
$wartosc[6][37] = "przewóz"
$wartosc[6][38] = "dzień"
$wartosc[6][39] = "osobodzień"
$wartosc[6][40] = "osobodzień"
$wartosc[6][41] = ""
$wartosc[6][42] = "dzień"
$wartosc[6][43] = "osobodzień"
$wartosc[6][44] = "dzień"
$wartosc[6][45] = "wizyta"
$wartosc[6][46] = "nocleg"
$wartosc[6][47] = "dzień"
$wartosc[6][48] = "osobodzień"
$wartosc[6][49] = "osobodzień"
$wartosc[6][50] = "usługa"
$wartosc[6][51] = "usługa"
$wartosc[6][52] = "usługa"
$wartosc[6][53] = "usługa"


; 8 column
$wartosc[4][0] = "D"
$wartosc[4][1] = ""
$wartosc[4][2] = "L/P"
$wartosc[4][3] = ""
For $i = 4 To 99
    $wartosc[4][$i] = "L"
Next
$wartosc[4][23] = ""
$wartosc[4][32] = ""
$wartosc[4][41] = ""











start()
Func start()


Global $hGUI = GUICreate("Test Program", 900, 700)
GUISetBkColor(0xCECECE)



  $filemenu = GUICtrlCreateMenu("&Plik")
    $fileitem = GUICtrlCreateMenuItem("Otwórz", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu("?")
    $saveitem = GUICtrlCreateMenuItem("Save", $filemenu)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    $recentfilesmenu = GUICtrlCreateMenu("xxx", $filemenu, 1)

    $separator1 = GUICtrlCreateMenuItem("", $filemenu, 2)   

    $viewmenu = GUICtrlCreateMenu("Edycja", -1, 1)   
    $viewstatusitem = GUICtrlCreateMenuItem("yyy", $viewmenu)
    GUICtrlSetState(-1, $GUI_CHECKED)

Global $hListView = _GUICtrlListView_Create($hGUI, "", 10, 50, 880, $iGUI_Height)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES))

For $i = 0 To 80
    ConsoleWrite(_GUICtrlListView_AddColumn($hListView, $wartosc[$i][0], "",2) & @CRLF)
    _GUICtrlListView_SetColumnWidth($hListView, $i, 100)
Next
_GUICtrlListView_SetTextBkColor($hlistview,0xCCFFCC)

For $i = 1 To 99
    _GUICtrlListView_AddItem($hListView, $wartosc[0][$i])

    For $j = 1 To 11
    _GUICtrlListView_AddSubItem($hListView, $i - 1, $wartosc[$j][$i], $j)

    Next
Next



$iLV_Width = 17
For $i = 0 To 11
    
    _GUICtrlListView_SetColumnWidth($hListView, $i, $LVSCW_AUTOSIZE_USEHEADER)
    $iHeader_Width = _GUICtrlListView_GetColumnWidth($hListView, $i)
   
    _GUICtrlListView_SetColumnWidth($hListView, $i, $LVSCW_AUTOSIZE)
    $iData_Width = _GUICtrlListView_GetColumnWidth($hListView, $i)
  
    If $iHeader_Width > $iData_Width Then
        _GUICtrlListView_SetColumnWidth($hListView, $i, $iHeader_Width)
        $iLV_Width += $iHeader_Width
    Else
        $iLV_Width += $iData_Width
    EndIf
Next

If $iLV_Width > @DesktopWidth - 10 Then $iLV_Width = @DesktopWidth - 10



Global $nowa = GUICtrlCreateButton("Wstaw nowy wiersz", 150, 600, 100, 40)
Global $del = GUICtrlCreateButton("Usuń wiersz", 300, 600, 100, 40)
Global $save = GUICtrlCreateButton("save", 450, 600, 100, 40)
Global $load = GUICtrlCreateButton("load", 600, 600, 100, 40)




GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
EndFunc

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Global $hmm2 = MsgBox(35,"Zapis","Zapisać zmiany?","",$hGUI)
            If $hmm2 <> 2 Then 
            If $hmm2 = 6 Then 
                $date = @YEAR & "-" & @MON & "-" & @MDAY
                $godzina = @HOUR & "-" & @MIN & "-" & @SEC
                $czas = $date&"  "&$godzina&".ini"
                MsgBox(0,"sd",$czas)
                $lokacja = FileSaveDialog( "Zapisz plik...", @ScriptDir, "Pliki tekstowe (*.ini)|Skrypty (*.aut;*.au3)", 2+16, $czas, $hGUI)
                
                If $lokacja <> 1 Then
                
                
                For $c = 0 To 10    
                    $colu = _guictrllistview_getcolumn($hlistview, $c)
                    IniWrite($lokacja, "section0", $c, $colu[5])
            
                For $k = 0 To 99
                    IniWrite($lokacja, "section"&$c+1, $k, _GUICtrlListView_GetItemText($hlistview, $k, $c))
                Next
                Next
                Exit
                EndIf
        
            Else
                Exit
            EndIf
            EndIf
        Case $save
        
        $date = @YEAR & "-" & @MON & "-" & @MDAY
        $godzina = @HOUR & "-" & @MIN & "-" & @SEC
        $czas = $date&"  "&$godzina&".ini"
        
        $lokacja = FileSaveDialog( "Zapisz plik...", @ScriptDir, "Pliki tekstowe (*.ini)|Skrypty (*.aut;*.au3)", 2+16, $czas, $hGUI)
        If $lokacja <> 1 Then
        For $c = 0 To 10    
            $colu = _guictrllistview_getcolumn($hlistview, $c)
            IniWrite($lokacja, "section0", $c, $colu[5])
            
            For $k = 0 To 99
            IniWrite($lokacja, "section"&$c+1, $k, _GUICtrlListView_GetItemText($hlistview, $k, $c))
            Next
        Next
        EndIf

        
        Case $load
        
        $lokacja2 = FileOpenDialog("Wczytaj plik...", @ScriptDir, "Pliki tekstowe (*.ini)|Skrypty (*.aut;*.au3)", 1 + 2 + 8, "", $hGUI)
        
        If $lokacja2 <> "" Then
            Global $hmm4 = MsgBox(33,"Otworzyć plik...?",$lokacja2,"",$hGUI)
            
            If $hmm4 = 1 Then
                For $z = 0 To 90
            
                    $wartosc[$z][0] = IniRead($lokacja2, "section0", $z, "")
            
                For $d = 1 To 99
            
                    $wartosc[$z][$d] = IniRead($lokacja2, "section"&$z+1, $d-1, "")
                Next        
                Next
                GUIDelete()
                    start()
            EndIf
        EndIf
    
        Case $nowa
            
            Global $HotItem = _GUICtrlListView_GetSelectedIndices($hlistview)
            $HotItem = $HotItem +1
            Global $lol
            $lol = $hotitem 
            $lol = $lol + 1 
            
            Global $hGUI3 = GUICreate("Nowy wiersz", 640, 250, -1, -1, "", "", $hGUI)
            GUISetBkColor(0xCECECE)
            Global $label = GUICtrlCreateLabel("Wiersz "&$hotitem, 10, 52, 35, 40)
            Global $exit2 = GUICtrlCreateButton("Exit", 250, 150, 60, 40)
            Global $new = GUICtrlCreateButton("Wstaw nowy", 50, 150, 100, 40)
            Global $inp[100]
            
            
            For $x = 1 To 3
            GUICtrlCreateLabel("kolumna: "&$wartosc[$x][0], $x * 100-21, 35, 100, 15)
            Next
            
            For $z = 1 To 30
            $inp[$z] = GUICtrlCreateInput("", $z * 100-50, 50, 100, 20)
            
            For $z1 = 31 To 60
            $inp[$z1] = GUICtrlCreateInput("", $z * 100-50, 115, 100, 20)
            Next
            
            For $x1 = 1 To 3
            GUICtrlCreateLabel("kolumna: "&$wartosc[$x1][0], $z * 100-21, 90, 100, 15)
            Next
            
            Next
        
    _GUIScrollbars_Generate($hGUI3, 3100)
            GUISetState()
            
            While 1

                Switch GUIGetMsg()
                Case $exit2
                    GUIDelete()
                    ExitLoop
                    
                Case $new

                _GUICtrlListView_InsertItem($hlistview, $lol, $HotItem-1)
                For $j = 1 To 40
                _GUICtrlListView_AddSubItem($hListView, $HotItem-1, GUICtrlRead($inp[$j]), $j)
                Next
                
                For $i = 1 To 100
                    _GUICtrlListView_SetItemText($hlistview, $i-1, $i)
                Next
            
                GUIDelete()
                ExitLoop
                EndSwitch
                
            Wend    
            
            $iLV_Width = 17
            For $i = 0 To 11
  
    _GUICtrlListView_SetColumnWidth($hListView, $i, $LVSCW_AUTOSIZE_USEHEADER)
    $iHeader_Width = _GUICtrlListView_GetColumnWidth($hListView, $i)
    
    _GUICtrlListView_SetColumnWidth($hListView, $i, $LVSCW_AUTOSIZE)
    $iData_Width = _GUICtrlListView_GetColumnWidth($hListView, $i)
   
    If $iHeader_Width > $iData_Width Then
        _GUICtrlListView_SetColumnWidth($hListView, $i, $iHeader_Width)
        $iLV_Width += $iHeader_Width
    Else
        $iLV_Width += $iData_Width
    EndIf
Next

If $iLV_Width > @DesktopWidth - 10 Then $iLV_Width = @DesktopWidth - 10


        
            
            
            
            
        Case $del
            Global $HotItem2 = _GUICtrlListView_GetSelectedIndices($hlistview)
            Global $hmm = MsgBox(1,"???","Usunąć wiersz: "&$HotItem2+1)
            
            If $hmm = 1 Then 
            _GUICtrlListView_DeleteItem($hlistview, $hotitem2)
            
            
                
            Global $lol
            $lol = $hotitem2 
            $lol = $lol 
            
                For $i = 0 To 100
                    _GUICtrlListView_SetItemText($hlistview, $lol+$i, $lol + $i + 1)
                Next
            EndIf

    EndSwitch

    If $fDblClk = True Then
        $fDblClk = False
            
            Global $cos = ""&_GUICtrlListView_GetHotItem($hListView)
            Global $nic = ""&$iSubItem
            Global $asd = _GUICtrlListView_GetItemText($hlistview, $cos, $nic)
            
            Global $hGUI2 = GUICreate("Changes", 320, 200, 320, 125, "", "", $hGUI)
            GUISetBkColor(0xCECECE)
            Global $input = GUICtrlCreateInput($asd, 10, 120, 200, 20)
            Global $exit = GUICtrlCreateButton("Exit", 245, 45, 60, 40)
            Global $new = GUICtrlCreateButton("Zmień", 170, 45, 60, 40)
            
            
            GUISetState()
            While 1
                Switch GUIGetMsg()
                Case $exit
                    GUIDelete()
                    ExitLoop
                    
                Case $new
                    Global $input1 = GUICtrlRead($input)
                    $cos = $cos + 1
                    MsgBox(0,"asd", $cos& "  " &$nic)
                    MsgBox(0,"asd", ""&$input1)
                    $cos = $cos - 1
                    _GUICtrlListView_SetItemText($hListView, $cos, ""&$input1, $nic)
                    GUIDelete()
                    ExitLoop
                EndSwitch
            WEnd
            
$iLV_Width = 17
For $i = 0 To 11
   
    _GUICtrlListView_SetColumnWidth($hListView, $i, $LVSCW_AUTOSIZE_USEHEADER)
    $iHeader_Width = _GUICtrlListView_GetColumnWidth($hListView, $i)
   
    _GUICtrlListView_SetColumnWidth($hListView, $i, $LVSCW_AUTOSIZE)
    $iData_Width = _GUICtrlListView_GetColumnWidth($hListView, $i)
   
    If $iHeader_Width > $iData_Width Then
        _GUICtrlListView_SetColumnWidth($hListView, $i, $iHeader_Width)
        $iLV_Width += $iHeader_Width
    Else
        $iLV_Width += $iData_Width
    EndIf
Next

If $iLV_Width > @DesktopWidth - 10 Then $iLV_Width = @DesktopWidth - 10

            
            
            
            
    EndIf

WEnd

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $iwParam
    Global $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Global $View_multiline_ToolTip = True
    Global $Baloon_ToolTip = 1 ; should be 0 or 1
    Global $Fly_Over = False
    Global $iLastItem = -1, $iLastsubitemNR = -1
    Global $hGUI_Multiline, $View_Multiline, $ColName ; Multiline cell viewer window
    
    
    Switch $hWndFrom
    Case $hListView
            Switch $iCode
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    $iSubItem = DllStructGetData($tInfo, "SubItem")
                    $fDblClk = True
                    
                 Case $NM_CLICK ; when clicking on a cell that is multiline, a tooltip will display the content

                    Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
                    Local $iItem = DllStructGetData($tInfo, "Item")
                    Local $subitemNR = DllStructGetData($tInfo, "SubItem")
                    $Column_attribute =_GUICtrlListView_GetColumn($hListView, $subitemNR)
                    ; if no cell change return without doing anything
                    If $iLastItem = $iItem And $iLastsubitemNR = $subitemNR Then Return 0
                    $iLastItem = $iItem
                    $iLastsubitemNR = $subitemNR
                    
                    Local $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem,$subitemNR)
                    $Mypos = StringInStr ( $sToolTipData, @CRLF )
                    If $Mypos = 0 Then 
                        If $View_multiline_ToolTip = True Then
                            ToolTip($sToolTipData, MouseGetPos(0) + 1, MouseGetPos(1) + 1,"",0,$Baloon_ToolTip) 
                        EndIf
                        ;ConsoleWrite("R" & $iItem & "C" & $subitemNR & " No tip" & @CR)
                    EndIf
                    
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

and maybe u know how make my script little faster? ;> he's so slow or it's only my computer but he's good i think... so maybe wrong while/for or somethink?

Edited by ZwinnyRolnik
Link to comment
Share on other sites

  • 2 weeks later...

I have very large listview but i need this...

--      A    B    C    D    E
I                                    
Pos 1   2    1    2    1    2
Pos 2   5    5    5    5    5           
Pos 3   1    1    1    1    1
II
Pos 1
Pos 2
Pos 3
Pos 4
Pos 5
...
III
Pos1
IV
V
Pos 1
Pos 2
VI.........

or if i click "delete pos 2" then

"
--      A    B    C    D    E
I  
Pos 1   2    1    2    1    2
Pos 3   1    1    1    1    1          < now is here Pos 3 but name must be now Pos 2                                 
II
Pos 1
Pos 2
Pos 3
Pos 4
Pos 5
...
III
Pos1
IV
V
Pos 1
Pos 2
VI.........

and if i click "hide I " then

"
--      A    B    C    D    E
I                                    
II
Pos 1
Pos 2
Pos 3
Pos 4
Pos 5
...
III
Pos1
IV
V
Pos 1
Pos 2
VI.........
"

Same with add Pos or add I or add III etc... i know it's hard but maybe sb have example script or know how do it fast... i am trying 2 days and

$HotItem = _GUICtrlListView_GetSelectedIndices($listview)
        $tekst = MsgBox(1,"???","Usunąć wiersz: "&$HotItem+1)
            
            
            If $tekst = 1 Then 
                Local $zmienna[100]

                _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($ListView))
            
                
            
            
                For $i = 0 to 99
                $zmienna[$i] = IniRead($lokacja2, "section12", $i, "")
                if $zmienna[$i] = "" then $zmienna[$i] = $i
                
                Next
            
                For $i = $HotItem+1 to 99
                    $zmienna[$i] = IniRead($lokacja2, "section12", $i+1, "")
                    if $zmienna[$i] = "" then $zmienna[$i] = $i
                
                Next
            
            
                For $f = 0 To 99
                    _GUICtrlListView_SetItemText($listview, $f-1, $zmienna[$f])
                Next
        
            local $d[100]
                For $cz = 0 to 99
                    $d[$cz] = _GUICtrlListView_GetItemText($listview, $cz, 0)
                    
                
                    
                    if $d[$cz] = "I" or $d[$cz] = "II" or $d[$cz] = "III" or $d[$cz] = "IV" or $d[$cz] = "V" or $d[$cz] = "VI" Then
                    IniWrite($lokacja2, "section12", $cz, $d[$cz])
                Else
                    IniWrite($lokacja2, "section12", $cz, "")
                    
                    EndIf
                Next

but don't look at this, this is chaos... pls help =[

Edited by ZwinnyRolnik
Link to comment
Share on other sites

  • Moderators

ZwinnyRolnik,

If the content of your ListView is getting this complicated, I would strongly suggest that you store the information in an array and completely rewrite the ListView each time you change anything. :)

It is easy to deal with an array when you want to add, delete or amend lines. And hiding lines can be done as you rewrite the data.

The ListView UDF is very good but, as you have discovered, it can become very complex when you want to manipulate your data in anything other than the most simple way. :idea:

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...