Sign in to follow this  
Followers 0
Damein

Moving Buttons/Image with Resizing

3 posts in this topic

So I found a script that it had a GUI and RichEdit included in it that could be resized together, but when I attempted to implement this into my Weather script, I could resize the window, but not everything.

Here is the script with the attempted resizing.

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Gui2, $Error

Opt("GUIOnEventMode", 1)

DirCreate(@TempDir & "\Weather")
InetGet("http://i.imwx.com/images/maps/current/acttemp_600x405.jpg", @TempDir & "\Weather\Temp.jpg", 1, 0)
InetGet("http://image.weather.com/images/maps/current/curwx_600x405.jpg", @TempDir & "\Weather\Current.jpg", 1, 0)
InetGet("http://image.weather.com/web/radar/us_radar_plus_usen.jpg", @TempDir & "\Weather\Doppler.jpg", 1, 0)
InetGet("http://image.weather.com/web/forecast/us_wxhi1_large_usen_600.jpg", @TempDir & "\Weather\Forecast.jpg", 1, 0)
InetGet("http://image.weather.com/images/sat/ussat_600x405.jpg", @TempDir & "\Weather\Infrared.jpg", 1, 0)
InetGet("http://i.imwx.com/images/maps/special/severe_us_600x405.jpg", @TempDir & "\Weather\Severe.jpg", 1, 0)
$TempImage = @TempDir & "\Weather\Temp.jpg"
$CurrentWeatherImage = @TempDir & "\Weather\Current.jpg"
$DopplerImage = @TempDir & "\Weather\Doppler.jpg"
$ForecastImage = @TempDir & "\Weather\Forecast.jpg"
$InfraredImage = @TempDir & "\Weather\Infrared.jpg"
$SevereImage = @TempDir & "\Weather\Severe.jpg"

