thienfu Posted July 14, 2010 Share Posted July 14, 2010 Hello anyone please help, why my listview error when i open new window, for example can see on attachment when i open program paint. ( please see on attchment from pic number 01 - 03 ). for you informasi when i run that program on window vista not error ( can work fine ), but when i run on window xp that error come out. sorry for my bad english, hope u all can understand what i mean. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 14, 2010 Moderators Share Posted July 14, 2010 thienfu,Try using _WinAPI_UpdateWindow() with the handle of your ListView in your idle loop and see if that helps. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
thienfu Posted July 14, 2010 Author Share Posted July 14, 2010 thienfu, Try using _WinAPI_UpdateWindow() with the handle of your ListView in your idle loop and see if that helps. M23 Hello Melba23, thanks for reply. Sorry i still newbie i dunno how to use that function, where i should put that _winAPI_updatewindow() ? for example below my listview script : expandcollapse popup$resultendtenant = $dbDatatBase.OpenRecordset("Select * From db where lease <> 'Vacant'") if ($resultendtenant.Eof = -1 And $resultendtenant.Bof =-1) Then ; Blank Table $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |",15,300,968,340, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) Return EndIf With $resultendtenant if $resultendtenant.EOF <> true then $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |",15,300,968,340, $LVS_REPORT, $WS_EX_CLIENTEDGE) $j=1 $k=1 While Not $resultendtenant.EOF For $i = $j To $j Next if $resultendtenant("end_date").value <= $today then $h=$k For $g = $k To $k Next _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_AddItem($ResultBox, $k) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(1).Value, 1) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(2).Value, 2) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(3).Value, 3) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(4).Value, 4) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, Display_Date(StringLeft($resultendtenant("Start_date").value, 8)), 5) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, Display_Date(StringLeft($resultendtenant("end_date").value, 8)), 6) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(7).Value, 7) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(8).Value, 8) $k=$k+1 KeysSetup (0) EndIf $j = $j + 1 $resultendtenant.Movenext WEnd GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() EndIf EndWith Sorry for my bad english. hope u can understand. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 14, 2010 Moderators Share Posted July 14, 2010 thienfu, My suggestion is to keep calling the line to rewrite the ListView when it becomes corrupted. What you have posted is the code to write the ListView in the first place. At some point in your script you must have either: ; If you use OnEvent mode While Sleep(10) ; or another number WEnd ; or if you use GetMessage mode While Switch GUIGetMsg() ; other code WEnd That is where I suggest you put the line I posted. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
thienfu Posted July 14, 2010 Author Share Posted July 14, 2010 thienfu, My suggestion is to keep calling the line to rewrite the ListView when it becomes corrupted. What you have posted is the code to write the ListView in the first place. At some point in your script you must have either: ; If you use OnEvent mode While Sleep(10) ; or another number WEnd ; or if you use GetMessage mode While Switch GUIGetMsg() ; other code WEnd That is where I suggest you put the line I posted. M23 Hi Melba23 i've try using while function to reload for some second, but now that layout alway blink, can i make not blink? Sorry for my bad english. Hope u can understand Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 14, 2010 Moderators Share Posted July 14, 2010 thienfu, Sorry if it flashes, I have not used that command much. Perhaps you coul link it to as control on your GUI so you can refresh when required. Or check if the window is inactive and then run it ehen the window becomes active again. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
thienfu Posted July 14, 2010 Author Share Posted July 14, 2010 thienfu,Sorry if it flashes, I have not used that command much.Perhaps you coul link it to as control on your GUI so you can refresh when required. Or check if the window is inactive and then run it ehen the window becomes active again. M23Hi Melba23,can u guide me how to use function for check window inactive and active, cause i dunno how to use that function.Sorry for my bad english. Hope u can understand. Link to comment Share on other sites More sharing options...
Yashied Posted July 14, 2010 Share Posted July 14, 2010 @thienfu I recommend you put up with it but you can do like this. ... GUIRegisterMsg($WM_PAINT, 'WM_PAINT') ... Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI _WinAPI_InvalidateRect($hListView) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 14, 2010 Moderators Share Posted July 14, 2010 thienfu, how to use function for check window inactive and activeTry this - $hGUI is the handle of the GUI, not the ListView: ; Declare a flag earlier in the script $fInActive = False ; Then in your idle loop While ; other code ; Check if window is inactive If BitAND(WinGetState($hGUI), 8) <> 8 Then ; If it is - set flag $fInActive = True Else ; Window is now active, was it just inactive? If $fInActive = True Then ; If it was then clear flag $fInActive = False ; And redraw the window _WinAPI_UpdateWindow($hGUI) EndIf EndIf WEnd M23 P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
thienfu Posted July 14, 2010 Author Share Posted July 14, 2010 hello Yashied, below my script after put your _WinAPI_InvalidateRect() function, but still not work, maybe i wrong use on my script, pls advise. and attachment are my database And hello Melba23, ok i will use add reply button for reply. i've question if we use function for check inactive or active GUI, then when GUI Inactive and become active again the GUI will reload the mainGUI so that data will show like first time we open ? My problem are when i click the view button and i open other window then the error come out like on pic i attach first time. any solution for solve this case? Sorry for my bad english, hope u all can understand my problem expandcollapse popup#include <GUIConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> #include <GuiListView.au3> #include <FontConstants.au3> #include <WinAPI.au3> #include <Date.au3> Const $conProgName = "Schedulle Tenancy" Const $conDbFile = "db.mdb" ; it has to be on script current Dir Const $conTable = "db" Const $conOK = 1, $conEdit = 1, $conAdd = 0 Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") Global $objDBSystem, $dbDatatBase, $recRecordSet, $ResultBox Global $selectblock, $selectunit, $owner, $period, $startdate, $enddate, $tenant, $monthlyrent,$monthlymaint Global $SecondGUI, $MainGUI Global $today = Stringmid(_nowdate(), 7, 4) & Stringmid(_nowdate(), 4, 2) & StringLeft(_Nowdate(), 2) If Setup() = $conOK Then Main() EndIf Func Setup() $objDBSystem = ObjCreate("DAO.DBEngine.36") If $conOK <> FileExists(@ScriptDir & "\" & $conDbFile) Then MsgBox(16, $conProgName, "Database File is not found " & @LF & @ScriptDir & "\" & $conDbFile) ;Return 0 Exit EndIf $dbDatatBase = $objDBSystem.OpenDatabase(@ScriptDir & "\" & $conDbFile) $recRecordSet = $dbDatatBase.OpenRecordset("Select * From " & $conTable) Return $conOK EndFunc ;==>Setup Func Main() Opt("GUIOnEventMode", 1) $MainGUI = GUICreate("PT. KBI - Schedulle Tenancy", 1000, 700) ; will create a dialog box GUISetBkColor(0xFFFBF0) ; will change background color $hTab = GUICtrlCreateTab(5, 10, 990, 685) $hTab0 = GUICtrlCreateTabItem("Main") GUISetOnEvent($GUI_EVENT_CLOSE, "End") GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Notice", 10, 185, 545, 100) GUICtrlCreateLabel("Date :", 15, 200) GUICtrlCreateLabel(_NowDate(), 50, 200) $a = $dbDatatBase.OpenRecordset("Select * From db where Lease <> 'Vacant'") if ($a.Eof = -1 And $a.Bof =-1) Then GUICtrlCreateLabel("There are ", 15, 220) GUICtrlCreateLabel("0", 65, 220) GUICtrlCreateLabel("Units Tenant Has Been Due Date the lease, but havent confirm want to Extend or Not", 85, 220) $viewenddatetenant = GUICtrlCreateButton("View", 520, 218, 30, 20) GUICtrlSetOnEvent($viewenddatetenant, "Viewendtenant") Else $count = 0 $countenddate = 0 While Not $a.EOF for $b = $count to $count Next if $a("end_date").value <= $today then $countenddate = $countenddate+1 EndIf $count = $count+1 $a.movenext WEnd GUICtrlCreateLabel("There are ", 15, 220) GUICtrlCreateLabel($countenddate, 65, 220) GUICtrlCreateLabel("Units Tenant Has Been Due Date the lease, but havent confirm want to Extend or Not", 85, 220) $viewenddatetenant = GUICtrlCreateButton("View", 520, 218, 30, 20) GUICtrlSetOnEvent($viewenddatetenant, "Viewendtenant") EndIf GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Result", 10, 285, 977, 360) $result = $dbDatatBase.OpenRecordset("Select * From db") if ($result.Eof = -1 And $result.Bof =-1) Then ; Blank Table GUISetState() $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |",15,300,968,340, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) EndIf With $result if $Result.EOF <> true then $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |",15,300,968,340, $LVS_REPORT, $WS_EX_CLIENTEDGE) $j=1 While Not $Result.EOF For $i = $j To $j _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_AddItem($ResultBox, $j) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(1).Value, 1) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(2).Value, 2) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(3).Value, 3) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(4).Value, 4) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, Display_Date(StringLeft($result("Start_date").value, 8)), 5) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, Display_Date(StringLeft($result("end_date").value, 8)), 6) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(7).Value, 7) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(8).Value, 8) Next $j = $j+1 $Result.Movenext WEnd GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() EndIf EndWith GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE end() EndSwitch WEnd EndFunc ;==>Main Func Viewendtenant() $resultendtenant = $dbDatatBase.OpenRecordset("Select * From db where lease <> 'Vacant'") if ($resultendtenant.Eof = -1 And $resultendtenant.Bof =-1) Then ; Blank Table $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |",15,300,968,340, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) Return EndIf With $resultendtenant if $resultendtenant.EOF <> true then $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |",15,300,968,340, $LVS_REPORT, $WS_EX_CLIENTEDGE) $j=1 $k=1 While Not $resultendtenant.EOF For $i = $j To $j Next if $resultendtenant("end_date").value <= $today then $h=$k For $g = $k To $k Next _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_AddItem($ResultBox, $k) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(1).Value, 1) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(2).Value, 2) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(3).Value, 3) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(4).Value, 4) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, Display_Date(StringLeft($resultendtenant("Start_date").value, 8)), 5) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, Display_Date(StringLeft($resultendtenant("end_date").value, 8)), 6) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(7).Value, 7) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(8).Value, 8) $k=$k+1 EndIf $j = $j + 1 $resultendtenant.Movenext WEnd GUIRegisterMsg($WM_PAINT, 'WM_PAINT') GUISetState() EndIf EndWith EndFunc Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $MainGUI _WinAPI_InvalidateRect($ResultBox) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func Display_Date($date) Return StringRight($date, 2) & "/" & StringMid($date, 5, 2) & "/" & StringLeft($date, 4) ; DD/MM/YYYY ; Return StringMid($date, 5, 2) & "/" & StringRight($date, 2) & "/" & StringLeft($date, 4) ; MM/DD/YYYY EndFunc Func End() Switch @GUI_WINHANDLE Case $MainGUI GUIDelete($MainGUI) Exit Case $SecondGUI GUIDelete($SecondGUI) EndSwitch EndFuncdb.rar Link to comment Share on other sites More sharing options...
Yashied Posted July 14, 2010 Share Posted July 14, 2010 (edited) GUIRegisterMsg() is enough to write once at the beginning of code, and following _WinAPI_InvalidateRect(GUICtrlGetHandle($ResultBox)) expandcollapse popup#include <GUIConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> #include <GuiListView.au3> #include <FontConstants.au3> #include <WinAPI.au3> #include <Date.au3> Const $conProgName = "Schedulle Tenancy" Const $conDbFile = "db.mdb" ; it has to be on script current Dir Const $conTable = "db" Const $conOK = 1, $conEdit = 1, $conAdd = 0 Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") Global $objDBSystem, $dbDatatBase, $recRecordSet, $ResultBox Global $selectblock, $selectunit, $owner, $period, $startdate, $enddate, $tenant, $monthlyrent, $monthlymaint Global $SecondGUI, $MainGUI Global $today = StringMid(_NowDate(), 7, 4) & StringMid(_NowDate(), 4, 2) & StringLeft(_NowDate(), 2) GUIRegisterMsg($WM_PAINT, 'WM_PAINT') GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") If Setup() = $conOK Then Main() EndIf Func Setup() $objDBSystem = ObjCreate("DAO.DBEngine.36") If $conOK <> FileExists(@ScriptDir & "\" & $conDbFile) Then MsgBox(16, $conProgName, "Database File is not found " & @LF & @ScriptDir & "\" & $conDbFile) ;Return 0 Exit EndIf $dbDatatBase = $objDBSystem.OpenDatabase(@ScriptDir & "\" & $conDbFile) $recRecordSet = $dbDatatBase.OpenRecordset("Select * From " & $conTable) Return $conOK EndFunc ;==>Setup Func Main() Opt("GUIOnEventMode", 1) $MainGUI = GUICreate("PT. KBI - Schedulle Tenancy", 1000, 700) ; will create a dialog box GUISetBkColor(0xFFFBF0) ; will change background color $hTab = GUICtrlCreateTab(5, 10, 990, 685) $hTab0 = GUICtrlCreateTabItem("Main") GUISetOnEvent($GUI_EVENT_CLOSE, "End") GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Notice", 10, 185, 545, 100) GUICtrlCreateLabel("Date :", 15, 200) GUICtrlCreateLabel(_NowDate(), 50, 200) $a = $dbDatatBase.OpenRecordset("Select * From db where Lease <> 'Vacant'") if ($a.Eof = -1 And $a.Bof = -1) Then GUICtrlCreateLabel("There are ", 15, 220) GUICtrlCreateLabel("0", 65, 220) GUICtrlCreateLabel("Units Tenant Has Been Due Date the lease, but havent confirm want to Extend or Not", 85, 220) $viewenddatetenant = GUICtrlCreateButton("View", 520, 218, 30, 20) GUICtrlSetOnEvent($viewenddatetenant, "Viewendtenant") Else $count = 0 $countenddate = 0 While Not $a.EOF For $b = $count To $count Next If $a("end_date" ).value <= $today Then $countenddate = $countenddate + 1 EndIf $count = $count + 1 $a.movenext WEnd GUICtrlCreateLabel("There are ", 15, 220) GUICtrlCreateLabel($countenddate, 65, 220) GUICtrlCreateLabel("Units Tenant Has Been Due Date the lease, but havent confirm want to Extend or Not", 85, 220) $viewenddatetenant = GUICtrlCreateButton("View", 520, 218, 30, 20) GUICtrlSetOnEvent($viewenddatetenant, "Viewendtenant") EndIf GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Result", 10, 285, 977, 360) $result = $dbDatatBase.OpenRecordset("Select * From db") if ($result.Eof = -1 And $result.Bof = -1) Then ; Blank Table GUISetState() $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |", 15, 300, 968, 340, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) EndIf With $result If $result.EOF <> True Then $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |", 15, 300, 968, 340, $LVS_REPORT, $WS_EX_CLIENTEDGE) $j = 1 While Not $result.EOF For $i = $j To $j _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_AddItem($ResultBox, $j) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(1).Value, 1) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(2).Value, 2) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(3).Value, 3) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(4).Value, 4) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, Display_Date(StringLeft($result("Start_date" ).value, 8)), 5) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, Display_Date(StringLeft($result("end_date" ).value, 8)), 6) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(7).Value, 7) _GUICtrlListView_AddSubItem($ResultBox, $i - 1, .Fields(8).Value, 8) Next $j = $j + 1 $result.Movenext WEnd GUISetState() EndIf EndWith GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE end() EndSwitch WEnd EndFunc ;==>Main Func Viewendtenant() $resultendtenant = $dbDatatBase.OpenRecordset("Select * From db where lease <> 'Vacant'") if ($resultendtenant.Eof = -1 And $resultendtenant.Bof = -1) Then ; Blank Table $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |", 15, 300, 968, 340, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) Return EndIf With $resultendtenant If $resultendtenant.EOF <> True Then $ResultBox = GUICtrlCreateListView("No| Block | Unit |Owner| Lease |Start Date|End Date| Name of Tenant |", 15, 300, 968, 340, $LVS_REPORT, $WS_EX_CLIENTEDGE) $j = 1 $k = 1 While Not $resultendtenant.EOF For $i = $j To $j Next If $resultendtenant("end_date" ).value <= $today Then $h = $k For $g = $k To $k Next _GUICtrlListView_SetExtendedListViewStyle($ResultBox, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_AddItem($ResultBox, $k) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(1).Value, 1) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(2).Value, 2) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(3).Value, 3) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(4).Value, 4) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, Display_Date(StringLeft($resultendtenant("Start_date" ).value, 8)), 5) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, Display_Date(StringLeft($resultendtenant("end_date" ).value, 8)), 6) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(7).Value, 7) _GUICtrlListView_AddSubItem($ResultBox, $k - 1, .Fields(8).Value, 8) $k = $k + 1 EndIf $j = $j + 1 $resultendtenant.Movenext WEnd GUISetState() EndIf EndWith EndFunc ;==>Viewendtenant Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $MainGUI _WinAPI_InvalidateRect(GUICtrlGetHandle($ResultBox)) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func Display_Date($date) Return StringRight($date, 2) & "/" & StringMid($date, 5, 2) & "/" & StringLeft($date, 4) ; DD/MM/YYYY ; Return StringMid($date, 5, 2) & "/" & StringRight($date, 2) & "/" & StringLeft($date, 4) ; MM/DD/YYYY EndFunc ;==>Display_Date Func End() Switch @GUI_WinHandle Case $MainGUI GUIDelete($MainGUI) Exit Case $SecondGUI GUIDelete($SecondGUI) EndSwitch EndFunc ;==>End Edited July 14, 2010 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 14, 2010 Share Posted July 14, 2010 There are more direct functions for that (work on the control, not the whole window). See _GUICtrlListView_BeginUpdate() and _GUICtrlListView_EndUpdate() in the help file. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now