Jump to content

Making GUI Transitions More Smooth


Go to solution Solved by Spikeedoodles,

Recommended Posts

Hey all, I'm working on something a little more complex and could use some ideas.

I have a GUI that displays new information when a user clicks next or previous.  There are about 10 different controls that are changed every time the user clicks next or previous.  Because AutoIT is a line by line language, it can look sketchy when transitioning to new GUI controls.  I was looking for ideas to make this smoother.  My personal idea was to make a like an animation between screens that would fade away when the new controls are loaded, but I have no idea how to do this.  Anyone have a quick and dirty way to make the transition cleaner?

Link to comment
Share on other sites

Spikeedoodles,

I found this on the forum some time ago.  Don't remember the original author.  Something in here may be of use...

; Animate Display
; Author Raindancer

Global Const $hwnd = GUICreate("Animate Window", 300, 300)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000) ; fade-in

GUISetState(@SW_SHOWNORMAL)

;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00090000) ; fade-out
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001) ; slide in from left
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002) ; slide out to left
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002) ; slide in from right
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050001) ; slide out to right
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040004) ; slide-in from top
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050008) ; slide-out to top
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040008) ; slide-in from bottom
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050004) ; slide-out to bottom
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040005) ; diag slide-in from Top-left
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0005000a) ; diag slide-out to Top-left
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040006) ; diag slide-in from Top-Right
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050009) ; diag slide-out to Top-Right
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040009) ; diag slide-in from Bottom-left
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050006) ; diag slide-out to Bottom-left
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0004000a) ; diag slide-in from Bottom-right
;~ DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050005) ; diag slide-out to Bottom-right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040010) ; explode
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050010) ; implode

#define AW_HOR_POSITIVE     0x00000001
#define AW_HOR_NEGATIVE     0x00000002
#define AW_VER_POSITIVE     0x00000004
#define AW_VER_NEGATIVE     0x00000008
#define AW_CENTER           0x00000010
#define AW_HIDE             0x00010000
#define AW_ACTIVATE         0x00020000
#define AW_SLIDE            0x00040000
#define AW_BLEND            0x00080000

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

It's already in the WinAPI UDFs.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Solution

Alright, so I figured out how to do this.  the WinAPI gave me help, but wasn't exactly what I was looking for (probably too vague).  I wanted the GUI itself to stay open, but the dialogs within the GUI to change smoothly.  WinAPI wasn't helping too much because it would take over the entire window, rather than the dialog inside.

So I did something like this:

1.  Dialog will appear

2.  User will click a button to move to the next page

This code executes:

$lnqbkg=GUICtrlCreatePic (@ScriptDir&"/assets/images/lnqbkg.jpg", 1, 1, 600, 400)
GUICtrlSetState($lnqbkg, $GUI_DISABLE)
guisetstate (@SW_LOCK)

When the loop comes around again (the GUI is based off of one loop that changes the text and controls within it based on an Excel Sheet), this code executes:

;Old controls are deleted and new controls are created here.  A lot of lines, no need to copy and paste them all
GUICtrlDelete ($lnqbkg)
GUISetState (@SW_UNLOCK)

This removes a picture that pretty much says "Loading" and goes back to the GUI.

The key was @SW_LOCK and @SW_UNLOCK ... I did a little research in the help file and found these.  Never knew they existed, quite useful!

 

Thanks for the help of everyone!  Gave me a lot of great ideas about this problem plus some others I'm having.

Edited by Spikeedoodles
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...