Jump to content

Problem with picture updating...


sherkas
 Share

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 )
EndFunc

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.

Link to comment
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)
    EndIf
    If $msg = $apply Then
        GUICtrlSetImage ($pic , $o)
    EndIf
WEnd

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]

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...