Page 1 of 1

[guiserver-02] refresh image-label

Posted: Fri Jun 08, 2007 11:52 am
by newdep
Hi Lutz,

How can i update an image-label with a new image...?

I trief enable disable refesh etc...

Im unable to get the image refreshed...

Btw..it would be nice if the icon-path would also be a i.e. (read-file ....) action...
instead of reading from disk it reads from text directly..

Regards,
Norman.

Posted: Fri Jun 08, 2007 4:42 pm
by Lutz
This worked for me:

Code: Select all

(gs:frame 'TestFrame 100 100 250 200 "Test")
(gs:panel 'ThePanel)
(gs:image-label 'aImage "/local/newLISP128.png")
(gs:toggle-button 'Toggle 'toggle-action "toggle")
(gs:add-to 'ThePanel 'aImage 'Toggle)
(gs:add-to 'TestFrame 'ThePanel)
(gs:set-visible 'TestFrame true)

(define (toggle-action id flag)
    (if flag
        (gs:set-icon 'aImage "/local/newLISP32.png")
        (gs:set-icon 'aImage "/local/newLISP128.png"))
)
Lutz

Posted: Fri Jun 08, 2007 4:54 pm
by newdep
Aha oke.. Im just wondering if the set-icon does a refresh of the label
or if the toggle button does this... I tried this yesterday but not with
a toggle button..could not get is working... Ill try it again...


Nope.. the set-icon only does not refresh the image-label...
This is odd...

The problem is.. My image is every 5 seconds different but with
the same name ;-) So i want an update of the image every 5 seconds
without user interaction...

Norman.

Posted: Fri Jun 08, 2007 9:25 pm
by Lutz
Wait until the 2D graphics stuff is implemented. It gives better control for animating and otherwise handling images.

My example works beccause pressing the toggle button fources a repaint of the window, which fources a repaint of the label. With the 2D stuff you will have repaint behaviour under program control.

The currently implemented facilities aren't really meant for this.

Lutz