Control that acts like a html container with attribute 'hidden'

2 posts in this topic

#1 ·  Posted

Hi all,

i was currently working with html when i got myself the question if there is a windows control that acts like a html container e.g. a div with the hidden attribute. The benfeit is obvious. You can put code in this container and at the moment it is hidden it doesnt take room but when i got visible it uses the room it needs. Is there something i can use with windows forms? :)

Normally one have to recalculate the position of all controls and adjust them manually.

Share this post

Link to post
Share on other sites

#2 ·  Posted

You can use:

  • GuiCtrlSetState($idCtrl, $GUI_HIDE)
  • GuiCtrlSetState($idCtrl, $GUI_SHOW)

You can also look at Melba23 excellent Gui_Extender UDF:


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

    • Psyllex
      By Psyllex
      I have a super simple login screen I'm trying to access that is written in java.  My java testing tools can't access the login screen because it's a modal window.  So I figured I'd see if AutoIt can manipulate 'something' on it.  I can enter text within the text boxes for user name and password.  But I can't see to click on the login button.  I've tried just tabbing to it and hitting the enter key (as I really wouldn't have to be completely interacting with the frame).  But that didn't work.  I was hoping to throw it some coordinates and just double click in that relative area, but when I get the whole " ==> Subscript used on non-accessible variable.:" when I attempt to use ControlGetPos() I'm assuming because it can't truly interact with the Java frame.  So I'm kind of stuck here...can't use AutoIt, can't use a Java automation testing tool to do this due to the modal issues.  Does anyone have any ideas?  My code is below though I think it's less to do with code and more what AutoIt can and can't do.
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $hWnd = WinActivate("[CLASS:sunawtframe]", "Login") Local $aPos = ControlGetPos($hWnd, "[CLASS:SUNAWTFRAME]", "Login") Local $myXPos = $aPos[0] + 420 Local $myYPos = $aPos[1] + 270 Send("guest") Send("{TAB}") Send("guest") Send("{TAB}") ;Tried Control Click it failed ControlClick($hWnd, "", "Login") ;Tried Mouse Click and that failed MouseClick("Left", $myXPos, $myYPos, 2)  
      Thanks for any help!
    • kcvinu
      By kcvinu
      Hi all,
      This code is from an IronPython project. 
      self._button1.Click += self.Button1_Click self._button1.MouseHover += self.Button1_MouseHover def Button1_Click(self, sender, e): System.Windows.Forms.MessageBox.Show("Hi you clicked me ?") pass def Button1_MouseHover(self, sender, e): sender.Text = "Mouse Entered" pass How easy to connect any event function to any control. I know AutoIt can do this with GUICtrlSetOnEvent function.  But this function only takes control ID and function name as parameters. We can't tell AutoIt to act on which event. And for some events, we needs to use GUIRegisterMsg in order to respond some specific messages. My question is ---  Is it possible to do this IronPython way in AutoIt ?
    • kcvinu
      By kcvinu
      Hi all,
      I have a form with 15 textboxes. I need to set all of them disabled when i press a button. So i decided to use a loop. But how can i do it. Any idea ?
    • guinness
      By guinness
      Just a snippet I found in my "snippet folder" which I created back on 8th April 2013 (long time ago!). The idea was for using the controlid value as an index integer in an array. Simple but clever.

      Enjoy. Oh and it's a good lesson for new users who are interested in arrays and gui controls.

      #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> ; Proof of concept for using the controlid as an index item for an array. I created back on 8th April 2013. Example() Func Example() ; Create the GUI. Local $iHeight = 400, $iWidth = 400 Local $hGUI = GUICreate('', $iWidth, $iHeight) GUISetState(@SW_SHOW, $hGUI) ; Declare variables to be used throughout the example. Local Const $BUTTONS = 8 Local Enum $eMESSAGE_ID, $eMESSAGE_STRING, $eMESSAGE_MAX Local $aMsg[1][$eMESSAGE_MAX], _ $iButtonHeight = $iHeight / $BUTTONS, $iButtonWidth = $iWidth / $BUTTONS, $iControlID = 0 For $i = 0 To $BUTTONS - 1 For $j = 0 To $BUTTONS - 1 $iControlID = GUICtrlCreateButton('', $i * $iButtonWidth, $j * $iButtonHeight, $iButtonWidth, $iButtonHeight, $BS_CENTER) GUICtrlSetData($iControlID, $iControlID) ; Increase the size of the array if the controlid is greater than or equal to the total size of the array. If $iControlID >= UBound($aMsg) Then ReDim $aMsg[Ceiling($iControlID * 1.3)][$eMESSAGE_MAX] EndIf ; Add to the array. $aMsg[$iControlID][$eMESSAGE_ID] = 'ControlID: ' & $iControlID $aMsg[$iControlID][$eMESSAGE_STRING] = 'Sample string for controlid value - ' & $iControlID Next Next ; Clear empty items after the last created controlid. ReDim $aMsg[$iControlID + 1][$eMESSAGE_MAX] ; Display the array created. _ArrayDisplay($aMsg) Local $iMsg = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aMsg[$eMESSAGE_ID][$eMESSAGE_ID] To UBound($aMsg) ; If $iMsg is greater than 0 and between the 0th index of $aMsg and the last item then display in the console. If $iMsg Then ConsoleWrite($aMsg[$iMsg][$eMESSAGE_ID] & ', ' & $aMsg[$iMsg][$eMESSAGE_STRING] & @CRLF) EndIf EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example
    • ledigeine
      By ledigeine
      Hello, recently I have started writing up automation scripts in visual studio. These scripts require me to know the (name) field in the properties of controls written in vb6.
      My idea here is to open up the screen in vb6, I won't have the code checked out so i wont have to worry about altering it. Some how cycle through the screen and record the (name) property for each control. The controls are named in a way that I should know if i need them or not. (ex. fraFrame1 wouldn't be needed because its a frame while txtTextbox1 will be needed for me to enter data into it) Once I have all the fields I will be testing, I would want autoit to use those (name)'s to put in as much of the script as possible on my Visual Studio test files. After the mindless part of the testfile is done then I can do the small specifics on my own. So the main issue I have right now is just starting out, I can't think of a way to actually select the controls in vb6 and pull out what is marked in the (name) field. On top of that I have another idea but getting the name is priority 1.  If that was figured out I could maybe figure out how to also check for additional properties.
      Any help on this would be great... i know it sounds more confusing than it actually is since I am not great at explaining things.
      Edit: Might have found a way around checking the actual screen for controls then looking at the Properties section of the screen. It seems I could just open the .ctl file as a text file and run through the document looking for keywords.
      Not 100% how that will work, I would probably want to search the whole document for any (name) properties starting with wte/txt/cbo/wde/mle then save those names into an array? So when I want to dump the data into a new document I could just do a For Each for the items that make up the array.
      Let me know if this sounds like something that might work.