Jump to content

Recommended Posts

Posted

It's been a minute here since I last used Autoit for a project, so I am getting back into this for a GUI project. I am wondering if someone can help me why the Picture doesn't update when I click a menu item and it resizes the gui and recreates the Picture control?
I've tried adding GUICtrlDelete($pic) after the Test menu option is selected but to no avail. The picture just doesn't display when i try to update it after clicking the menu button.


 

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <StaticConstants.au3>

#Region ### START Koda GUI section ### Form=
$formMain = GUICreate("TestGUI", 400, 150, 50, 50)
$pic = GUICtrlCreatePic(@TempDir & "\test.jpg",10,20,50,50)
$menuItemFile = GUICtrlCreateMenu("&File")
$menuFileTest = GUICtrlCreateMenuItem("&Test", $menuItemFile)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $menuFileTest
            WinMove("TestGUI","",50,50,600,600)
            $pic = GUICtrlCreatePic(@TempDir & "\test2.jpg",10,20,600,600)
    EndSwitch
WEnd

 

Posted (edited)

Try :

[...]
        Case $menuFileTest
            GUICtrlDelete($pic)
            WinMove("TestGUI","",50,50,600,600)
            $pic = GUICtrlCreatePic(@TempDir & "\test2.jpg",10,20,600,600)           
[...]

EDIT :

It works fine for me with GUICtrlDelete($pic)
Just to make sure both .jpg files are present, copy them to the script directory and use @ScriptDir instead of @TempDir.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted

Thanks Musashi. I thought this would work for me too, but for some reason it isn't.

I tried using @ScriptDir too, but this didn't help. All I see is this. No image inside
 

Capture.JPG

Posted

Zedna, I did try GUICTRLSETImage, and that actually does show the image. However, the image that is shown is so small it's not using the pixel size of the actual image. Looks like 128x128, which from the help suggest that this function is for icons, so makes sense. Not really what I want.
 

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
  • Recently Browsing   0 members

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