April 25, 2024, 05:12:08 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Animated GIF in Window Question

Started by billhsln, April 02, 2012, 07:00:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

My main program is a Dialog, I created a borderless Window to display an Animated GIF.  It displays the GIF, but does not do the Animation.  Is there something special I need to do to make it animate?

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

Animated gifs are actually multiple images. simply putting it in a window will only show the first image because there is no "smarts" to switch between the image frames.
One solution is to create a separate gif file for each frame in the original.
You load all the images and then create a timer that switches the images in and out to get the animation effect.

Another is to use an embedded browser and use your original gif.
following is some code that was originally created by DOC.
Notice there are 3 windows:win, cover, and browserwin
the win window can be changed over into your dialog
notice the browserwin is a child of the cover window.
Also notice that the browserwin is 20 pixels wider and taller than its parent.
This is the technique to hide the browsers scrollbars.

AUTODEFINE "OFF"
DEF win,browserwin,cover:WINDOW
DEF run,screenW,screenH:INT
GETSCREENSIZE screenW,screenH
OPENWINDOW win,0, 0, 600, 400,@CAPTION|@topmost, 0, "", &main
OPENWINDOW cover,250, 150, 80, 80,@NOCAPTION|@NOAUTODRAW,win, "", &main
OPENWINDOW browserwin, 0,0,100,100,@NOCAPTION,cover, "", &main
ATTACHBROWSER(browserwin)
BROWSECMD browserwin, @NAVIGATE ,GETSTARTPATH+"new6.gif"

run = 1
WAITUNTIL run = 0
CLOSEWINDOW win
END

SUB main
SELECT @CLASS
  CASE @IDCLOSEWINDOW
    run = 0
ENDSELECT
RETURN
ENDSUB


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Very interesting.  That should solve my problem.

I was originally trying to use timer and progress bar, but it seems that when doing a large select from Access (2+ M records), the progress bar does nothing.  All resources are taken up by Access and none are given to the progress bar/timer.

Thanks for the help.

Bill
When all else fails, get a bigger hammer.

LarryMc

Quote from: billhsln on April 02, 2012, 10:38:31 PM
I was originally trying to use timer and progress bar, but it seems that when doing a large select from Access (2+ M records), the progress bar does nothing.  All resources are taken up by Access and none are given to the progress bar/timer.
I don't know what your code looks like but sometimes, if you are in a tight loop, you can insert a WAIT 1 statement to make the program share some time.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Very strange.  I created a short sample program to run and it works 100%.  How ever in my program, using the same basic parameters, it does not work.

DEF x,y,run_b,run_c:INT
DEF d1:DIALOG
DEF wb, wc:WINDOW

GETSCREENSIZE x,y

x = x - 40
y = y - 80

CREATEDIALOG d1,0,0,x,y,0x80C80080,0,"HealthMonitor",&d1_handler
DOMODAL d1

END

SUB d1_handler(),int
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
' OPENWINDOW wc,995,10,75,75,@NOCAPTION|@NOAUTODRAW,d1,"",&main_c
OPENWINDOW wc,195,10,95,95,@NOCAPTION|@NOAUTODRAW,d1,"",&main_c
OPENWINDOW wb,0,0,110,110,@NOCAPTION,wc,"",&main_b
ATTACHBROWSER(wb)
BROWSECMD wb,@NAVIGATE,GETSTARTPATH + "search002.gif"
CASE @IDCLOSEWINDOW
CASE& @IDDESTROY
CLOSEWINDOW wb
CLOSEWINDOW wc
CLOSEDIALOG d1,@IDOK
ENDSELECT
RETURN 0
ENDSUB

SUB main_b(),INT
SELECT @CLASS
CASE @IDCREATE
run_b = 1
  CASE @IDCLOSEWINDOW
    run_b = 0
ENDSELECT
RETURN 0
ENDSUB

SUB main_c(),INT
SELECT @CLASS
CASE @IDCREATE
run_c = 1
  CASE @IDCLOSEWINDOW
    run_c = 0
ENDSELECT
RETURN 0
ENDSUB


The above is my sample which works.  Then only real difference is that I am doing an SQL select on a data base with over 2 Million records.  I have it display the GIF then do the search (gif is a rotating search), then I shut the GIF down after all the data has been loaded.  I am guessing that the SQL Search takes up all the cycles and does not let the GIF animate?

Bill
When all else fails, get a bigger hammer.

LarryMc

email me your code so I can see exactly what you're trying to do, when.
I'll look at it tomorrow.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Bill
Modify  this portion of your code and see what happens.

IF LEN(err)
MESSAGEBOX d1,"(1605) Problem with SELECT " + err + "\n\n" + stmt,"Error"
ELSE
lvi = -1
WHILE dbGet(hStmt)
lvi ++
LV_Load()
wait 1 '<== add this here
ENDWHILE
ENDIF


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

April 07, 2012, 05:06:12 AM #7 Last Edit: April 09, 2012, 08:53:23 AM by billhsln
Added the WAIT 1, now the program aborts on the Wait.  At least, it seems to, due to it loads one line into the listview then aborts.

I think I am going to use a simpler solution, not as pretty, but very straight forward.  Just put up a text box with record count, saying 'Loaded x records'.

Thanks,
Bill
When all else fails, get a bigger hammer.