PhilipG Posted November 10, 2009 Share Posted November 10, 2009 First of all, this is my first script. I have been doing some basic php and mysql earlier but never basic based stuff(apart from that). My problem: I have a GUI script. Everything works well. I also have a function that will change all information in all labels in the whole script. My question: Is it possible some how the tell the script to "restart" or "reload" the labels but with some new variables? I've already tried a while loop, both with GUIsetdata and looping the whole script. But that made all labels flashing like crazy. I don't even know if this is the best solution. Would be very happy for any help! Link to comment Share on other sites More sharing options...
Yashied Posted November 10, 2009 Share Posted November 10, 2009 Welcome to the forum. And where is your script? 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...
marc0v Posted November 11, 2009 Share Posted November 11, 2009 I guess what you want to do is to update the text displayed in a label You should update it only when needed, not on each main loop... update the label only if the text has to be changed and, maybe, only once every so many milliseconds (100 ms in this example) AutoItSetOption("MustDeclareVars", 1) #include <GUIConstantsEx.au3> Example() Func Example() Local $id_label, $myvar, $msg, $timer, $nowdiff, $lastupdatediff Const $ms_update_interval = 100 GUICreate("My GUI") $id_label = GUICtrlCreateLabel("text", 10, 10, 100, 20) GUISetState() $timer = TimerInit() $lastupdatediff = 0 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $nowdiff = TimerDiff($timer) $myvar = Int($nowdiff / 1000) & "s" If ($nowdiff - $lastupdatediff >= $ms_update_interval) Then If Not(GUICtrlRead($id_label) == $myvar) Then GUICtrlSetData($id_label, $myvar) $lastupdatediff = $nowdiff EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
EndFunc Posted November 11, 2009 Share Posted November 11, 2009 First of all, this is my first script. I have been doing some basic php and mysql earlier but never basic based stuff(apart from that).My problem:I have a GUI script. Everything works well. I also have a function that will change all information in all labels in the whole script.My question:Is it possible some how the tell the script to "restart" or "reload" the labels but with some new variables? I've already tried a while loop, both with GUIsetdata and looping the whole script. But that made all labels flashing like crazy.I don't even know if this is the best solution. Would be very happy for any help!Yeah, you definitely don't want to put them in a loop. It will keep doing that over and over. Only change the label when it's needed. You can always make the variable = something else after an action is done or an event happens then update your label data with GuiCtrlSetData().If you need more help post some of your code, someone will help you. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
Mison Posted November 11, 2009 Share Posted November 11, 2009 Use function... _resetLabel() ; first time set While 1 ; main loop ; If AnyChangeInVars Then _resetLabel() ; reset WEnd Func _resetLabel() ; EndFunc Hi ;) Link to comment Share on other sites More sharing options...
PhilipG Posted November 11, 2009 Author Share Posted November 11, 2009 I've now written a update function that updates all fields affected. But this lead me to an other problem my updatescript looks like this (part of it, IRL there are more fields to update.: func update($i) Local $Query, $Row, $iRows, $iColumns $Query = "SELECT * FROM uppdrag WHERE id=" & $i & " limit 1;";kollar uppdragets id _SQLite_GetTable ($dbn, $Query, $Row, $iRows, $iColumns); lagrar uppdragets id i $row['id'] $updateradio= "$radio" & $Row['typ']; Puts together the variable name for the actual controlID GUICtrlSetData ($idinfo, $Row['id']) GUICtrlSetData ($uppdrag, $Row['uppdrag']) GUICtrlSetData ($kontaktperson, $Row['kontaktperson']) GUICtrlSetData ($tel1, $Row['tel1']) GUICtrlSetData ($tel2, $Row['tel2']) GUICtrlSetData ($till, $Row['till']) GUICtrlSetData ($deltagare, $Row['deltagare']) GUICtrlSetState ( eval($updateradio), $GUI_CHECKED) EndFunc I think there is something wrong with the multidimensional arrays that should provide the new field values. (I've been working with mysql earlier so it is possibble that i've done something that doesn't work i SQLite Also i'm not sure that the eval thing will work. Any one that knows why? Link to comment Share on other sites More sharing options...
PhilipG Posted November 12, 2009 Author Share Posted November 12, 2009 Since this is a new problem I've decided to start a new topic. Thanks för the help on the first prob. Link to comment Share on other sites More sharing options...
Valuater Posted November 12, 2009 Share Posted November 12, 2009 Might want to check-out "Autoit Wrappers" it has some great scriplets to help YOUR script 8) 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