Jump to content
Sign in to follow this  
ledigeine

[Solved] checkbox update xml

Recommended Posts

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 by ledigeine

Share this post


Link to post
Share on other sites

;~ 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 by jdelaney

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.

Share this post


Link to post
Share on other sites

ledigeine,

i still dont get bitand

Often 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


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...