Sign in to follow this  
Followers 0
rony2006

Replace text in listview with image

3 posts in this topic

Hello,

I have a list view and I want to replace the text from a cell with a image, is the possible?

Share this post


Link to post
Share on other sites



"With AutoIt, all things are possible"

Seriously, though, @rony2006 you have been around long enough now to know better than to ask a vague question without posting your code.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I don't have the full code because I work at a project at my job. 

But I have this code that is a old version of that project:

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
#include <GuiListView.au3>
#include <GuiTab.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include "EzMySql.au3"
#include <Array.au3>
#include <Date.au3>
#include "live1.au3"





$main = GUICreate("main",843,580,-1,-1,-1,-1)
GUISetBkColor(0xD9E5F3,$main)
$tab = GUICtrlCreatetab(20,90,798,485,-1,-1)
GuiCtrlSetState(-1,2048)
GUICtrlSetFont(-1,12,700,0,"Calibri")
GUICtrlSetBkColor(-1,"0x35C8B9")
GUICtrlCreateTabItem("Cautare Material")
GUICtrlCreateTabItem("Adaugare Material")
GUICtrlCreateTabItem("Ticket Nou")
GUICtrlCreateTabItem("Lista Tickete")
GUICtrlCreateTabItem("Rapoarte")
GUICtrlCreateTabItem("Istoric Echipamente")
GUICtrlCreateTabItem("Arhive")
GUICtrlCreateTabItem("")
_GUICtrlTab_SetCurFocus($tab,-1)
GUICtrlCreatePic("D:\rocimpma\Desktop\program-2016-03-21\program\Images\logo.jpg",0,0,843,63,-1,-1)
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,4)&GUICtrlRead ($tab, 1))
GUICtrlCreateButton("My Text",92,153,100,30,-1,-1)
GUICtrlCreateButton("My Text",112,193,100,30,-1,-1)
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,5)&GUICtrlRead ($tab, 1))
GUICtrlCreateLabel("iesiri piese de schimb",88,153,154,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,0)&GUICtrlRead ($tab, 1))
$lista = GUICtrlCreatelistview("CUI  |Denumire           |Tip                |Producator   |Cod Prod.      |Distribuitor  |Cod Dis.      |Cod SAP      |Cod BM     |Locatie     |Cantitate|Stoc Min. |U.M. |Data                     |Adaugat de",47,168,738,276,$LVS_NOLABELWRAP,BitOr($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES))
GUICtrlSetBkColor(-1,"0xEAFBFF")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,5)&GUICtrlRead ($tab, 1))
GUICtrlCreateLabel("intrari piese de schimb",72,208,154,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,0)&GUICtrlRead ($tab, 1))
$filtrare = GUICtrlCreateInput("",112,128,150,25,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")

GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,5)&GUICtrlRead ($tab, 1))
GUICtrlCreateLabel("interventii piese de schimb",72,268,154,15,-1,-1)
GUICtrlSetBkColor(-1,"-2")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,0)&GUICtrlRead ($tab, 1))
GUICtrlCreateLabel("Keyword:",47,131,144,25,-1,-1)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$go = GUICtrlCreateButton("GO!",267,128,32,25,-1,-1)
GUICtrlSetBkColor(-1,"0xFDBA55")
$iesire1 = GUICtrlCreateButton("Iesire 1 u.m.",63,483,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0x80FF00")
$iesirenr = GUICtrlCreateInput("",63,522,48,25,-1,$WS_EX_CLIENTEDGE) ;;;;;
GUICtrlSetFont(-1,12,400,0,"Calibri")
$iesirenrb = GUICtrlCreateButton("Iesire",152,522,48,25,-1,-1)
GUICtrlSetBkColor(-1,"0x00FFFF")
GUICtrlCreateLabel("u.m.",119,528,30,15,-1,-1)
GUICtrlSetFont(-1,10,400,0,"MS Sans Serif")
GUICtrlSetBkColor(-1,"-2")

GUICtrlCreateButton("Iesire 1 u.m.",370,598,137,25,-1,-1)
$intrare1 = GUICtrlCreateButton("Intrare 1 u.m.",633,483,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0x80FF00")
$intrarenr = GUICtrlCreateInput("",633,522,48,25,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlCreateLabel("u.m.",688,528,30,15,-1,-1)
GUICtrlSetFont(-1,10,400,0,"MS Sans Serif")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateButton("Iesire",339,611,48,25,-1,-1)
$intrarenrb = GUICtrlCreateButton("Intrare",722,522,48,25,-1,-1)
GUICtrlSetBkColor(-1,"0x00FFFF")
GUICtrlCreateGroup("Operatii",47,456,741,100,-1,-1)
GUICtrlSetFont(-1,10,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xFFFFFE")
$sterge = GUICtrlCreateButton("Stergere pozitie",268,483,99,25,-1,-1)
GUICtrlSetBkColor(-1,"0xFF0000")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,1)&GUICtrlRead ($tab, 1))
GUICtrlCreateLabel("Denumire:",47,168,72,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Tip:",47,206,72,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$denumire = GUICtrlCreateInput("",142,168,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Producator:",47,244,95,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$tip = GUICtrlCreateInput("",142,206,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
$producator = GUICtrlCreateInput("",142,244,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Distribuitor:",47,282,95,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$distribuitor = GUICtrlCreateInput("",142,282,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Cod Producator:",490,168,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$codproducator = GUICtrlCreateInput("",620,168,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Cod Distribuitor",490,206,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$coddistribuitor = GUICtrlCreateInput("",620,206,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Cod SAP:",490,244,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$codsap = GUICtrlCreateInput("",620,244,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Cod BM:",490,282,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$codbm = GUICtrlCreateInput("",620,282,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Cantitate:",47,352,95,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$cantitate = GUICtrlCreateInput("",142,352,63,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("U.M.:",47,390,95,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$um = GUICtrlCreateInput("",142,390,63,23,$ES_LOWERCASE,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
$stocminim = GUICtrlCreateInput("",142,428,63,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Stoc Minim:",47,428,95,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Locatie:",490,352,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
;$detalii = GUICtrlCreateInput("",142,466,150,70,-1,$WS_EX_CLIENTEDGE)
;GUICtrlSetFont(-1,12,400,0,"Calibri")
;GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Detalii:",47,466,95,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$locatie = GUICtrlCreateCombo("",620,352,150,23,-1,-1)
GUICtrlSetData(-1,"DL-1-R1-A|DL-1-R1-B|DL-1-R2-A|DL-1-R2-B|DL-1-R3-A|DL-1-R3-B|DL-1-R4-A|DL-1-R4-B|DL-1-R5-A|DL-1-R5-B" & _
"|DL-2-R1-A|DL-2-R1-B|DL-2-R2-A|DL-2-R2-B|DL-2-R3-A|DL-2-R3-B|DL-2-R4-A|DL-2-R4-B|DL-2-R5-A|DL-2-R5-B" & _
"|DL-3-R1-A|DL-3-R1-B|DL-3-R2-A|DL-3-R2-B|DL-3-R3-A|DL-3-R3-B|DL-3-R4-A|DL-3-R4-B|DL-3-R5-A|DL-3-R5-B|")


GUICtrlSetFont(-1,10,400,0,"Verdana")
GUICtrlSetBkColor(-1,"0xFFA851")






GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Data si ora:",490,390,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$datasiora = GUICtrlCreateInput(_Now() ,620,390,150,23,$ES_READONLY,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
GUICtrlCreateLabel("Autor:",490,428,119,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$autor = GUICtrlCreateInput(@Username,620,428,150,23,$ES_READONLY,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")
$adaugare = GUICtrlCreateButton("Adaugare",584,508,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0x80FF00")
$reset =GUICtrlCreateButton("Resetare Campuri",421,508,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0xFFFF00")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,2)&GUICtrlRead ($tab, 1))
GUICtrlCreateLabel("Titlu:",43,188,72,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_titlu = GUICtrlCreateInput("",192,188,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetLimit(-1, 20)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Prioritate:",43,226,167,88,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_descriere = GUICtrlCreateInput("",191,264,235,106,BitOr($ES_LOWERCASE,$ES_MULTILINE),$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
$t_prioritate = GUICtrlCreateCombo("",191,226,151,27,-1,-1)
GUICtrlSetData(-1,"Mare|Medie|Mica")
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Recurent:",159,635,183,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Descriere:",43,264,72,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Echipament:",43,383,99,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_echipament = GUICtrlCreateCombo("Alege sau scrie",192,383,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetData(-1,"ABG8|PUR23|PRESA MONTARE|SAUNA|HV|IPS6|PACKING|TESTARE MANUALA|TOPEX|MASINA DE GAURIT|UV|STATII COSITORIRE|ALTELE")
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Comanda:",41,445,99,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_comanda = GUICtrlCreateInput("",190,445,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Material:",41,483,99,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_material = GUICtrlCreateInput("",190,483,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Autor:",493,150,63,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_autor = GUICtrlCreateInput("",609,150,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
$t_termen = GUICtrlCreateInput("",609,226,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Data si ora:",493,264,91,24,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_datasiora = GUICtrlCreateInput("",609,264,150,23,$ES_READONLY,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("Status TS:",493,302,91,24,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Categorie ticket:",43,150,167,26,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Disponibil",609,302,91,24,-1,-1)
GUICtrlSetFont(-1,13,700,0,"Calibri")
GUICtrlSetColor(-1,"0x00FF13")
GUICtrlSetBkColor(-1,"-2")
$t_categorie = GUICtrlCreateCombo("",191,150,151,21,-1,-1)
GUICtrlSetData(-1,"Defect|Imbunatatire|Preventiv|Comanda|Altele")
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
$t_reset = GUICtrlCreateButton("Resetare Campuri",421,510,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0xFFFF00")
GUICtrlCreateLabel("Responsabil:",493,188,91,24,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
$t_trimite = GUICtrlCreateButton("Trimite",584,510,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0x80FF00")
$t_responsabil = GUICtrlCreateInput("oricine",609,188,150,23,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3FFD2")
GUICtrlCreateLabel("",312,389,75,25,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUICtrlCreateLabel("Termen:",493,226,91,24,-1,-1)
GUICtrlSetFont(-1,13,400,0,"Calibri")
GUICtrlSetBkColor(-1,"-2")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,1)&GUICtrlRead ($tab, 1))
$detalii = GUICtrlCreateInput("",142,466,150,70,BitOr($ES_MULTILINE,$WS_VSCROLL),$WS_EX_CLIENTEDGE)
GUICtrlSetFont(-1,12,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xD3F4FE")

$tezt = GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,0)&GUICtrlRead ($tab, 1))
$detaliib = GUICtrlCreateButton("Detalii....",268,522,99,25,-1,-1)
GUICtrlSetBkColor(-1,"0xFFFF00")
GUISwitch($main,_GUICtrlTab_SetCurFocus($tab,3)&GUICtrlRead ($tab, 1))






$listatickete = GUICtrlCreatelistview("CUI|Categorie      |Prioritate|Status       |Titlu                  |Echipament|Responsabil|Data                          |Creat de        ",48,133,741,369,$LVS_NOLABELWRAP,BitOr($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES))

GUICtrlSetState(-1,BitOr($GUI_SHOW,$GUI_ENABLE,$GUI_DEFBUTTON))
GUICtrlSetBkColor(-1,"0xD3FFD2")
$preluareticket = GUICtrlCreateButton("Preluare Ticket",61,532,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0x80FF00")
GUICtrlCreateGroup("Operatii",48,510,741,61,-1,-1)
GUICtrlSetFont(-1,10,400,0,"Calibri")
GUICtrlSetBkColor(-1,"0xFFFFFE")
$ticketedeschise = GUICtrlCreateButton("Tickete Deschise",639,532,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0x00FFFF")
$inchidereticket = GUICtrlCreateButton("Inchidere Ticket",215,532,137,25,-1,-1)
GUICtrlSetBkColor(-1,"0xFFFF00")


_GUICtrlTab_SetCurFocus($tab,0)
GUISetState(@SW_SHOW,$main)





Func Database_start()

If Not _EzMySql_Startup() Then
    MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

$Pass = ""

If Not _EzMySql_Open("127.0.0.1", "root", $Pass, "test", "3306") Then ; portul pentru lucru este 3308
    MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf





EndFunc

Func Database_stop()
_EzMySql_Close()
_EzMySql_ShutDown()

EndFunc






While 1




    $nMsg = GUIGetMsg()
    Switch $nMsg        ;daca modific variabila asta, mai imi merg butoanele? sau trebuie sa fac alt swicht
        Case $GUI_EVENT_CLOSE

            Exit

        ;;;Adaugare Material




        Case $reset
        GUICtrlSetData($denumire,"")
        GUICtrlSetData($tip,"")
        GUICtrlSetData($producator,"")
        GUICtrlSetData($codproducator,"")
        GUICtrlSetData($distribuitor,"")
        GUICtrlSetData($coddistribuitor,"")
        GUICtrlSetData($cantitate,"")
        GUICtrlSetData($locatie,"")
        GUICtrlSetData($um,"")
        GUICtrlSetData($codbm,"")
        GUICtrlSetData($stocminim,"")
        GUICtrlSetData($codsap,"")
        GUICtrlSetData($detalii,"")


        Case $Adaugare ;mai jos scriu ce sa se intample in CAZ ca se apasa butonul trimite


            Database_start()


            $denumirex = GUICtrlRead($denumire)
            $denumire1 = "'" & $denumirex & "'"  ; adauga ' la denumire ca sa fie bine interpretat de mysql query

            $tipx = GUICtrlRead($tip)
            $tip1 = "'" & $tipx & "'"

            $producatorx = GUICtrlRead($producator)
            $producator1 = "'" & $producatorx & "'"

            $codproducatorx = GUICtrlRead($codproducator)
            $codproducator1 = "'" & $codproducatorx & "'"

            $distribuitorx = GUICtrlRead($distribuitor)
            $distribuitor1 = "'" & $distribuitorx & "'"

            $coddistribuitorx = GUICtrlRead($coddistribuitor)
            $coddistribuitor1 = "'" & $coddistribuitorx & "'"

            $cantitatex = GUICtrlRead($cantitate)
            $cantitate1 = "'" & $cantitatex & "'"

            $locatiex = GUICtrlRead($locatie)
            $locatie1 = "'" & $locatiex & "'"

            $umx = GUICtrlRead($um)
            $um1 = "'" & $umx & "'"

            $codbmx = GUICtrlRead($codbm)
            $codbm1 = "'" & $codbmx & "'"

            $datasiorax = GUICtrlRead($datasiora)
            $datasiora1 = "'" & $datasiorax & "'"

            $autorx = GUICtrlRead($autor)
            $autor1 = "'" & $autorx & "'"

            $stocminimx = GUICtrlRead($stocminim)
            $stocminim1 = "'" & $stocminimx & "'"

            $codsapx = GUICtrlRead($codsap)
            $codsap1 = "'" & $codsapx & "'"

            $detaliix = GUICtrlRead($detalii)
            $detalii1 = "'" & $detaliix & "'"





            $validare = MsgBox (1, "Adaugare material nou", "Previzualizare" & @CRLF & @CRLF & "DENUMIRE:   " & $denumirex & @CRLF & "CANTITATE:   " & $cantitatex & @CRLF & "LOCATIE:   " & $locatiex )

            if $validare = 2 then
            beep (1500, 150)
            Else

            $sMySqlStatement = "INSERT INTO `materiale` (`id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `cantitate`, `um`, `stocminim`, `locatie`, `datasiora`, `autor`, `detalii`) VALUES (NULL, " & $denumire1 & ", " & $tip1 & ", " & $producator1 & ", " & $codproducator1 & ", " & $distribuitor1 & ", " & $coddistribuitor1 & ", " & $codsap1 & ", " & $codbm1 & ", " & $cantitate1 & ", " & $um1 & ", " & $stocminim1 & ", " & $locatie1 & ", " & $datasiora1 & ", " & $autor1 & ", " & $detalii1 & ");"

            If Not _EzMySql_Exec($sMySqlStatement) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf
beep (2500, 100)
Database_start()


            EndIf


            ;;;Cautare material

        Case $go


        Database_start()

        $filtrarex = GUICtrlRead($filtrare)
            $filtrare1 = "'%" & $filtrarex & "%'"

        _GUICtrlListView_DeleteAllItems($lista) ;sterge toate itemele din lista

        $sMySqlStatement ="yg"


        $interogare = "SELECT `id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `locatie`, `cantitate`, `stocminim`, `um`, `datasiora`, `autor` FROM `materiale` WHERE denumire LIKE "& $filtrare1 & " OR tip LIKE "& $filtrare1 & " OR producator LIKE "& $filtrare1 & "OR id LIKE "& $filtrare1 & " OR autor LIKE "& $filtrare1 & "OR codproducator LIKE "& $filtrare1 & " OR distribuitor LIKE "& $filtrare1 & "OR coddistribuitor LIKE "& $filtrare1 & " OR datasiora LIKE "& $filtrare1 & " OR locatie LIKE "& $filtrare1 & ""



        $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)



        _GUICtrlListView_SetItemCount($lista, 5000)

        ; One column load

        $iTimer = TimerInit()
        _GUICtrlListView_AddArray($lista, $aOk)
        MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

        Sleep (50)
        _GUICtrlListView_DeleteItem($lista, 0) ; sterge primu element (colum header)
                _EzMySql_Close()
_EzMySql_ShutDown()
;
        Case $iesire1



         $ab = _GUICtrlListView_GetItemTextArray($lista,-1)



    Database_start()



        ;$ab[1] este id-ul(cui-ul) la randul selectat



            $iesire1st = "UPDATE materiale SET cantitate=cantitate-1 WHERE id= "& $ab[1]  &""

            If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf



        ;Refresh la lista
    $filtrarex = GUICtrlRead($filtrare)
            $filtrare1 = "'%" & $filtrarex & "%'"

        _GUICtrlListView_DeleteAllItems($lista) ;sterge toate itemele din lista


        Database_start()


        $sMySqlStatement ="yg"


        $interogare = "SELECT `id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `locatie`, `cantitate`, `stocminim`, `um`, `datasiora`, `autor` FROM `materiale` WHERE denumire LIKE "& $filtrare1 & " OR tip LIKE "& $filtrare1 & " OR producator LIKE "& $filtrare1 & "OR id LIKE "& $filtrare1 & " OR autor LIKE "& $filtrare1 & "OR codproducator LIKE "& $filtrare1 & " OR distribuitor LIKE "& $filtrare1 & "OR coddistribuitor LIKE "& $filtrare1 & " OR datasiora LIKE "& $filtrare1 & " OR locatie LIKE "& $filtrare1 & ""



        $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)



        _GUICtrlListView_SetItemCount($lista, 5000)

        ; One column load

        ;$iTimer = TimerInit()
        _GUICtrlListView_AddArray($lista, $aOk)
        ;MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

        Sleep (50)
        _GUICtrlListView_DeleteItem($lista, 0) ; sterge primu element (colum header)
        _EzMySql_Close()
_EzMySql_ShutDown()

        Case $iesirenrb


         $ab = _GUICtrlListView_GetItemTextArray($lista,-1)



    Database_start()



        ;$ab[1] este id-ul(cui-ul) la randul selectat

        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        $iesirenrx = GUICtrlRead($iesirenr)
        $iesirenr1 = "'" & $iesirenrx & "'"




            $iesire1st = "UPDATE materiale SET cantitate=cantitate-"&$iesirenr1&" WHERE id= "& $ab[1]  &""

            If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf

        GUICtrlSetData($iesirenr,"")

    ;Refresh la lista
    $filtrarex = GUICtrlRead($filtrare)
            $filtrare1 = "'%" & $filtrarex & "%'"

        _GUICtrlListView_DeleteAllItems($lista) ;sterge toate itemele din lista


        Database_start()


        $sMySqlStatement ="yg"


        $interogare = "SELECT `id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `locatie`, `cantitate`, `stocminim`, `um`, `datasiora`, `autor` FROM `materiale` WHERE denumire LIKE "& $filtrare1 & " OR tip LIKE "& $filtrare1 & " OR producator LIKE "& $filtrare1 & "OR id LIKE "& $filtrare1 & " OR autor LIKE "& $filtrare1 & "OR codproducator LIKE "& $filtrare1 & " OR distribuitor LIKE "& $filtrare1 & "OR coddistribuitor LIKE "& $filtrare1 & " OR datasiora LIKE "& $filtrare1 & " OR locatie LIKE "& $filtrare1 & ""



        $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)



        _GUICtrlListView_SetItemCount($lista, 5000)

        ; One column load

        ;$iTimer = TimerInit()
        _GUICtrlListView_AddArray($lista, $aOk)
        ;MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

        Sleep (50)
        _GUICtrlListView_DeleteItem($lista, 0) ; sterge primu element (colum header)







_EzMySql_Close()
_EzMySql_ShutDown()

        Case $detaliib

         $ab = _GUICtrlListView_GetItemTextArray($lista,-1)




        Database_start()



        $interogare = "SELECT `detalii` FROM `materiale`  WHERE id= "& $ab[1]  &""



        $ainterogare = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($ainterogare) Then MsgBox(0, $sMySqlStatement & " error", $error)

        MsgBox (0, "Detalii Material:", $ainterogare[1][0])

        _EzMySql_Close()
_EzMySql_ShutDown()


        Case $sterge


        $ab = _GUICtrlListView_GetItemTextArray($lista,-1)




        If Not _EzMySql_Startup() Then
        MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
        Exit
        EndIf

        $Pass = "QCaRTrF4VzaRUcWQ"

        If Not _EzMySql_Open("dettmysql.tt.de.ifm", "rocimpma", $Pass, "sibiu", "3308") Then
        MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
        Exit
        EndIf





        $stergeinfo = MsgBox (1, 'Confirmare stergere', 'Sunteti sigur ca doriti sa stergeti pozitia cu denumirea: ' & $ab[2] & '?' )



        if $stergeinfo = 2 then
            beep (1500, 150)
            Else

        $interogare = "DELETE FROM `materiale` WHERE id= "& $ab[1]&""



            If Not _EzMySql_Exec($interogare) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf
        beep (2500, 100)

        EndIf


        ;Refresh la lista
    $filtrarex = GUICtrlRead($filtrare)
            $filtrare1 = "'%" & $filtrarex & "%'"

        _GUICtrlListView_DeleteAllItems($lista) ;sterge toate itemele din lista


        Database_start()


        $sMySqlStatement ="yg"


        $interogare = "SELECT `id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `locatie`, `cantitate`, `stocminim`, `um`, `datasiora`, `autor` FROM `materiale` WHERE denumire LIKE "& $filtrare1 & " OR tip LIKE "& $filtrare1 & " OR producator LIKE "& $filtrare1 & "OR id LIKE "& $filtrare1 & " OR autor LIKE "& $filtrare1 & "OR codproducator LIKE "& $filtrare1 & " OR distribuitor LIKE "& $filtrare1 & "OR coddistribuitor LIKE "& $filtrare1 & " OR datasiora LIKE "& $filtrare1 & " OR locatie LIKE "& $filtrare1 & ""



        $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)



        _GUICtrlListView_SetItemCount($lista, 5000)

        ; One column load

        ;$iTimer = TimerInit()
        _GUICtrlListView_AddArray($lista, $aOk)
        ;MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

        Sleep (50)
        _GUICtrlListView_DeleteItem($lista, 0) ; sterge primu element (colum header)







_EzMySql_Close()
_EzMySql_ShutDown()



        Case $intrare1




         $ab = _GUICtrlListView_GetItemTextArray($lista,-1)



    Database_start()



        ;$ab[1] este id-ul(cui-ul) la randul selectat



            $iesire1st = "UPDATE materiale SET cantitate=cantitate+1 WHERE id= "& $ab[1]  &""

            If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf



        ;Refresh la lista
    $filtrarex = GUICtrlRead($filtrare)
            $filtrare1 = "'%" & $filtrarex & "%'"

        _GUICtrlListView_DeleteAllItems($lista) ;sterge toate itemele din lista


        Database_start()


        $sMySqlStatement ="yg"


        $interogare = "SELECT `id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `locatie`, `cantitate`, `stocminim`, `um`, `datasiora`, `autor` FROM `materiale` WHERE denumire LIKE "& $filtrare1 & " OR tip LIKE "& $filtrare1 & " OR producator LIKE "& $filtrare1 & "OR id LIKE "& $filtrare1 & " OR autor LIKE "& $filtrare1 & "OR codproducator LIKE "& $filtrare1 & " OR distribuitor LIKE "& $filtrare1 & "OR coddistribuitor LIKE "& $filtrare1 & " OR datasiora LIKE "& $filtrare1 & " OR locatie LIKE "& $filtrare1 & ""



        $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)



        _GUICtrlListView_SetItemCount($lista, 5000)

        ; One column load

        ;$iTimer = TimerInit()
        _GUICtrlListView_AddArray($lista, $aOk)
        ;MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

        Sleep (50)
        _GUICtrlListView_DeleteItem($lista, 0) ; sterge primu element (colum header)
        _EzMySql_Close()
_EzMySql_ShutDown()


        Case $intrarenrb


         $ab = _GUICtrlListView_GetItemTextArray($lista,-1)



    Database_start()



        ;$ab[1] este id-ul(cui-ul) la randul selectat

        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        $intrarenrx = GUICtrlRead($intrarenr)
        $intrarenr1 = "'" & $intrarenrx & "'"




            $iesire1st = "UPDATE materiale SET cantitate=cantitate+"&$intrarenr1&" WHERE id= "& $ab[1]  &""

            If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf

        GUICtrlSetData($intrarenr,"")

    ;Refresh la lista
    $filtrarex = GUICtrlRead($filtrare)
            $filtrare1 = "'%" & $filtrarex & "%'"

        _GUICtrlListView_DeleteAllItems($lista) ;sterge toate itemele din lista


        Database_start()


        $sMySqlStatement ="yg"


        $interogare = "SELECT `id`, `denumire`, `tip`, `producator`, `codproducator`, `distribuitor`, `coddistribuitor`, `codsap`, `codbm`, `locatie`, `cantitate`, `stocminim`, `um`, `datasiora`, `autor` FROM `materiale` WHERE denumire LIKE "& $filtrare1 & " OR tip LIKE "& $filtrare1 & " OR producator LIKE "& $filtrare1 & "OR id LIKE "& $filtrare1 & " OR autor LIKE "& $filtrare1 & "OR codproducator LIKE "& $filtrare1 & " OR distribuitor LIKE "& $filtrare1 & "OR coddistribuitor LIKE "& $filtrare1 & " OR datasiora LIKE "& $filtrare1 & " OR locatie LIKE "& $filtrare1 & ""



        $aOk = _EzMySql_GetTable2d($interogare)
        $error = @error
        If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)



        _GUICtrlListView_SetItemCount($lista, 5000)

        ; One column load

        ;$iTimer = TimerInit()
        _GUICtrlListView_AddArray($lista, $aOk)
        ;MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

        Sleep (50)
        _GUICtrlListView_DeleteItem($lista, 0) ; sterge primu element (colum header)







_EzMySql_Close()
_EzMySql_ShutDown()


        Case $t_trimite

    Database_start()

            $t_categoriex = GUICtrlRead($t_categorie)
            $t_categorie1 = "'" & $t_categoriex & "'"  ; adauga ' la denumire ca sa fie bine interpretat de mysql query

            $t_titlu1 =  "'" & GUICtrlRead($t_titlu) & "'"  ; adauga ' la denumire ca sa fie bine interpretat de mysql query
            $t_prioritate1 =  "'" & GUICtrlRead($t_prioritate) & "'"
            $t_descriere1 =  "'" & GUICtrlRead($t_descriere) & "'"
            $t_comanda1 =  "'" & GUICtrlRead($t_comanda) & "'"
            $t_material1 =  "'" & GUICtrlRead($t_material) & "'"
            $t_echipament1 =  "'" & GUICtrlRead($t_echipament) & "'"
            $t_autor1 =  "'" & GUICtrlRead($t_autor) & "'"
            $t_responsabil1 =  "'" & GUICtrlRead($t_responsabil) & "'"
            $t_termen1 =  "'" & GUICtrlRead($t_termen) & "'"
            $t_data1 =  "'" & GUICtrlRead($t_datasiora) & "'"

            $t_controlid ="0"
            $t_controlid1=  "'" & GUICtrlRead($t_controlid) & "'"




            ;$t_validare = MsgBox (1, "Trimite ticket nou", "Previzualizare" & @CRLF & @CRLF & "TITLU:   " & $t_titlu & @CRLF & "PRIORITATE:   " & $t_prioritate & @CRLF & "ECHIPAMENT:   " & $t_echipament )

            ;if $t_validare = 2 then
            ;beep (1500, 150)
            ;Else

            $sMySqlStatement = "INSERT INTO `tichete` (`id`, `categorie`, `titlu`, `prioritate`, `descriere`, `comanda`, `material`, `echipament`, `autor_ticket`, `responsabil`, `termen`, `data_creare`, `control_id`) VALUES (NULL, " & $t_categorie1 & ", " & $t_titlu1 & ", " & $t_prioritate1 & ", " & $t_descriere1 & ", " & $t_comanda1 & ", " & $t_material1 & ", " & $t_echipament1 & ", " & $t_autor1 & ", " & $t_responsabil1 & ", " & $t_termen1 & ", " & $t_data1 & ", " & $t_controlid1 & ");"
; , `prioritate`, `descriere`, `comanda`, `material`, `echipament`, `autor_ticket`, `responsabil`, `termen`, `data_creare`
            If Not _EzMySql_Exec($sMySqlStatement) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf
beep (2500, 100)
            _EzMySql_Close()
_EzMySql_ShutDown()


            ;EndIf




        Case $preluareticket

         $ab1 = _GUICtrlListView_GetItemTextArray($listatickete,-1)



    Database_start()



        ;$ab[1] este id-ul(cui-ul) la randul selectat
        $t_data1 =  "'" & GUICtrlRead($t_datasiora) & "'"


            ;$iesire1st = "UPDATE tichete SET data_deschidere="& $t_data1 &"  WHERE id= "& $ab1[1]  &""
            
            
            $iesire1st = "UPDATE tichete SET status='Preluat' WHERE id= "& $ab1[1]  &""
            
            
            If Not _EzMySql_Exec($iesire1st) Then
            MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
            Exit
            EndIf



        
        _EzMySql_Close()
_EzMySql_ShutDown()
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        Case Else
            GUICtrlSetData($datasiora, _Now())
            GUICtrlSetData($t_datasiora, _Now())










    EndSwitch

    $ccontrol = GuiCtrlRead($tab)
    Switch $ccontrol

    Case 3
    HotKeySet("{ESC}", "_Exit")
    test()
    Func _Exit()
    Exit
EndFunc







    EndSwitch

WEnd

When I click $go, I get a 2d array from a mysql server and then I put the data in the listview

Untitled.png

Share this post


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
Sign in to follow this  
Followers 0