ledigeine Posted November 8, 2012 Posted November 8, 2012 (edited) EDIT: redoing the body since i know nobody wanted to read all that. I will try a more direct question so i get at least some help. Ok I need help with how i should make the state of a check box in some way alter an XML node. (when enabled make the node 1 if disabled make it 0) Right now i have a check box then a Apply button. SO the xml will not update each time the check box is used but just click apply then check the state of the check box control. Here $clearwin is the check box, if it = 1 then its enabled and for some reason if its 4 its disabled. Should this work out just fine if this code is in my while? Case $applyB ;check the check box state and update the xml with 1 or 0 If GUICtrlRead($clearwin) = 1 Then _XMLUpdateField("/eb/settings/delwin", "1") Else _XMLUpdateField("/eb/settings/delwin", "0") EndIf Right now it will work the first time, then if i open the UI again it will loop through this updating the xml to 1 and 0 over and over again. Edited November 9, 2012 by ledigeine
ledigeine Posted November 9, 2012 Author Posted November 9, 2012 bump, i updated the OP to make it hopefully easier to understand.
jdelaney Posted November 9, 2012 Posted November 9, 2012 (edited) ;~ State Comments ;~ No Change 0 ;~ $GUI_UNCHECKED Radio, Checkbox or ListViewItem will be unchecked. ;~ $GUI_CHECKED Radio, Checkbox or ListViewItem will be checked. #include <GUIConstantsEx.au3> ConsoleWrite ( $GUI_UNCHECKED & $GUI_CHECKED ) ; just an example, to check if check is present If BitAND(GUICtrlRead($Checkbox_RefreshExams), $GUI_CHECKED) Then MsgBox(1, "Warning", "Warning: It takes roughly 25 minutes to refresh exams.", 5) Possible for controls to have multiple states (returned through guictrlgetstate or guictrlread), so you should be doing a BitAND to validate it is checked/unchecked. edit: added a sample Edited November 9, 2012 by jdelaney ledigeine 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
ledigeine Posted November 9, 2012 Author Posted November 9, 2012 Thank you lemme check this out and see whats going on.
ledigeine Posted November 9, 2012 Author Posted November 9, 2012 Ok cool that did it.... i still dont get bitand i use it a few times but not because i know how it works haha. THank you sir.
Moderators Melba23 Posted November 9, 2012 Moderators Posted November 9, 2012 ledigeine, i still dont get bitandOften parameters are made up of separate elements which set different bits within them. For example in my RecFileListToArray UDF I do this sort of thing: ; Add one or more of the following to $iReturn to omit files/folders with that attribute ; + 4 - Hidden files and folders ; + 8 - System files and folders ; + 16 - Link/junction folders If we look at $iReturn in binary form we can see that each of those separate values sets a different bit so if we use them all we get: Bit value 128 64 32 16 8 4 2 1 0 0 0 1 1 1 0 0 = 28 in decimal (4+8+16) Now it is quite difficult to look at the decimal value and say whether one of those bits is set - but with BitAND it is very easy - here is an example to see if the +8 parameter was set: Bit value 128 64 32 16 8 4 2 1 Our value 0 0 0 1 1 1 0 0 8 0 0 0 0 1 0 0 0 BitAND(value, 8) looks to see if both bits are set, so we get a return of 0 0 0 0 1 0 0 0 And we can see that in this case the 8 bit was set. BitOR will set the bit if either of the parameter bits are set - look in the Setting Styles tutorial in the Wiki to see why we do this rather than simple addition to combine styles. I hope that explains a bit what is going on with the Bit* functions - they are not the easiest to understand but they are very useful. M23 jdelaney 1 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
ledigeine Posted November 9, 2012 Author Posted November 9, 2012 thanks for the help there too, yeah i see them all over and try to keep away. It just sucks when its something i need and i didnt even know it ha.
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