Madza91 Posted December 1, 2007 Share Posted December 1, 2007 Hi, i don't know why is this code bugged? When press on add,browse and select picture press ok, and that again press add and than picture disappear,why? (sorry for bad english) expandcollapse popup#include <GuiConstants.au3> $defpic = "data\pic.dll" $pictureopen = "data\pic.dll" $gui = GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1 = GuiCtrlCreateButton("Add new", 70, 240, 110, 40) $Pic2 = GuiCtrlCreatePic($defpic, 50, 40, 290, 170) $Button_3 = GuiCtrlCreateButton("Exit", 210, 240, 110, 40) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_3 Exit Case $msg = $Button_1 novi() EndSelect WEnd Exit Func novi() GUISetState(@SW_DISABLE, $gui) $child3 = GUICreate("Add", 447, 412, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOOLWINDOW),$gui) $Pic3 = GUICtrlCreatePic($defpic, 50, 50, 100, 100) $browse = GUICtrlCreateButton("Browse", 50, 165, 100, 23) $remove = GUICtrlCreateButton("Delete", 50, 191, 100, 23) $unosok = GUICtrlCreateButton("OK", 279, 382, 75, 23) GUICtrlSetState($unosok, $GUI_DEFBUTTON) $unoscancel = GUICtrlCreateButton("Cancel", 360, 382, 75, 23) GUISetState() Do $msg1 = GUIGetMsg() If $msg1 = $browse Then $pictureopen = FileOpenDialog("Izaberite sliku novog kontakta!", @DesktopDir & "\", "Jpeg (*.jpg;*.jpeg;*.jpe;*.jfif)|Bmp (*.bmp)|Gif (*.gif)|Svi podrzani fajlovi (*.bmp;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif)") GUICtrlSetImage($Pic3, $pictureopen) EndIf If $msg1 = $remove Then GUICtrlSetImage($Pic3, "") EndIf If $msg1 = $unosok Then GUICtrlSetImage($Pic2, $pictureopen) ExitLoop EndIf Until $msg1 = $GUI_EVENT_CLOSE Or $msg1 = $unoscancel GUISetState(@SW_ENABLE, $gui) GUIDelete($child3) EndFunc ;==>novi [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
themax90 Posted December 1, 2007 Share Posted December 1, 2007 (edited) Not sure if this is the reason - but try declaring your GUI variables using Global. Edit : Also - we don't all have data/pic.dll. So if there are any files try and include them in the post next time. Edited December 1, 2007 by AutoIt Smith Link to comment Share on other sites More sharing options...
Madza91 Posted December 1, 2007 Author Share Posted December 1, 2007 Sorry for that,here is my script...when launching script and press add for example choose this pic: C:\WINDOWS\blue Lace 16.bmp and see bug [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
themax90 Posted December 1, 2007 Share Posted December 1, 2007 (edited) $Pic3 = GUICtrlCreatePic(@ScriptDir & "\" & $defpic, 50, 50, 100, 100) That should fix it. Once you use FileOpenDialog it is changing the Working Directory. Adding MsgBox(0, "", @WorkingDir) before $Pic3 will show you this. Edited December 1, 2007 by AutoIt Smith 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