$Gui = GuiCreate("Weather.com", 600,480,Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$OptionsMenu = GuiCtrlCreateMenu("Options")
$CurrentWeather = GuiCtrlCreateMenuItem("Current Surface", $OptionsMenu)
GUICtrlSetOnEvent($CurrentWeather, "CurrentSurfaceImage")
$CurrentTemp = GuiCtrlCreateMenuItem("Current Temperatures", $OptionsMenu)
GUICtrlSetOnEvent($CurrentTemp, "CurrentTempImage")
$DopplerRadar = GuiCtrlCreateMenuItem("Doppler Radar", $OptionsMenu)
GUICtrlSetOnEvent($DopplerRadar, "DopplerRadarImage")
$Forecast = GuiCtrlCreateMenuItem("US Forecast", $OptionsMenu)
GUICtrlSetOnEvent($Forecast, "ForecastImage")
$Infrared = GuiCtrlCreateMenuItem("Infrared Satellite", $OptionsMenu)
GUICtrlSetOnEvent($Infrared, "InfraredImage")
$Severe = GuiCtrlCreateMenuItem("Severe Weather Alerts", $OptionsMenu)
GUICtrlSetOnEvent($Severe, "SevereImage")
$MainImage = GUICtrlCreatePic($CurrentWeatherImage, 0, 0, 600, 400)
$OverViewForecast = GuiCtrlCreateButton("Overview Forecast", 0,400)
GUICtrlSetOnEvent($OverViewForeCast, "OverView")
$HourlyForecast = GuiCtrlCreateButton("Hourly Forecast", 130,400)
GUICtrlSetOnEvent($HourlyForecast, "Hourly")
$TomorrowsForecast = GuiCtrlCreateButton("Tommorrow's Forecast", 245, 400)
GUICtrlSetOnEvent($TomorrowsForecast, "Tomorrow")
$WeekendForecast = GuiCtrlCreateButton("Weekend Forecast", 390, 400)
GUICtrlSetOnEvent($WeekendForecast, "Weekend")
$5DayForecast = GuiCtrlCreateButton("5-Day Forecast", 515, 400)
GUICtrlSetOnEvent($5DayForecast, "FiveDay")
$ZipCode = GuiCtrlCreateEdit("Enter your zip code here", 230, 440, 140,20)
GuiSetState(@SW_SHOW)

While 1
    Switch GuiGetMsg()        
    Case -3
            Exit
        Case $GUI_EVENT_RESIZED
        $aPos = WinGetClientSize($Gui)
        ControlMove($Gui, "", $MainImage & $ZipCode & $5DayForecast & $WeekendForecast & $TomorrowsForecast & $HourlyForecast & $OverViewForecast, 10, 10, $aPos[0] - 20, $aPos[1] - 20)
    EndSwitch
    WEnd

Func OverView()
    $ZipCodeToUse = GuiCtrlRead($ZipCode)
    If $ZipCodeToUse = "Enter your zip code here" Then
        MsgBox(48, "Error", "Please type in your zip code")
        $Error = 1
    EndIf
    If $Error = 0 Then
    $PanTask = _IECreateEmbedded()
    $Gui2 = GUICreate("Overview Forecast", 620, 430)
    $PanGUI = GUICtrlCreateObj($PanTask,-40,-500,1024,1024)
    $CreateWindow = _IENavigate ($PanTask, "    http://www.weather.com/weather/today/" & $ZipCodeToUse, 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    GUISetState(@SW_SHOW)
ElseIf $Error > 0 Then
    $Error = 0
    EndIf
    EndFunc

Func Hourly()
        $ZipCodeToUse = GuiCtrlRead($ZipCode)
    If $ZipCodeToUse = "Enter your zip code here" Then
        MsgBox(48, "Error", "Please type in your zip code")
        $Error = 1
    EndIf
    If $Error = 0 Then
    $PanTask = _IECreateEmbedded()
    $Gui2 = GUICreate("Hourly Forecast", 600, 430)
    $PanGUI = GUICtrlCreateObj($PanTask,-40,-600,1024,1024)
    $CreateWindow = _IENavigate ($PanTask, "http://www.weather.com/outlook/health/allergies/hourbyhour/graph/" & $ZipCodeToUse, 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    GUISetState(@SW_SHOW)
ElseIf $Error > 0 Then
    $Error = 0
    EndIf
EndFunc

Func Tomorrow()
    $ZipCodeToUse = GuiCtrlRead($ZipCode)
    If $ZipCodeToUse = "Enter your zip code here" Then
        MsgBox(48, "Error", "Please type in your zip code")
        $Error = 1
    EndIf
    If $Error = 0 Then
    $PanTask = _IECreateEmbedded()
    $Gui2 = GUICreate("Tomorrow's Forecast", 450, 440)
    $PanGUI = GUICtrlCreateObj($PanTask,-120,-570,1024,1024)
    $CreateWindow = _IENavigate ($PanTask, "http://www.weather.com/outlook/health/allergies/wxdetail/" & $ZipCodeToUse & "?dayNum=1", 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    GUISetState(@SW_SHOW)
ElseIf $Error > 0 Then
    $Error = 0
    EndIf
EndFunc

Func Weekend()
    $ZipCodeToUse = GuiCtrlRead($ZipCode)
    If $ZipCodeToUse = "Enter your zip code here" Then
        MsgBox(48, "Error", "Please type in your zip code")
        $Error = 1
    EndIf
    If $Error = 0 Then
    $PanTask = _IECreateEmbedded()
    $Gui2 = GUICreate("Weekend Forecast", 450, 240)
    $PanGUI = GUICtrlCreateObj($PanTask,-125,-497,1024,1024)
    $CreateWindow = _IENavigate ($PanTask, "http://www.weather.com/outlook/health/allergies/weekend/" & $ZipCodeToUse, 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    GUISetState(@SW_SHOW)
ElseIf $Error > 0 Then
    $Error = 0
    EndIf
EndFunc

Func FiveDay()
    $ZipCodeToUse = GuiCtrlRead($ZipCode)
    If $ZipCodeToUse = "Enter your zip code here" Then
        MsgBox(48, "Error", "Please type in your zip code")
        $Error = 1
    EndIf
    If $Error = 0 Then
    $PanTask = _IECreateEmbedded()
    $Gui2 = GUICreate("5-Day Forecast", 600, 330)
    $PanGUI = GUICtrlCreateObj($PanTask,-40,-510,1024,1024)
    $CreateWindow = _IENavigate ($PanTask, "http://www.weather.com/weather/5-day/" & $ZipCodeToUse, 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    GUISetState(@SW_SHOW)
ElseIf $Error > 0 Then
    $Error = 0
    EndIf
EndFunc

Func CurrentSurfaceImage()
    GUICtrlSetImage($MainImage, $CurrentWeatherImage, 22)
    EndFunc

Func CurrentTempImage()
    GUICtrlSetImage($MainImage, $TempImage, 22)
EndFunc

Func DopplerRadarImage()
    GUICtrlSetImage($MainImage, $DopplerImage, 22)
EndFunc

Func ForecastImage()
    GUICtrlSetImage($MainImage, $ForecastImage, 22)
EndFunc

Func InfraredImage()
    GUICtrlSetImage($MainImage, $InfraredImage, 22)
EndFunc

Func SevereImage()
    GUICtrlSetImage($MainImage, $SevereImage, 22)
    EndFunc

While 1
Sleep(100)
    WEnd
    
Func CLOSEClicked()
      If @GUI_WINHANDLE = $Gui Then
    Exit
    EndIf
If @GUI_WINHANDLE = $Gui2 Then
    GuiDelete($Gui2)
  EndIf 
EndFunc

If you run it, you can resize the GUI fine, but everything else stays in place.

Any help would be appreciated, thanks :x


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



Have a look at GUICtrlSetResizing() in the Help File.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

Thank's a lot, that worked :x


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

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
Sign in to follow this  
Followers 0