gcue Posted November 24, 2010 Share Posted November 24, 2010 I have two labels that move based on how many items are selected.. "Currently selected: " and "0" which updates with the # of items checkboxed sometimes these overlap...im thinking its a math issue here i create a label: $currently_selected = GUICtrlCreateLabel("Currently Selected:", 399, 380, 90, 15) GUICtrlSetColor(-1, $font_color) GUICtrlSetFont(-1, 7.5, 500) $currently_selected_checkboxes = GUICtrlCreateLabel("0", 494, 380, 6, 15) GUICtrlSetColor(-1, $font_color) GUICtrlSetFont(-1, 7.5, 500) and here is the function that runs when an item is checked and it updates the number and moves the labels accordingly to line up with the gui Func CurrentlySelected() CheckBoxStatus() ;checks how many items are selected and returns that number to $asset_total_count $number_of_digits = StringLen($asset_total_count) $x = $number_of_digits * 6 GUICtrlSetPos($currently_selected, 405 - $x, 380) GUICtrlSetPos($currently_selected_checkboxes, 500 - $x, 380, $x, 15) GUICtrlSetData($currently_selected_checkboxes, $asset_total_count) EndFunc ;==>CurrentlySelected any help is greatly appreciated! Link to comment Share on other sites More sharing options...
SadBunny Posted November 24, 2010 Share Posted November 24, 2010 Tried to reproduce with the following little test but seems all fine to me... GUICreate("test",600,100) $currently_selected = GUICtrlCreateLabel("Currently Selected:", 399, 1, 90, 15) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFF88) GUICtrlSetFont(-1, 7.5, 500) $currently_selected_checkboxes = GUICtrlCreateLabel("0", 494, 1, 6, 15) GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x0088FF) GUICtrlSetFont(-1, 7.5, 500) GUISetState() For $i = 1 To 99999 Step 13 CurrentlySelected($i) Sleep(10) Next Sleep(3000) Exit Func CurrentlySelected($x) $asset_total_count = $x $number_of_digits = StringLen($asset_total_count) $x = $number_of_digits * 6 GUICtrlSetPos($currently_selected, 405 - $x, 1) GUICtrlSetPos($currently_selected_checkboxes, 500 - $x, 1, $x, 15) GUICtrlSetData($currently_selected_checkboxes, $asset_total_count) EndFunc ;==>CurrentlySelected Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
gcue Posted November 24, 2010 Author Share Posted November 24, 2010 (edited) thanks for your help sadbunny.. that was a nice lil way of checking it! =) whew.. thought i had to go back and take 8th grade math.. hmm so it must be something with the way it updates (refreshes) that it messes up.. any ideas? Edited November 24, 2010 by gcue Link to comment Share on other sites More sharing options...
SadBunny Posted November 24, 2010 Share Posted November 24, 2010 Not really, but how and/or when do they overlap? "sometimes" is not a really specific description Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
gcue Posted November 24, 2010 Author Share Posted November 24, 2010 sorry i wish i knew when.. its random been trying to duplicate it for days - no luck so thats why i think it has to do something on the way the data update happens with guictrlsetdata Link to comment Share on other sites More sharing options...
SadBunny Posted November 24, 2010 Share Posted November 24, 2010 (edited) sorry i wish i knew when.. its randombeen trying to duplicate it for days - no luckso thats why i think it has to do something on the way the data update happens with guictrlsetdataThese kinds of weird glitches always intrigue me... I have made a number of scripts that write text to labels often and move those labels around... Never seen this before.But, still one part of my previous question remains: how? I mean, in what way do they overlap, what does it look like? Which label "moves" (i mean, more than it should to), to which direction? (And what Windows version/architecture are you using?) Edited November 24, 2010 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
gcue Posted November 24, 2010 Author Share Posted November 24, 2010 im on windows xp pro overlap example: Currently Selected: 1 you can see something peaking out from the left of the C in Currently and 1 looks like 11 Link to comment Share on other sites More sharing options...
SadBunny Posted November 24, 2010 Share Posted November 24, 2010 Ok so it shifts about a character... Sounds like a bleedthrough effect then? Are you absolutely 100% sure that your code doesn't create a label there more than once in the same place, and later only manipulates the last one it created? Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
gcue Posted November 24, 2010 Author Share Posted November 24, 2010 yep absolutely positive.. i dont create another label.. just using guictrlsetdata Link to comment Share on other sites More sharing options...
SadBunny Posted November 24, 2010 Share Posted November 24, 2010 yep absolutely positive.. i dont create another label.. just using guictrlsetdata I did some tests but I can't find any occurence of this. (And by the way, setting the background color is useful to see how far the label actually extends.) Even if your math were off and/or you would do anything wrong with coordinates, it doesn't seem to me like this should happen when updating windows gui controls in a normal way (like, not "as fast as possible" 1000x per second but just after something is clicked manually) ... So it doesn't sound to me like an XP glitch or an error in the way that AutoIt handles things... To be 101% sure, you could add something like $guiRemoveCounter += 1 If $guiRemoveCounter == 5 Then GUICtrlDelete($currently_selected_checkboxes) EndIf Sleep(3000) ... at the bottom of your func CurrentlySelected and then trigger 5 refreshes... The label should be completely gone, if not then there's a quirk in your script Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
gcue Posted November 24, 2010 Author Share Posted November 24, 2010 right i tried the bkcolor thing on both labels and looks ok.. cant duplicate. ill try ur suggestion.. thanks man! 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