Jump to content

Polska

Members
  • Posts

    3
  • Joined

  • Last visited

Polska's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I've been working on a project to make my life easier at work where I've created a simple GUI to automate the tedious process of entering and filling out tickets in another application we'll call "Ticketer". So a lot of how this works is that I fill out various fields in my GUI, and then press a "Create Ticket" button. This shifts over to the Ticketer, and fills out various fields and pushes various buttons by a combination of sending data to controls directly, using the clipboard and even some SendKey() calls. The problem lies in that Ticketer talks to a SQL Server and at times its reaction can be slower than others, sometimes causing the actions kicked off by "Create Ticket" to lose synchronization and start to send data to controls that aren't visible or to the wrong fields. I want a way to just hit the "Create Ticket" button again to stop this action when this occurs, but since this is a single-process, single-threaded application I can't do anything until the function returns. I did some searching on threading and came up with a couple posts from back in 2006 with less than elegant solutions, and a lot of other things where interprocess communication happens via sockets or temporary files. For simplicities sake I am trying to keep this all within a single executable that I can distribute, which is why I investigated threading first. I am however open to any ideas that allow me to pass parameters to a thread/subprocess, communicate with it in real time, and receive a return value when it is completed. I don't know if things have changed in the last 4 years or if most IPC is still done through sockets and files, but I am open to any suggestions of possible routes to take by those more experienced.
  2. That makes perfect sense given what was happening and I expected that this might be the case. I guess I had assumed I could use the height and width returned by WinGetClientSize() as it is in the same family of functions, and was referenced as related in the documentation. Thanks for leading me in the right direction!
  3. I am currently working on a project to automate repetitive tasks at work. Data is entered into a form and the design requires that certain fields and other controls only display when certain controls are selected (primarily check boxes). Due to this I need a manageable way to re-size the form window on a check box event. I experimented with wrapping the GUI code in a function so the entire form is redrawn when the check box is checked or unchecked. This has turned out to not be very maintainable as I need to save all currently entered data and other control states when recreating the form with the new size (and adding new controls). Ideally I would simply be able to change the existing window size and move existing controls down as needed to make room for new ones (and vice versa). Searching the forums here I found mention of the WinMove() function which at first glance appeared to offer this functionality. When called like this: WinMove( "FormTitle", "", Default, Default, $newWidth, $newHeight ) A strange thing happens, however. When doubling the height of the form window (as determined by GetClientWindow()) it only gets marginally larger, and when halving it back to the original height it is smaller than when it started. Here is the original size: Here is the doubled size: And then halved, when it should return to the original: Here is the relevant code: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt( 'GUIOnEventMode', 1 ) Global Const $TITLE = "Expand" ; GUI Code Global $Window = GUICreate($TITLE, 429, 36, 200, 124) Global $Checkbox1 = GUICtrlCreateCheckbox("Expand 1", 8, 8, 97, 17) GUISetState(@SW_SHOW) ; Global state variables associated with the GUI Global $WindowSize = WinGetClientSize( $TITLE ) Global $WindowWidth = $WindowSize[0] Global $WindowHeight = $WindowSize[1] ; Register callbacks GUICtrlSetOnEvent( $Checkbox1, "Checkbox1" ) Func Checkbox1() If GUICtrlRead( $Checkbox1 ) = $GUI_CHECKED Then DebugWindow() $WindowHeight *= 2 UpdateWindow() DebugWindow() Else DebugWindow() $WindowHeight /= 2 UpdateWindow() DebugWindow() EndIf EndFunc Func DebugWindow() MsgBox( 0, "Debug", "Window Size: " & @CRLF & @CRLF & _ "Window width: " & $WindowWidth & @CRLF & _ "Window height: " & $WindowHeight ) EndFunc Func UpdateWindow() WinMove( $TITLE, "", Default, Default, $WindowWidth, $WindowHeight ) EndFunc ; Main idle loop While 1 Sleep(1000) WEnd I'm sure this is a case of my doing something wrong, and if anyone has any ideas I would greatly appreciate any input. Alternately, if anyone has used another, more viable method for handling window resizing I am also open to suggestions. Thanks in advance!
×
×
  • Create New...