Jump to content

Search the Community

Showing results for tags 'guictrlsetstate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 5 results

  1. Hello everyone, I have a radio button ($Radio1), which I want to disable as soon as another one get's checked (Radio5). (The system fails if the radio button i'm troubling with also gets checked). I know how to disable him: If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_DISABLE) Then GUICtrlSetState($Radio5, 128) But if i try to enable $Radio5 again, after $Radio1 isn't checked anymore, it fails: If GUICtrlRead($Radio1)=Not 1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_ENABLE) Then GUICtrlSetState($Radio5, 64) Anyone knows why?
  2. I need to automate a specific GUI from a legacy system written in C. The spy tool gives me this I use this code Local $swintit = WinGetTitle("[active]") ConsoleWrite("active Window " & $swintit & @CRLF) If $swintit = "FILES NOTES" Then ; If $swintit = "FILES NOTES" Then ; got Window, now atomate ConsoleWrite("got Window " & @CRLF) ; now focus, then click :) ;EditPaste ;ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(404, $GUI_Focus) ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(401, $GUI_Focus) ControlClick("FILES NOTES", "", 401, $acno) ; click okay EndIf ; If $swintit = "FILES NOTES" Then The idea is to paste the acno value into the edit box, then click an Okay button. I get a console write that the active Window is as expected, but my loop completes without ever writing anything into the GUI. I also tried the control ID as text "404" - same result What am I missing? Skysnake
  3. Hi all, I have the following snippet of code that sort of works but isn’t doing exactly what I want. expand popup #include <GuiConstants.au3> Global $gGUIWidth = 250 Global $gGUIHeight = 150 Initial() Func Initial()    ; Create the initial GUI    $BaseGUI = GUICreate("", $gGUIWidth, $gGUIHeight, -1, -1, -1, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)    GUISetState(@SW_SHOW, $BaseGUI)    ; Create a field for entering the current value    GUICtrlCreateLabel("Current Value:",  10, 10)    $CurrentValueFld = GUICtrlCreateInput("", 10, 40, 215, 20, $ES_NUMBER)    GUICtrlSetState($CurrentValueFld, $GUI_FOCUS)    ; Create Calculate button    Local $CalculateButton = GUICtrlCreateButton("Calculate", 10, 70, 75, 25)    GUICtrlSetState($CalculateButton, $GUI_DISABLE)    ; Watch the value field and determine if the value is greater than 0 and if so, enable Calculate button    $i = 0    Do       $CurrentValue = GUICtrlRead($CurrentValueFld)       If $CurrentValue > 0 Then          GUICtrlSetState($CalculateButton, $GUI_ENABLE + $GUI_FOCUS)          $i = 1       EndIf    until $i = 1    ;Loop until the user exits and check for ESC, "X", or Begin button    While 1       $InitialGUIMsg = GUIGetMsg()       If $InitialGUIMsg = $GUI_EVENT_CLOSE Then          Exit       EndIf    WEnd EndFunc I want to be able to: Start with focus in the value field (it is doing this now) Allow for more than one digit to be entered into the field (it is sort of doing this now but I have to bring focus back to the field) Enable the Calculate button and give focus to it once a value is entered into the value field (it is doing this now) but keep the cursor in the value field so the more digits can be entered (it is not doing this now) Be able to hit ESC or “X” to close the dialog at any time (this only works after I enter a digit in the value field Basically, I want to be able to allow the user to enter one or more digits and hit ENTER or SPACE (while the cursor is still in the value field) to push the Calculate button. I assume I need to bring focus to the button but maybe I don't and can get away with assigning hotkeys for ENTER and SPACE to push the Calculate button while keeping focus in the value field. If you could, please add comments in your code as to what the changes are doing if they aren't obvious to a noobish programmer. Thanks for any help you can offer on this.
  4. I have been trying to figure out how to get my GUI to do what I want. I am including sample code below that has what I'm working with. Essentially, what I want is for 4 list views to control the visibility and the ability to change data on a sub GUI. The primary gui has the 4 list views and a tab control (as well as 3 tabs). I want to be able to click on the first list view and have it activate the first tab and allow the values to be changed (the example only has a label). When the 2nd list view is clicked, I want it to disable the first tab and enable the 2nd tab for editing. When the 3rd list view is clicked, I want the 3rd tab to be activated and editable, and when the 4th list view is clicked, I want all tabs to be visible but not editable. Preferably, I'd like to have the 2nd and 3rd tab hidden if the first list view is selected, but I'll settle for it just being disabled. Can anyone point out what I'm doing wrong? The disable commands I have before any of the case statements don't seem to do anything and I'm struggling to figure out how to tweak this to achieve what I'm looking for. Here is my code: #include <WindowsConstants.au3> ; $WS_Maximizebox #include <GUICombobox.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> Entry() Func Entry() Local $riskID Global $aGUIChildren[3], $labArea[3] Global $RiskGUI = GUICreate("Entry", 960, 500) GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman") $iStart = GUICtrlCreateDummy() global $idRisksFirst = GUICtrlCreateListView("", 16, 48, 161, 97) global $idRisksSecond = GUICtrlCreateListView("", 16, 152, 161, 97) global $idRisksThird = GUICtrlCreateListView("", 16, 256, 161, 97) global $idRisksFinal = GUICtrlCreateListView("", 16, 360, 161, 97) $iEnd = GUICtrlCreateDummy() local $testVals[3][3]=[[1,2,3],[1,2,3],[1,2,3]] For $i = $iStart To $iEnd _GUICtrlListView_AddColumn($i,"ID",25) _GUICtrlListView_AddColumn($i,"Type",70) _GUICtrlListView_AddColumn($i,"Entered By",65) Next _GUICtrlListView_AddArray($idRisksFirst,$testVals) _GUICtrlListView_AddArray($idRisksSecond,$testVals) _GUICtrlListView_AddArray($idRisksThird,$testVals) _GUICtrlListView_AddArray($idRisksFinal,$testVals) GUIRegisterMsg($WM_NOTIFY, "LV_NOTIFY") $newFirst = GUICtrlCreateButton("New", 183, 78, 27, 25) $newSecond = GUICtrlCreateButton("New", 183, 190, 27, 25) $btnRefresh = GUICtrlCreateButton("Refresh", 844, 96, 75, 25) Global $Tabs = GUICtrlCreateTab(216, 48, 577, 440) $tab1=GUICtrlCreateTabItem("First") GUICtrlSetState($tab1,$GUI_HIDE) $tab2=GUICtrlCreateTabItem("Second") GUICtrlSetState($tab2,$GUI_HIDE) $tab3=GUICtrlCreateTabItem("Final") GUICtrlSetState($tab3,$GUI_HIDE) $aGUIChildren[0]=SubGui($aGUIChildren,0,True) $aGUIChildren[1]=SubGui($aGUIChildren,1,True) $aGUIChildren[2]=SubGui($aGUIChildren,2,True) GUISetState(@SW_SHOW,$RiskGUI) GUISetState(@SW_SHOW,$aGUIChildren[0]) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($RiskGUI) GUIDelete($aGUIChildren[0]) GUIDelete($aGUIChildren[1]) GUIDelete($aGUIChildren[2]) ExitLoop Case $Tabs ; Hide/show children depending on tab selected For $i = 0 To 2 GUISetState(@SW_HIDE, $aGUIChildren[$i]) Next GUISetState(@SW_SHOW, $aGUIChildren[GUICtrlRead($Tabs)]) EndSwitch WEnd EndFunc Func SubGui($aGUIChildren,$index,$Disabled=False) $aGUIChildren[$index] = GUICreate("", 564, 409, 220, 70,$WS_POPUP,$WS_EX_MDICHILD,$RiskGUI) $iStart = GUICtrlCreateDummy() $labArea[$index] = GUICtrlCreateLabel("Area", 13, 8, 70, 17) $iEnd = GUICtrlCreateDummy() If $Disabled=True then For $i = $iStart To $iEnd GUICtrlSetState($i, $GUI_DISABLE) Next EndIf Return $aGUIChildren[$index] EndFunc Func LV_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView1,$hWndListView2,$hWndListView3,$hWndListView4, $tInfo If Not IsHWnd($idRisksFirst) Then $hWndListView1 = GUICtrlGetHandle($idRisksFirst) If Not IsHWnd($idRisksSecond) Then $hWndListView2 = GUICtrlGetHandle($idRisksSecond) If Not IsHWnd($idRisksThird) Then $hWndListView3 = GUICtrlGetHandle($idRisksThird) If Not IsHWnd($idRisksFinal) Then $hWndListView4 = GUICtrlGetHandle($idRisksFinal) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView1 Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button MsgBox(0,"","Left Click on First Line") Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button MsgBox(0,"","Right Click on First Line") EndSwitch Case $hWndListView2 Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button MsgBox(0,"","Left Click on Second Line") GUICtrlSetState($tabs,$GUI_ENABLE) Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button MsgBox(0,"","Right Click on Second Line") EndSwitch Case $hWndListView3 Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button MsgBox(0,"","Left Click on Third Line") Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button MsgBox(0,"","Right Click on Third Line") EndSwitch Case $hWndListView4 Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button MsgBox(0,"","Left Click on Final Line") Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button MsgBox(0,"","Right Click on Final Line") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
  5. Hello, I am trying to hide all the controls in my GUI. Is it possible to do an easier way than to use GUICtrlSetState on every single Control I have?
×
×
  • Create New...