Jump to content
Sign in to follow this  

Problem with picture updating...

Recommended Posts

I have a picture in my GUI I want to update when the user changes the path or clicks the browse button and selects a new picture.

When they click browse it calls the FileOpenDialog and returns the path fine..

It then calls this function:

Func LoadPic( $location )
;$pic = GUICtrlCreatePic("", 256, 24, 172, 180, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
;$path = GUICtrlCreateInput("C:\", 88, 152, 129, 21)

    GUICtrlSetImage ( $pic, $location )
    GUICtrlSetData ( $path, $location )

In that function you can see the original controls also. It doesn't update the picture. What should I be doing or going about it? the pictures I wanted loaded are of the types jpg, gif or bmp.

Share this post

Link to post
Share on other sites

Here's a small example

hope it helps !!

#include <GuiConstants.au3>

$Main = GUICreate ("test", 400,200 )

$pic = GUICtrlCreatePic ("",5,5,390,120)
GUICtrlSetState (-1 , $gui_disable)
$in = GUICtrlCreateInput ("", 10, 130,380, 20)
GUICtrlSetState (-1 , $gui_disable)
$browse = GUICtrlCreateButton ("Browse" , 10, 170,180,25)
$apply = GUICtrlCreateButton ("Apply" , 200, 170,180,25)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $browse Then
        $o = FileOpenDialog ("Select image", @WindowsDir & "\", "Images (*.bmp)" )
        GUICtrlSetData ($in , $o)
    If $msg = $apply Then
        GUICtrlSetImage ($pic , $o)

Edit: [GUICtrlSetState ($pic , $gui_disable)

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post

Link to post
Share on other sites

And don`t forget:

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control : GuiCtrlSetState(-1,$GUI_DISABLE).


Share this post

Link to post
Share on other sites

Thanks, after that reassurence I tried some more and found out taking the extra styles out it worked fine.

So... it works now after i dont use any styles however I used koda so I have no idea what the styles where for anyways.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...