Jump to content
Sign in to follow this  
Khryus

GUI Picture control not updating?

Recommended Posts

Khryus

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

 

Share this post


Link to post
Share on other sites
Melba23

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

M23

Possible hint: GUICtrlSetImage takes a picture file as a parameter. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Khryus

I'll send a screenshot instead, it'll be easier to understand that way :P

*rather big picture ahead*

Posted Image

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 :ermm:

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

 

Share this post


Link to post
Share on other sites
Khryus

Oh derp :sweating:

I forgot to add the cover.jpg. Well, thanks for pointing that out :P

Should have controlled once more before posting anyways ^^


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
Melba23

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! :D

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×