sherkas Posted January 15, 2008 Share Posted January 15, 2008 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 More sharing options...
star2 Posted January 15, 2008 Share Posted January 15, 2008 (edited) 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 January 16, 2008 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 More sharing options...
rasim Posted January 16, 2008 Share Posted January 16, 2008 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). Link to comment Share on other sites More sharing options...
sherkas Posted January 16, 2008 Author Share Posted January 16, 2008 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. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now