Sign in to follow this  
Followers 0
realkiller

Database

2 posts in this topic

iam stuck, i made a bunton that trys to show the clicked value from the database using a msgbox. but somhow there comes no result anyone a idea

#include <GuiConstants.au3>
#include <GuiCombo.au3>
#include <File.au3>
#NoTrayIcon

$database = FileRead("database.txt",20000)

Dim $Input,$Input1,$Input2,$Input3,$Btn_Insert,$Combo,$Btn_Exit,$msg,$Status,$i_index,$read,$read1,$read2,$read3,$read4,$read5

$my_gui = GuiCreate("Aufgaben Database, "&@UserName, 650, 300)
_GuiRoundCorners($my_gui, 0, 0, 20, 20)
$Input = GuiCtrlCreateCombo("", 10, 20, 60, 21)
GUICtrlSetData(-1,"Low|Normal|Urgent|")
$Input1 = GuiCtrlCreateCombo("", 169, 20, 110, 21)
GUICtrlSetData(-1,"Alexander Krings|Volker Hertzer|Willi Philipps|Robert Hertzer|Norman Moonen|Christoph Willms|Kloke Thomas|Azubis|Leiters|EDV")
$Input2 = GuiCtrlCreateInput("", 280, 20, 320, 21)
$Input3 = GuiCtrlCreateInput(@MDAY&"-"&@MON&"-"&@YEAR&"   "&@HOUR&":"&@MIN, 71, 20, 97, 21)


$Btn_Insert = GuiCtrlCreateButton("Add", 600, 20, 50, 20)
$refresh = GuiCtrlCreateButton("Refresh", 600, 100, 50, 20)
$value = GuiCtrlCreateButton("Value", 600, 151, 50, 20)
GuiCtrlCreateLabel("Priority", 20, 5, 100, 11)
GuiCtrlCreateLabel("Date", 105, 5, 100, 11)
GuiCtrlCreateLabel("User", 206, 5, 100, 11)
GuiCtrlCreateLabel("Task", 430, 5, 100, 11)



GuiCtrlCreateLabel("Priority", 20, 85, 100, 11)
GuiCtrlCreateLabel("Date", 105, 85, 100, 11)
GuiCtrlCreateLabel("User", 206, 85, 100, 11)
GuiCtrlCreateLabel("Task", 430, 85, 100, 11)


$Combo = GuiCtrlCreateCombo("", 10, 100, 589, 209,$CBS_SIMPLE)



GUICtrlSetData($Combo,$database)

$Status = GUICtrlCreateLabel("",0,747,1024,19,BitOR($SS_SUNKEN,$SS_CENTER))

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE 
ExitLoop

Case $msg = $refresh
$database = FileRead("database.txt",20000)
GUICtrlSetData($Combo,$database)

Case $msg = $Combo
         MsgBox(0,"listview", "clicked="& GUICtrlRead($CBS_SIMPLE),2)
    
Case $msg = $Btn_Insert
    ;controlle 


while 1

If(StringLen(GUICtrlRead($Input)) = 0) Then
    msgbox(0,"", "You forgot to choose the priority.")
    ExitLoop
    EndIf
    If(StringLen(GUICtrlRead($Input1)) = 0) Then
    msgbox(0,"", "You forgot to choose the User.")
    ExitLoop
        EndIf
    If(StringLen(GUICtrlRead($Input2)) = 0) Then
        msgbox(0,"", "You forgot to Fill in a task to compleet.")
    ExitLoop
        EndIf
    If(StringLen(GUICtrlRead($Input3)) = 0) Then
        msgbox(0,"", "You forgot to Fill in a date")
    ExitLoop
        EndIf

    
    

    

$read = GUICtrlRead($Input)
$read1 = GUICtrlRead($Input1) 
$read2 = GUICtrlRead($Input2) 
$read3 = GUICtrlRead($Input3) 
_FileWriteToLine("database.txt", 1, "|"&$read&"           "&$read3&"       "&$read1&"           "&$read2&"                                                                                                       ", 0)
$i_index =_GUICtrlComboInsertString($Combo,_GUICtrlComboGetCurSel($Combo),GUICtrlRead($Input)&"           "&GUICtrlRead($Input3)&"       "&GUICtrlRead($Input1)&"           "&GUICtrlRead($Input2))

GUICtrlSetData($Status,"Database Update Afgerond Totaal: " & $i_index &" stuks")


ExitLoop
WEnd
 
    

EndSelect
WEnd
Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
     Dim $pos, $ret, $ret2
     $pos = WinGetPos($h_win)
     $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
     If $ret[0]Then
          $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
          If $ret2[0]Then
               Return 1
          Else
               Return 0
          EndIf
     Else
          Return 0
     EndIf
EndFunc

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