Valnurat

[SOLVED] Small question about CheckBox

1 post in this topic

#1 ·  Posted (edited)

I have created a checkbox and a date component by doing this:
 

$idDate = GUICtrlCreateDate("", 270, 190, 120, 20) ;330
GUICtrlSetState($idDate, $gui_disable)

$idCheckBox = GUICtrlCreateCheckbox("End date:", 190, 190, 65, 20, BitOR($BS_RIGHTBUTTON, $BS_CHECKBOX))

and to check if it's checked or not I do this:

If _IsChecked($idCheckbox) Then
    GUICtrlSetState($idDate,$gui_enable)
Else
    GUICtrlSetState($idDate,$gui_disable)
EndIf



Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

but the checkmark is not shown and the date component will not be enabled or disabled for that matter, but if I do this:

$idCheckBox = GUICtrlCreateCheckbox("End date:", 190, 190, 65, 20)

It works. But then the text on the checkbox, is on the wrong side.

Do I do something wrong with my creation of the checkbox?

 

EDIT:

$idCheckBox = GUICtrlCreateCheckbox("End date:", 190, 190, 65, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHTBUTTON))

 

Edited by Valnurat
Found the solution

Yours sincerely

Kenneth.

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

  • Similar Content

    • FMS
      XML search get change settings.
      By FMS
      Hello ,
      I've the following problem and hope somebody can push me in the right direction or have a good example on how to do it.
      The problem is :I want to search / select / change /check a XML setting in a XML file.
      The example XML file is as following :
      <Configuration> <Categories> <Category Name="default"> <SubCategories> <SubCategory Name="defaultsettings"> <Settings> <Setting Name="machinename" TypeName="System.String" Value="defaultname" /> <Setting Name="cpuspeed" TypeName="System.String" Value="false" /> <Setting Name="cmptemp" TypeName="System.String" Value="false" /> <Setting Name="cmpspeed_set" TypeName="System.String" Value="" /> <Setting Name="cmptemp_set" TypeName="System.String" Value="" /> </Settings> </SubCategory> </SubCategories> </Category> <Category Name="settings"> <SubCategories> <SubCategory Name="comp1"> <Settings> <Setting Name="machinename" TypeName="System.String" Value="comp1" /> <Setting Name="cpuspeed" TypeName="System.String" Value="true" /> <Setting Name="cmptemp" TypeName="System.String" Value="false" /> <Setting Name="cmpspeed_set" TypeName="System.String" Value="12" /> <Setting Name="cmptemp_set" TypeName="System.String" Value="" /> </Settings> </SubCategory> <SubCategory Name="comp2"> <Settings> <Setting Name="machinename" TypeName="System.String" Value="comp2" /> <Setting Name="cpuspeed" TypeName="System.String" Value="false" /> <Setting Name="cmptemp" TypeName="System.String" Value="true" /> <Setting Name="cmpspeed_set" TypeName="System.String" Value="" /> <Setting Name="cmptemp_set" TypeName="System.String" Value="9" /> </Settings> </SubCategory> </SubCategories> </Category> </Categories> </Configuration> In this XML file I want to :
      -search if subcategory whit the name "comp3" exists
      -if exist change of setting "cpuspeed" value to false
      -if not exist make a new subcategory "comp3" whit the default settings from subcategory "default settings"
      what i have this far is :
      Func xml_test1() Dim $return[0] Local $file = @ScriptDir & "\test.xml" FileOpen($file, $FO_READ) _FileReadToArray($file,$return) FileClose($file) msg("",$return[28]) msg("",$return[29]) EndFunc func xml_test2() Local $file = @ScriptDir & "\test.xml" Local $oXML = ObjCreate("Microsoft.XMLDOM") ;~ $oXML.load("D:\___BUILDS___\___SRMT___\test.xml") $oXML.load($file) $oOther= $oXML.SelectSingleNode("//Configuration/Categories/Category/SubCategories/SubCategory/Settings/Setting") ; or //other ConsoleWrite("$oOther.text=[" & $oOther.text & "]" & @CRLF) EndFunc i know it is not enough what I'm trying to do but I'm realy stuk in what to do next.
      I've searched in the XML.udf but could not find in the examples what to do what i want to do.
      The things what i found are about <settings>false</settings> writing style of XML and not the way I've the XML.
      (or I'm reading it wrong)
      Is there somebody who can help me on mine way or has a good example script?
      Thanks in advanced
       
    • Valnurat
      Read of an AD attribute of Octet String syntax
      By Valnurat
      How do you read AD attribute: thumbnailPhoto and show the picture? It is a syntax of octet string.
      I have no code for this.
    • genius257
      Is it possible to throw an error in a ScriptControl object, via AutoIt
      By genius257
      First of all I've been searching on the forum, and while there's been done something like this with: https://www.autoitscript.com/forum/topic/141004-comobject-proxy-seamless-windows-script-control-autoitobj/
      I could not find any solution to my predicament.
       
      Is it possible to throw an error in a ScriptControl object, via AutoIt?
      I have a script, where AutoIt calls ScriptControl:JavaScript which in turn calls AutoIt.
      However i would like to be able to make AutoIt invoke an exception within ScriptControl, if the called functionality fails.
      Here's some code for reference:
      #AutoIt3Wrapper_Run_AU3Check=n #include-once #include "AutoitObject.au3" #include <WinAPIDiag.au3> $oJS = ObjCreate("ScriptControl") $oJS.Language = "JScript" $oJS.TimeOut = 0; A value of 0 means that the ScriptControl will monitor the execution of the script and will trigger the Timeout event if it determines that the script is hung. _AutoItObject_Startup() $oAutoIt = _AutoItObject_Create() _AutoItObject_AddMethod($oAutoIt, "Execute", "_Execute", False) $oJS.AddObject("AutoIt", $oAutoIt, True) OnAutoItExitRegister("_CleanUp") $_AutoItError = ObjEvent("AutoIt.Error", "_AutoItError") Func _CleanUp() ConsoleWrite("Cleaning up..."&@CRLF) $oJS = 0 $oAutoIt = 0 _AutoItObject_Shutdown() EndFunc Func _Execute($oSelf, $sString) $vReturn = Execute($sString) If @error<>0 Then Return $oJS.Eval("throw new SyntaxError();"); Does invoke exception, but not within the try/catch Return $vReturn EndFunc Func _AutoItError($oError) $oError2 = $oJS.Error ConsoleWrite( _ "Column: " & $oError2.Column & @CRLF & _ "Description: " & $oError2.Description & @CRLF & _ "HelpContext: " & $oError2.HelpContext & @CRLF & _ "HelpFile: " & $oError2.HelpFile & @CRLF & _ "Line: " & $oError2.Line & @CRLF & _ "Number: " & $oError2.Number & @CRLF & _ "Source: " & $oError2.Source & @CRLF & _ "Text: " & $oError2.Text & @CRLF _ ) $oError2.Clear() EndFunc $oJS.Eval("(function(){"& _ "try{"& _ "AutoIt.Execute('MsgBox(0,\'\', \'a\')');"& _ "AutoIt.Execute('a.b');/*error should occur here*/"& _ "AutoIt.Execute('MsgBox(0,\'\', \'b\')');"& _ "}catch(e){"& _ "AutoIt.Execute('ConsoleWrite(\'Error\'&@CRLF)');"& _ "}"& _ "})()")  
    • PELock
      Legal AutoIt
      By PELock
      Hi, I'm asking here because I can't get an answer at the official contact mail.
      Is it legal to name software products using "AutoIt" word in it. I saw some 3rd party tools with "AutoIt" word that's why I'm asking.
      So is it legal to name something e.g.:
      "AutoIt Extractor"
      "AutoIt Editor"
      etc.
      ?
    • Miliardsto
      Timers Crashing
      By Miliardsto
      I do my timers like this by clicking checkbox function is called and timer is set up.
      There is a trouble cause I got so many Timers, 20 like this below and I can see if they is launched 5 timers program starts freezing and often crashing.
      I know it takes memory but is is right way to do timers like that or what should i do?
      Case $checkerSS If GUICtrlRead($CheckerOne) = 1 Then $ss = _Timer_SetTimer($Form1,4000,"checkScreen") Else _Timer_KillTimer ($Form1,$ss) EndIf Case $checkerPos If GUICtrlRead($DiscAlert) = 1 Then $disc = _Timer_SetTimer($Form1,20000,"checkPosition") Else _Timer_KillTimer ($Form1,$disc) EndIf Case $checkerVars If GUICtrlRead($AlertPlayerPos) = 1 Then $ap = _Timer_SetTimer($Form1,15000,"checkVars") Else _Timer_KillTimer ($Form1,$ap) EndIf