Khryus Posted November 3, 2012 Share Posted November 3, 2012 Hi, I am trying to change the image of a picture control, but the control doesn't seem to update. The control is in another GUI which I run with the main script: main.au3 (main script) packshot.au3 (the other script which contains the GUI which is basically a window with a Picture control inside) I am trying to modify $PACKSHOT (variable inside packshot.au3) from main.au3. I included the script in main.au3 (#include "packshot.au3"). This is what I'm using to 'cycle' through the currently available packshots. local $curCover=0 Func switchPackshot() Local $covers[3] $covers[0]="data\games\battlefield3" $covers[1]="data\games\borderlands2" $covers[2]="data\nothumbnail.jpg" If $curCover == 2 Then $curCover = -1 $curCover=$curCover+1 GUIctrlSetImage($PACKSHOT, $covers[$curCover]) ConsoleWrite($curCover&@CRLF) EndFunc This is how the scripts are placed. MAIN FOLDER |---data |---|---games |---|---|---battlefield3 |---|---|---|---cover.jpg |---|---|---borderlands2 |---|---|---|---cover.jpg |---|---nothumbnail.jpg |---main.au3 |---packshot.au3 The default image is nothumbnail.jpg, it doesn't change when I call the function... >_< "The story of a blade is linked in Blood." ―Yasuo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2012 Moderators Share Posted November 4, 2012 megablox,I imagine the lack of replies is due the existence of the "G"-word in your folder structure. Could you please explain just what you are doing to assure us that you are not interacting with a game? Then you might well get some help for what at first glance looks like a simple problem. M23Possible hint: GUICtrlSetImage takes a picture file as a parameter. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Khryus Posted November 4, 2012 Author Share Posted November 4, 2012 I'll send a screenshot instead, it'll be easier to understand that way *rather big picture ahead* Possible hint: GUICtrlSetImage takes a picture file as a parameter. While I was waiting for a reply I found a workaround, I'm using the same method, and it seems to work The problem is I can't do it like this, because there will be many other game covers to be used (probably one for each game out there). $curCover=0 Func switchPackshot() Local $covers[3] $covers[0] = "data\nothumbnail.jpg" $covers[1] = "data\games\battlefield3\cover.jpg" $covers[2] = "data\games\borderlands2\cover.jpg" Switch $curCover Case 0 $curCover=1 GUICtrlSetImage($PACKSHOT, $covers[1]) Case 1 $curCover=2 GUICtrlSetImage($PACKSHOT, $covers[2]) Case 2 $curCover=0 GUICtrlSetImage($PACKSHOT, $covers[0]) EndSwitch EndFunc "The story of a blade is linked in Blood." ―Yasuo Link to comment Share on other sites More sharing options...
Khryus Posted November 4, 2012 Author Share Posted November 4, 2012 Oh derp I forgot to add the cover.jpg. Well, thanks for pointing that out Should have controlled once more before posting anyways ^^ "The story of a blade is linked in Blood." ―Yasuo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2012 Moderators Share Posted November 4, 2012 (edited) megablox, Thanks for that. I see you used my hint: $covers[1]="datagamesborderlands2" ; now reads $covers[2] = "datagamesborderlands2cover.jpg" The function does work better with a file name rather than a simple folder path. M23 Edit: I see the light went on a little later than I thought! Edited November 4, 2012 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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